timheuer avatar

Sampledotnetmcpserver

timheuer/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 tools

Public 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 range
  • say_hello_name and say_goodbye_name: Simple greeting tools
  • get_weather_by_zip_code: Gets current weather information for any US zip code
  • get_weather_forecast: Gets a multi-day weather forecast for any US zip code

Features


View the full README on GitHub

Details

Repository
github.com/timheuer/sampledotnetmcpserver
Package
TimHeuer.SampleDotnetMcpServer
Transport
STDIO
Registry
MCP registry, active