Sampledotnetmcpserver logo

Sampledotnetmcpserver

Demonstrates a .NET stdio MCP server with greeting, random-number, and US ZIP-code weather tools.

Install Sampledotnetmcpserver

Run the project’s own setup commands, in order.

Setup steps from the project

sampledotnetmcpserver installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Start the server
    dotnet run --project .
    

Overview

sampledotnetmcpserver MCP server is a C# reference implementation built with the ModelContextProtocol SDK. It runs over stdio and exposes tools for generating random numbers, greeting or saying goodbye to a name, and retrieving weather by US ZIP code. Run it from the project with the .NET CLI, or package it as a NuGet MCP server for supported development environments. Reach for it when you need a small .NET example for learning, testing, or validating MCP client configuration.

Use cases

  • Learn how to implement MCP tools in C#
  • Test stdio MCP client configuration
  • Query current weather by US ZIP code
  • Generate random integers within a range
  • Package a .NET MCP server for NuGet

Key features

  • C# implementation using the ModelContextProtocol SDK
  • stdio transport
  • Random-number and greeting tools
  • Current weather lookup by US ZIP code
  • Multi-day weather forecasts
  • NuGet packaging configuration

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 82d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars4Stargazers on the source repository.
Last commit1y agoMost recent push to the default branch.

How Sampledotnetmcpserver works

What sampledotnetmcpserver MCP server does

sampledotnetmcpserver MCP server is a reference implementation for building an MCP server with C# and the ModelContextProtocol SDK. Its tools are intentionally small and demonstrate several common tool shapes rather than providing a production application.

The server exposes a random-number tool that returns integers within a requested range. It also includes separate greeting and goodbye tools that accept a name. Weather tools accept a US ZIP code: one returns current weather information and another returns a multi-day forecast. The current-weather tool uses the wttr.in API.

This makes the project useful for developers learning how tools are declared, registered, and made available to an MCP client. It is also suitable for testing client configuration and experimenting with a local .NET MCP process.

How it works

The application starts from Program.cs, where the MCP server and its transport are configured. Tool implementations are organized under the Tools directory, with separate source files for random numbers, greetings, and weather operations.

Communication uses stdio. An MCP client starts the .NET process and exchanges protocol messages through the process input and output streams. The README provides a client definition that invokes dotnet run with the project path, so the server can be used directly from a checkout without first creating a package.

The project also includes MCP metadata and packaging configuration. Its .mcp/server.json file contains server metadata and NuGet package information, while the project file defines the application and its package configuration.

Setup and configuration

For local development, run dotnet run --project . from the project directory, or point a client’s stdio configuration at the project and use dotnet as the command. The configuration needs the project path as an argument to dotnet run.

Replace the example package name and version with the published values for the package you intend to run.

No environment variables are documented as required. The repository states that CI publishes to NuGet.org using NuGet Trusted Publishing and automatic versioning through Nerdbank.GitVersioning.

Tools and capabilities

Available tools include:

  • get_random_number for an integer in a specified range.
  • say_hello_name for a simple greeting.
  • say_goodbye_name for a simple farewell.
  • get_weather_by_zip_code for current weather at a US ZIP code.
  • get_weather_forecast for a multi-day forecast at a US ZIP code.

The examples can be invoked through Copilot Chat or another MCP client after the stdio process is running. Weather requests use US ZIP codes, and the sample questions include ZIP codes for Los Angeles, New York, and Chicago.

Limitations and notes

sampledotnetmcpserver MCP server is presented as demonstration and reference code, not as a production weather service or general-purpose application. Its weather coverage is described for US ZIP codes, and the current-weather implementation depends on wttr.in.

The example is designed around stdio rather than a network transport. Developers integrating it should therefore use an MCP client configuration that can launch a local command. The repository documents use with VS Code and Visual Studio previews, while the protocol can also be exercised by other MCP clients.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Sampledotnetmcpserver

sampledotnetmcpserver is an MCP server that demonstrates C# tool implementation with the ModelContextProtocol SDK. It connects to wttr.in for current US ZIP-code weather data and provides random-number, hello, goodbye, and multi-day forecast tools over stdio for MCP clients.

Run it from the repository with `dotnet run --project .`, or configure an MCP client to invoke `dotnet run` with the project directory. A published NuGet package can instead be started through the documented `dnx` command with its package name and version.

Yes, sampledotnetmcpserver can be configured in VS Code through a stdio server definition. Set the command to `dotnet` and pass `run`, `--project`, and the path to the project directory as arguments.

Use `get_weather_by_zip_code` for current weather or `get_weather_forecast` for a multi-day forecast, supplying a US ZIP code. The current-weather tool uses the wttr.in API.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewSampledotnetmcpserver AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/sampledotnetmcpserver?style=directory)](https://allmcps.com/mcp/sampledotnetmcpserver)
HTML Embed
<a href="https://allmcps.com/mcp/sampledotnetmcpserver"><img src="https://allmcps.com/api/badge/sampledotnetmcpserver?style=directory" alt="Sampledotnetmcpserver on AllMCPs" /></a>