ModelContextProtocol NuGet package and Microsoft.Extensions.Hosting to create MCP servers with minimal boilerplate.
- Basic (stdio)
- Advanced (HTTP + Azure)
Basic calculator server
The basic sample (03-GettingStarted/samples/csharp) is a stdio MCP server that exposes five calculator tools: Add, Subtract, Multiply, Divide, and IsPrime.Server code
WithToolsFromAssembly(). Any static method decorated with [McpServerTool] is registered as an MCP tool — no manual registration needed.Configure in VS Code
Create.vscode/mcp.json in your workspace root:.vscode/mcp.json
Run in Docker
Build and push a container image for the server:mcp.json to run from the image:.vscode/mcp.json