
Knapcode.SampleMcpServer
Wire a minimal C# MCP server into Claude Code or Cursor to learn stdio transport, tool schemas, and NuGet-based MCP hosting before building a real integration.
Overview
Knapcode.SampleMcpServer is a MCP server for the Build phase that demonstrates C# MCP stdio hosting with demo random-number and random-weather tools for agent integration practice.
What is this MCP server?
- Reference implementation built with the official MCP C# SDK on NuGet (Knapcode.SampleMcpServer, stdio transport)
- Demo tools: generate random numbers and random weather strings for agent tool-calling exercises
- Configurable WEATHER_CHOICES env var (required) to teach secrets/config patterns without real APIs
- NuGet launch pattern: positional args mcp start—mirrors how many .NET MCP servers are packaged
- Version 0.7.0-beta—explicitly a learning scaffold, not a production data or automation backend
- Server version 0.7.0-beta per MCP registry schema
- Single NuGet package with stdio transport
- Two documented demo capabilities: random numbers and random weather
What problem does it solve?
You understand MCP conceptually but lack a tiny, runnable C# server to prove your agent can list and invoke tools before you commit to a real API wrapper.
Who is it for?
Indie developers learning MCP on .NET who want a zero-dependency demo server with configurable weather strings and random numeric output.
Skip if: Teams that need production automations, persistent data, authentication, or meaningful business workflows from day one.
What do I get? / Deliverables
After registering the NuGet stdio server, your agent can successfully call demo MCP tools and you have a concrete template for packaging your own C# MCP server.
- Working stdio MCP registration in your agent config
- Verified agent invocations of random number and random weather tools
- Reusable C# MCP packaging pattern for your next custom server
Recommended MCP Servers
Journey fit
Sample and reference servers belong on the Build shelf because solo builders install them while learning how agents call tools, not while researching markets or operating production. Agent-tooling is the right subphase: the value is experimenting with MCP registration, environment variables, and demo tools—not shipping product features or payment flows.
How it compares
NuGet sample MCP server for learning transport and tools—not a hosted AI skill or a production integration catalog.
Common Questions / FAQ
Who is Knapcode.SampleMcpServer for?
It is for solo builders and .NET developers who are adding their first MCP server to an agent and want a small, open-source C# reference instead of reading specs alone.
When should I use Knapcode.SampleMcpServer?
Use it during Build while configuring agent-tooling—after you pick an MCP client but before you build a custom server for your product’s APIs.
How do I add Knapcode.SampleMcpServer to my agent?
Install the NuGet package Knapcode.SampleMcpServer, run it via stdio with mcp start, set the required WEATHER_CHOICES environment variable, and register that command in your MCP client’s server list.