SampleDotnetMcpServer
MCP server from timheuer/SampleDotnetMcpServer
claude mcp add --transport stdio timheuer-sampledotnetmcpserver dotnet run --project <PATH TO PROJECT DIRECTORY>
How to use
SampleDotnetMcpServer is a reference MCP server implemented in .NET that demonstrates how to build, run, and publish MCP servers using the Model Context Protocol. It exposes a set of sample MCP tools implemented in C# (located under Tools), including get_random_number, say_hello_name, say_goodbye_name, get_weather_by_zip_code, and get_weather_forecast. The server communicates over the stdio transport, making it suitable for integration with IDEs like VS Code and Visual Studio, or through MCP clients such as Copilot Chat.
To use the server, run it locally using the dotnet CLI as described in the installation instructions. Once the server is running, you can invoke any of the available tools by sending MCP requests for the corresponding tool name and parameters. For example, you can ask for a random number range, request weather data by a ZIP code (which uses the wttr.in API for current weather and forecasts), or issue greeting tools to generate personalized messages. The README includes example server configurations that show how to wire the MCP server into an IDE or client, including the server type (stdio) and the command/arguments needed to launch the server.
How to install
Prerequisites:
- .NET SDK (version supporting the project, typically .NET 6+/7+)
- A basic development environment (Terminal/Command Prompt or IDE) with dotnet CLI installed
Installation steps:
- Install the .NET SDK from https://dotnet.microsoft.com/download
- Clone or download the SampleDotnetMcpServer repository
- Open a terminal and navigate to the project directory
- Run the MCP server locally:
# From the project root, using the guidance in the README (adjust path as needed)
dotnet run --project .
- Verify the server starts and listen on the stdio transport. You can connect to it from an MCP client or IDE using the example configuration provided in the README.
- Optional: Package for NuGet publishing per the project's guidance (not covered here).
Additional notes
Notes and tips:
- The SampleDotnetMcpServer uses the stdio transport, which makes it easy to integrate with IDEs and local development tooling.
- Weather tools rely on the wttr.in API for current conditions and forecasts; there is no separate API key required for basic usage in this sample.
- If you publish the server as a NuGet package, ensure you follow Nerdbank.GitVersioning or your chosen versioning strategy as indicated in the README.
- When configuring in an IDE, replace <PATH TO PROJECT DIRECTORY> with the actual path to the repository or project directory containing the .csproj/Program.cs entry point.
- If you need to expose additional tools, you can extend the Tools folder and wire them into the MCP server similarly to the existing samples.
Related MCP Servers
mssql
MSSQL Server MCP implementation written in C#
McpDotNet.Extensions.SemanticKernel
Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.
DatabaseMcpServer
MCP server from ttcc666/DatabaseMcpServer
mcp-dataverse
MCP Server for querying Dataverse using SQL
xperience-community
ASP.NET Core MCP server for Xperience by Kentico projects
console-to-http
Example of converting a stdio MCP server to HTTP using ModelContextProtocol.AspNetCore