- Explore MCP Servers
- MCPServerLab
Mcpserverlab
What is Mcpserverlab
MCPServerLab is a .NET 9 example project that implements the Model Context Protocol (MCP) using C#. It serves as a guide for developers to understand and utilize MCP in their applications.
Use cases
Use cases for MCPServerLab include building applications that need to manage and communicate context information, developing tools that utilize the Model Context Protocol for enhanced data handling, and educational purposes for learning about MCP in C#.
How to use
To use MCPServerLab, ensure you have Visual Studio or another C# development environment installed along with .NET 8 or later SDK. Clone the repository, install the necessary NuGet packages, and implement the MCP client by following the provided steps in the README.
Key features
Key features of MCPServerLab include a structured guide for setting up an MCP client, the ability to implement basic operations, and testing capabilities through the inspector UI Tool to validate MCP requests.
Where to use
MCPServerLab can be used in software development projects that require context management and protocol implementation, particularly in .NET applications where C# is the primary programming language.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcpserverlab
MCPServerLab is a .NET 9 example project that implements the Model Context Protocol (MCP) using C#. It serves as a guide for developers to understand and utilize MCP in their applications.
Use cases
Use cases for MCPServerLab include building applications that need to manage and communicate context information, developing tools that utilize the Model Context Protocol for enhanced data handling, and educational purposes for learning about MCP in C#.
How to use
To use MCPServerLab, ensure you have Visual Studio or another C# development environment installed along with .NET 8 or later SDK. Clone the repository, install the necessary NuGet packages, and implement the MCP client by following the provided steps in the README.
Key features
Key features of MCPServerLab include a structured guide for setting up an MCP client, the ability to implement basic operations, and testing capabilities through the inspector UI Tool to validate MCP requests.
Where to use
MCPServerLab can be used in software development projects that require context management and protocol implementation, particularly in .NET applications where C# is the primary programming language.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP (Model Context Protocol) 使用 C# 的入門指南
本指南將帶您逐步了解如何在 C# 中使用 MCP (Model Context Protocol)。
目錄
前置準備
- 確保已安裝以下工具:
- Visual Studio 或其他 C# 開發環境
- .NET 8 或更新版本的 SDK
- Clone 本 repository 至本地環境:
git clone <repository-url> cd MCPServerLab
安裝必要套件
-
開啟專案目錄,並執行以下命令以新增必要的 NuGet 套件:
dotnet add package ModelContextProtocol --version 0.1.0-preview.11 dotnet add package Microsoft.Extensions.Hosting -
確保
csproj文件中已正確引用這些套件。
建立 MCP 客戶端
- 新增一個類別檔案
HelloWorldToolInstance.cs。 - 實現 MCP 客戶端的基本結構:
[McpServerToolType] public class HelloWorldToolInstance { [McpServerTool, Description("Hello World Tool")] public string GetYourCityName(string city) => $"Hello! Wellcome to {city}!"; }
實現基本操作
使用 npx 叫起 dotnet run
$ npx @modelcontextprotocol/inspector dotnet run
測試與驗證
- 藉由 inspector UI Tool 確認 MCP 請求是否成功。
- 根據測試結果調整程式碼。
結語
透過以上步驟,您已成功在 C# 中實現 MCP 的基本操作。如需進一步擴展,請參考本 repository 的 Source Code 或相關文件。
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










