Knapcode.SampleMcpServer

com.joelverhagen.mcpPublished by mcp.joelverhagen.comv0.10.0-beta.10Updated Oct 24, 2026

A sample MCP server using the MCP C# SDK. Generates random numbers and random weather.

VerifiedSTDIODesktop onlyDeveloper Tools

Overview

AI-generated overview

A sample MCP server built with the MCP C# SDK that gives an assistant tools for random numbers and random weather.

What you can do
  • Generate random numbers on request
  • Produce random weather values, with the choices supplied through the WEATHER_CHOICES setting
  • Serve as a reference example of packaging a C# MCP server as a NuGet package
When to use it
Useful mainly as a demo or template for trying out MCP in VS Code or for learning how a C# MCP server is packaged and configured. It is not intended for real weather or numeric data needs.
Requirements
Runs locally over stdio as a NuGet package launched with the dnx command, or from source with the dotnet CLI. The WEATHER_CHOICES environment variable supplies the weather options. No authentication is declared.
Before you install
It is explicitly a sample project, so its tools return random placeholder data rather than real information. Review the package before relying on it for anything beyond experimentation.

Installation

In SourceWeft

  1. Open Knapcode.SampleMcpServer in the dashboard and add it to a workspace.
  2. 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

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

Once the MCP server package is published to NuGet.org, you can use the following VS Code user configuration to download and install the MCP server package. See Use MCP servers in VS Code (Preview) for more information about using MCP servers in VS Code.

json
{  "mcp": {    "servers": {      "Knapcode.SampleMcpServer": {        "type": "stdio",        "command": "dnx",        "args": [          "[email protected]",          "--yes",          "--",          "mcp",          "start"        ],        "env": {          "WEATHER_CHOICES": "sunny,humid,freezing"        }      }    }  }}

Now you can ask Copilot Chat for a random number, for example, Give me 3 random numbers. It should prompt you to use the get_random_number tool on the Knapcode.SampleMcpServer MCP server and show you the results.

Developing locally in VS Code

To test this MCP server from source code (locally) without using a built MCP server package, create a .vscode/mcp.json file (a VS Code workspace settings file) in your project directory and add the following configuration:

json
{  "servers": {    "Knapcode.SampleMcpServer": {      "type": "stdio",      "command": "dotnet",      "args": [        "run",        "--project",        "<RELATIVE PATH TO PROJECT DIRECTORY>",        "--",        "mcp",        "start"      ],      "env": {        "WEATHER_CHOICES": "sunny,humid,freezing"      }    }  }}

Alternatively, you can configure your VS Code user settings to use your local project:

json
{  "mcp": {    "servers": {      "Knapcode.SampleMcpServer": {        "type": "stdio",        "command": "dotnet",        "args": [          "run",          "--project",          "<FULL PATH TO PROJECT DIRECTORY>"          "--",          "mcp",          "start"        ]      },      "env": {        "WEATHER_CHOICES": "sunny,humid,freezing"      }    }  }}

Source: README.md at commit 1b6a316

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.10.0-beta.10LatestSep 16, 2026

Score

40% 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

    Declare a license in the repository or the registry entry.