npx claudepluginhub dotnet/skills --plugin dotnet-aiThis skill uses the workspace's default tool permissions.
Run, debug, and interactively test C# MCP servers. Covers local execution, IDE debugging with breakpoints, MCP Inspector for protocol-level testing, and GitHub Copilot Agent Mode integration.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Run, debug, and interactively test C# MCP servers. Covers local execution, IDE debugging with breakpoints, MCP Inspector for protocol-level testing, and GitHub Copilot Agent Mode integration.
mcp.json or .mcp.json configurationmcp-csharp-create firstmcp-csharp-testmcp-csharp-publish| Input | Required | Description |
|---|---|---|
| Project path | Yes | Path to the .csproj file or project directory |
| Transport type | Recommended | stdio or http — detect from .csproj if not specified |
| IDE | Recommended | VS Code or Visual Studio — detect from environment if not specified |
Agent behavior: Detect transport type by checking the .csproj for a PackageReference to ModelContextProtocol.AspNetCore. If present → HTTP, otherwise → stdio.
stdio transport:
cd <ProjectDir>
dotnet run
The process starts and waits for JSON-RPC messages on stdin. No output on stdout means it's working correctly.
HTTP transport:
cd <ProjectDir>
dotnet run
# Server listens on http://localhost:3001 (or configured port)
Detect the IDE and transport, then create the appropriate config file.
For VS Code — create .vscode/mcp.json:
stdio:
{
"servers": {
"<ProjectName>": {
"type": "stdio",
"command": "dotnet",
"args": ["run", "--project", "<path/to/ProjectFile.csproj>"]
}
}
}
HTTP:
{
"servers": {
"<ProjectName>": {
"type": "http",
"url": "http://localhost:3001"
}
}
}
For Visual Studio — create .mcp.json at solution root (same JSON structure).
For detailed IDE-specific configuration (launch.json, environment variables, secrets), see references/ide-config.md.
The MCP Inspector provides a UI for testing tools, viewing schemas, and inspecting protocol messages.
stdio server:
npx @modelcontextprotocol/inspector dotnet run --project <path/to/ProjectFile.csproj>
HTTP server:
dotnet runnpx @modelcontextprotocol/inspectorhttp://localhost:3001For detailed Inspector capabilities, usage, and troubleshooting, see references/mcp-inspector.md.
If tools don't appear — troubleshoot tool discovery:
Rebuild first — stale builds are the #1 cause:
dotnet build
Then restart the MCP server (click Stop → Start in VS Code, or restart dotnet run).
Check attributes and registration:
[McpServerToolType] on the class and [McpServerTool] on each public methodstatic or instance (instance types need DI registration).WithTools<T>() or .WithToolsFromAssembly() in Program.csCheck mcp.json points to the correct project path
If still not appearing, reference the tool explicitly: Using #tool_name, do X
launch.json — see references/ide-config.md)Critical: Build in Debug configuration. Breakpoints won't hit in Release builds.
When a tool works standalone but fails through MCP, work through these checks:
npx @modelcontextprotocol/inspector dotnet run --project <path>Console.WriteLine() or logging to stdout corrupts the JSON-RPC protocol. Redirect all output to stderr (see Step 6).Program.cs.builder.Logging.AddFile("mcp-debug.log"); // or use Serilog/NLog
Critical for stdio transport: Any output to stdout (including Console.WriteLine) corrupts the MCP JSON-RPC protocol and causes garbled responses or crashes. All logging and diagnostic output must go to stderr.
stdio transport — log to stderr only:
builder.Logging.AddConsole(options =>
options.LogToStandardErrorThreshold = LogLevel.Trace);
HTTP transport — For HTTP transport logging configuration, see references/ide-config.md.
In tool methods — inject ILogger<T> via constructor and use logger.LogDebug() / logger.LogError(). Logging through ILogger respects the stderr configuration above.
dotnet run| Pitfall | Solution |
|---|---|
| Tools not appearing or stale after changes | Rebuild first: dotnet build, then restart the server. If still missing, verify [McpServerToolType] on class, [McpServerTool] on methods, and WithTools<T>() or WithToolsFromAssembly() in Program.cs |
| stdio server produces garbled output | Console.WriteLine() or logging is writing to stdout. All output must go to stderr. Set LogToStandardErrorThreshold = LogLevel.Trace on the console logger |
| HTTP server returns 404 at MCP endpoint | Missing app.MapMcp() in Program.cs |
| Breakpoints not hit | Building in Release mode. Rebuild in Debug: dotnet build -c Debug, then restart |
| Environment variables not passed to server | Add "env" section to mcp.json. For secrets in VS Code, use "${input:var_id}" syntax |
| MCP Inspector can't connect to HTTP server | Server not running, or wrong port. Check dotnet run output for the listening URL |
mcp-csharp-create — Create a new MCP server projectmcp-csharp-test — Automated tests and evaluationsmcp-csharp-publish — NuGet, Docker, Azure deployment