
Knapcode.SampleMcpServer
com.joelverhagen.mcp由 mcp.joelverhagen.com 發布v0.10.0-beta.10更新於 Oct 24, 2026
A sample MCP server using the MCP C# SDK. Generates random numbers and random weather.
概覽
以 MCP C# SDK 建置的範例 MCP 伺服器,為助理提供隨機數與隨機天氣工具。
- 可以做什麼
- 依需求產生隨機數
- 產生隨機天氣值,可選值由 WEATHER_CHOICES 設定提供
- 作為將 C# MCP 伺服器打包成 NuGet 套件的參考範例
- 適用情境
- 主要適合作為示範或範本,用來在 VS Code 中試用 MCP,或了解 C# MCP 伺服器如何打包與設定。不適合真實的天氣或數值資料需求。
- 執行需求
- 以 NuGet 套件形式透過 dnx 指令在本機以 stdio 執行,或使用 dotnet CLI 從原始碼執行。需以 WEATHER_CHOICES 環境變數提供天氣選項。未宣告任何驗證機制。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Knapcode.SampleMcpServer,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.jsonto 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.
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.
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:
Alternatively, you can configure your VS Code user settings to use your local project:
來源:README.md,提交 1b6a316
工具
0版本歷史
1- v0.10.0-beta.10最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。