iox.SampleMcpServer
0.2.3-beta
{ "inputs": [ { "type": "promptString", "id": "seniverse_key", "description": "设置心知天气的调用 KEY.", "password": true } ], "servers": { "iox.SampleMcpServer": { "type": "stdio", "command": "dnx", "args": ["iox.SampleMcpServer@0.2.3-beta", "--yes"], "env": { "SENIVERSE_KEY": "${input:seniverse_key}" } } } }
.vscode/mcp.json
settings file.
dotnet tool install --global iox.SampleMcpServer --version 0.2.3-beta
dotnet new tool-manifest
dotnet tool install --local iox.SampleMcpServer --version 0.2.3-beta
#tool dotnet:?package=iox.SampleMcpServer&version=0.2.3-beta&prerelease
nuke :add-package iox.SampleMcpServer --version 0.2.3-beta
天气查询 MCP Server
调用心知天气的免费接口查询指定城市的当天天气。当查询到免费接口限制的地区时,会自动查询上一级市的天气情况。
See aka.ms/nuget/mcp/guide for the full guide.
Please note that this template is currently in an early preview stage. If you have feedback, please take a brief survey.
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.- See configuring inputs for more details.
- Pack the project using
dotnet pack
.
The bin/Release
directory will contain the package file (.nupkg), which can be published to NuGet.org.
Developing locally
To test this MCP server from source code (locally) without using a built MCP server package, you can configure your IDE to run the project directly using dotnet run
.
{
"servers": {
"IoxMcpServer": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"<PATH TO PROJECT DIRECTORY>"
]
}
}
}
Testing the MCP Server
Once configured, 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 IoxMcpServer
MCP server and show you the results.
Publishing to NuGet.org
- Run
dotnet pack -c Release
to create the NuGet package - Publish to NuGet.org with
dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json
Using the MCP Server from NuGet.org
Once the MCP server package is published to NuGet.org, you can configure it in your preferred IDE. Both VS Code and Visual Studio use the dnx
command to download and install the MCP server package from NuGet.org.
- VS Code: Create a
<WORKSPACE DIRECTORY>/.vscode/mcp.json
file - Visual Studio: Create a
<SOLUTION DIRECTORY>\.mcp.json
file
For both VS Code and Visual Studio, the configuration file uses the following server definition:
{
"servers": {
"IoxMcpServer": {
"type": "stdio",
"command": "dnx",
"args": [
"<your package ID here>",
"--version",
"<your package version here>",
"--yes"
]
}
}
}
More information
.NET MCP servers use the ModelContextProtocol C# SDK. For more information about MCP:
Refer to the VS Code or Visual Studio documentation for more information on configuring and using MCP servers:
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
Version | Downloads | Last Updated |
---|---|---|
0.2.3-beta | 0 | 9/25/2025 |
0.1.0-beta | 0 | 9/21/2025 |