SampleMcpServer 0.1.0-beta
dotnet tool install --global SampleMcpServer --version 0.1.0-beta
dotnet new tool-manifest
dotnet tool install --local SampleMcpServer --version 0.1.0-beta
#tool dotnet:?package=SampleMcpServer&version=0.1.0-beta&prerelease
nuke :add-package SampleMcpServer --version 0.1.0-beta
MCP Server
This README was created using the .NET MCP server template project. It demonstrates how you can easily create an MCP server using .NET and then package it in a NuGet package.
See aka.ms/nuget/mcp/guide for the full guide.
Checklist before publishing to NuGet.org
- Update package metadata in the .csproj file
- Update the
.mcp/server.json
to declare your MCP server's inputs - Test the MCP server locally using the steps below
Using the MCP Server in VS Code
Once the MCP server package is published to NuGet.org, you can use the following VS Code with 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.
{
"mcp": {
"servers": {
"my-custom-mcp": {
"type": "stdio",
"command": "dotnet",
"args": [
"tool",
"exec",
"<your package ID here>",
"--version",
"<your package version here>",
"--yes",
"--",
"start-mcp"
],
"env": {
"MAX_RANDOM_NUMBER": 100
}
}
}
}
}
Now you can ask Copilot chat for a random number, for example Give me 3 random numbers
. It should prompt to use the GetRandomNumber
tool on the my-custom-mcp
MCP server and show you the results.
Developing locally
To test this MCP server from source code (locally) without using a built MCP server package, use the following VS Code configuration:
{
"mcp": {
"servers": {
"my-custom-mcp": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"<PATH TO PROJECT DIRECTORY>",
"--",
"start-mcp"
],
"env": {
"MAX_RANDOM_NUMBER": 100
}
}
}
}
}
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
Version | Downloads | Last Updated |
---|