The .NET Framework MCP Server is a specialized TCP-based tool that enables Claude Code (running in WSL or other Linux environments) to remotely build and work with Windows .NET Framework projects. It bridges the gap between AI assistants and the Windows build environment, allowing you to leverage AI capabilities with legacy .NET Framework applications.
Prerequisites:
Build the MCP server:
build-on-windows.bat
This creates a self-contained executable in the publish
folder.
Start the TCP server:
run-tcp-server.bat
The server will start listening on port 3001.
Prerequisites:
sudo apt install netcat-openbsd
Configure Claude Code by editing ~/.config/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"dotnet-framework": {
"command": "/path/to/wsl-mcp-bridge.sh",
"env": {
"MCP_DEBUG": "true"
}
}
}
}
Create the bridge script:
#!/bin/bash
exec nc localhost 3001
Make it executable:
chmod +x wsl-mcp-bridge.sh
Restart Claude Code to apply the configuration.
Builds a .NET project or solution.
Parameters:
path
(string, required): Path to .csproj or .sln fileconfiguration
(string): Build configuration (Debug/Release)platform
(string): Target platform (Any CPU/x86/x64)restore
(boolean): Restore NuGet packagesRuns tests in a .NET test project.
Parameters:
path
(string, required): Path to test projectfilter
(string): Test filter expressionverbose
(boolean): Enable verbose outputExecutes a .NET console application.
Parameters:
path
(string, required): Path to projectargs
(array): Command line argumentsworkingDirectory
(string): Working directoryGets information about a solution structure.
Parameters:
path
(string, required): Path to .sln fileLists NuGet packages in a project.
Parameters:
path
(string, required): Path to projectThe service can be configured through appsettings.json
or environment variables:
{
"McpServer": {
"MsBuildPath": "auto",
"DefaultConfiguration": "Debug",
"DefaultPlatform": "Any CPU",
"TestTimeout": 300000,
"BuildTimeout": 1200000,
"EnableDetailedLogging": false,
"PreferredVSVersion": "2022",
"UseDotNetCli": false,
"DotNetPath": "dotnet"
}
}
Environment variables use the prefix MCPSERVER_
, for example:
MCPSERVER_DefaultConfiguration=Release
MCPSERVER_EnableDetailedLogging=true
run-tcp-server-vs2022.bat
for explicit VS2022 MSBuildset MSBUILD_PATH=C:\Path\To\MSBuild\Bin
WSL2 networking varies by configuration. Try these solutions:
# Option 1: Find Windows host IP (for default NAT mode):
ip route show | grep -i default | awk '{ print $3}'
# Or check nameserver:
cat /etc/resolv.conf | grep nameserver
Then update your bridge script to use the IP address instead of "localhost"
Change the port in both the server startup and bridge script.
Enable dotnet CLI mode via configuration file (appsettings.json
):
{
"McpServer": {
"UseDotNetCli": true
}
}
Or via environment variable:
set MCPSERVER__UseDotNetCli=true
Note that the dotnet CLI has some limitations with older .NET Framework projects.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "dotnet-framework" '{"command":"/path/to/wsl-mcp-bridge.sh","env":{"MCP_DEBUG":"true"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"dotnet-framework": {
"command": "/path/to/wsl-mcp-bridge.sh",
"env": {
"MCP_DEBUG": "true"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"dotnet-framework": {
"command": "/path/to/wsl-mcp-bridge.sh",
"env": {
"MCP_DEBUG": "true"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect