joelverhagen avatar

Knapcode Samplemcpserver

joelverhagen/knapcode.samplemcpserver

This is a demonstration server built with the C# MCP SDK that exposes two simple tools: generating random numbers and returning random weather conditions. It's designed as a teaching example rather than a production tool, showing C# developers how to package and distribute MCP servers via NuGet. The weather tool accepts configurable choices through environment variables. Reach for this when you're learning the C# MCP SDK implementation patterns or need a minimal working example to fork for your own .NET based server. The source includes complete setup instructions for both local development and NuGet package distribution.

tool
1
transport
STDIO
env var
1
last updated
Sep 12, 2025

Tools

1 tools

Public tool metadata for what this MCP can expose to an agent.

get_random_numberAsk Copilot Chat for a random number, for example "Give me 3 random numbers", which prompts use of the get_random_number tool on the Knapcode.SampleMcpServer MCP server.

Ask Copilot Chat for a random number, for example "Give me 3 random numbers", which prompts use of the get_random_number tool on the Knapcode.SampleMcpServer MCP server.

No parameter schema in public metadata yet.

Sponsors

Configuration

WEATHER_CHOICES

Readme

MCP Server - Knapcode.SampleMcpServer

This README was created using the C# MCP server template project. It demonstrates how you can easily create an MCP server using C# and then package it in a NuGet package.

See aka.ms/nuget/mcp/guide for the full guide.

Checklist before publishing to NuGet.org

  • Test the MCP server locally using the steps below.
  • Update the package metadata in the .csproj file, in particular the <PackageId>.
  • Update .mcp/server.json to declare your MCP server's inputs.
  • Pack the project using dotnet pack.

The bin/Release directory will contain the package file (.nupkg), which can be published to NuGet.org.

Using the MCP Server in VS Code


View the full README on GitHub

Details

Repository
github.com/joelverhagen/knapcode.samplemcpserver
Package
Knapcode.SampleMcpServer
Transport
STDIO
Registry
MCP registry, active