
Sampledotnetmcpserver
io.github.timheuerPublished by GitHub account timheuerv0.1.57-betaUpdated Oct 24, 2026
Sample .NET MCP Server
Overview
A reference .NET MCP server sample that exposes demo tools for random numbers, greetings and US zip-code weather, meant for learning how to build MCP servers…
- What you can do
- Generate random integers within a specified range
- Say hello or goodbye to a given name
- Look up current weather for a US zip code
- Get a multi-day weather forecast for a US zip code
- When to use it
- Useful if you want a working example of an MCP server written in C# with the ModelContextProtocol SDK, to test MCP client or IDE integration, or to see how tools are registered and packaged as a NuGet server. It is a demonstration project rather than a production tool.
- Requirements
- Runs locally over stdio as a .NET process; the .NET SDK is needed to run from source, or the dnx tool to launch the published NuGet package. No authentication, environment variables or headers are declared. Weather tools rely on the wttr.in API, so network access is needed for them.
Installation
In SourceWeft
- Open Sampledotnetmcpserver in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
- Implements the MCP protocol using stdio transport
- Provides multiple sample tools:
get_random_number: Returns a random integer in a specified rangesay_hello_nameandsay_goodbye_name: Simple greeting toolsget_weather_by_zip_code: Gets current weather for any US zip code using wttr.in APIget_weather_forecast: Gets multi-day weather forecast for any US zip code
- Ready to be packed and published as a NuGet MCP server
- Example configuration files and metadata included
How to use
Run locally
You can run the MCP server directly from source for development and testing:
Or configure your IDE to use the following MCP server definition:
Test the MCP server
Once running, you can use Copilot Chat or any MCP client to invoke the available tools:
Weather Tools:
- Ask: "What's the weather like in 90210?" to get current weather
- Ask: "Give me a 3-day forecast for 10001" to get a weather forecast
- Ask: "Check the weather in 60601" to test with Chicago's zip code
Other Tools:
- Ask: "Give me 3 random numbers" to use the random number generator
- Ask: "Say hello to John" to use the greeting tools
Publish to NuGet.org
CI handles publishing to NuGet, using NuGet Trusted Publishing for the key and automatic versioning using Nerdbank.GitVersioning.
Use from NuGet.org
After publishing, configure your IDE to use the MCP server from NuGet.org. Example configuration (replace package id and version):
Project structure
Program.cs: MCP server entry point and configurationTools/RandomNumberTools.cs: Example MCP tool for generating random numbersTools/SayHelloName.cs: Example MCP tools for greetingsTools/WeatherTools.cs: Weather-related MCP tools for checking weather by zip code.mcp/server.json: MCP server metadata and NuGet package infoSampleDotnetMcpServer.csproj: Project and NuGet packaging configuration
Learn more
- ModelContextProtocol SDK
- Model Context Protocol Documentation
- Protocol Specification
- GitHub Organization
- Use MCP servers in VS Code (Preview)
- Use MCP servers in Visual Studio (Preview)
This project is for demonstration and reference purposes only. For feedback or contributions, see the GitHub repository.
Source: README.md at commit bf81344
Tools
0Version history
1- v0.1.57-betaLatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts