
Sampledotnetmcpserver
A reference implementation showing how to build MCP servers in .NET using the ModelContextProtocol SDK. Ships with working examples including weather lookups via wttr.in (get_weather_by_zip_code, get_weather_forecast), random number generation, and simple greeting tools. Demonstrates the full lifecycle from implementing tools in C# to packaging as a NuGet package that can run via dnx. Useful if you're building MCP servers in .NET and want to see how tool registration, stdio transport configuration, and NuGet publishing work in practice. The weather tools make good starting points for API integration patterns.
- GitHub stars
- 4
- tools
- 5
- transport
- STDIO
- last updated
- Sep 22, 2025
Tools
5 toolsPublic tool metadata for what this MCP can expose to an agent.
get_random_numberGenerates random numbers within a specified range
Generates random numbers within a specified range
No parameter schema in public metadata yet.
say_hello_nameSimple greeting tool
Simple greeting tool
No parameter schema in public metadata yet.
say_goodbye_nameSimple greeting tool
Simple greeting tool
No parameter schema in public metadata yet.
get_weather_by_zip_codeGets current weather information for any US zip code
Gets current weather information for any US zip code
No parameter schema in public metadata yet.
get_weather_forecastGets a multi-day weather forecast for any US zip code
Gets a multi-day weather forecast for any US zip code
No parameter schema in public metadata yet.
Sponsors
Readme
SampleDotnetMcpServer
This project is a sample implementation of a Model Context Protocol (MCP) server in .NET, designed to demonstrate how to build, run, and publish an MCP server using C# and the ModelContextProtocol SDK.
mcp-name: io.github.timheuer/sampledotnetmcpserver
What is this?
SampleDotnetMcpServer is a reference MCP server for .NET, showing how to:
- Implement MCP tools in C# (see
Tools/RandomNumberTools.cs,Tools/SayHelloName.cs,Tools/WeatherTools.cs) - Register tools and configure the MCP server transport (see
Program.cs) - Package and publish the server as a NuGet package for use in IDEs like VS Code and Visual Studio
The included tools demonstrate various MCP capabilities:
get_random_number: Generates random numbers within a specified rangesay_hello_nameandsay_goodbye_name: Simple greeting toolsget_weather_by_zip_code: Gets current weather information for any US zip codeget_weather_forecast: Gets a multi-day weather forecast for any US zip code
Features
Details
- Repository
- github.com/timheuer/sampledotnetmcpserver
- Package
TimHeuer.SampleDotnetMcpServer- Transport
- STDIO
- Registry
- MCP registry, active