mcp-csharp-test
覆盖从工具方法单测到内存协议集成测试的完整测试场景,便于保证 MCP 服务质量。
为 C# MCP 服务器提供单元和内存/端到端集成测试模板与指南。
为 C# 写 MCP 服务器时提供单元测试和集成/端到端测试的模版与实践,既能测试单个工具的方法也能用内存中的 MCP 客户端跑协议级集成测试。适合需要验证工具列出、调用、依赖注入和协议兼容性的场景,也会讲如何用 WebApplicationFactory 测试 HTTP MCP 服务器。重点是覆盖不同测试层级和模拟依赖,非压力测试或客户端测试方案。
▸ 展开 SKILL.md 英文原文
Test C# MCP servers at multiple levels: unit tests for individual tools and integration tests using the MCP client SDK. USE FOR: unit testing MCP tool methods, integration testing with in-memory MCP client/server, end-to-end testing via MCP protocol, testing HTTP MCP servers with WebApplicationFactory, mocking dependencies in tool tests, creating evaluations for MCP servers, writing eval questions, measuring tool quality. DO NOT USE FOR: testing MCP clients (this is server testing only), load or performance testing, testing non-.NET MCP servers.
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.md"# C# MCP Server Testing Test MCP servers at two levels: unit tests for individual tool methods, and integration tests that exercise the full MCP protocol in-memory. ## When to Use - Adding automated tests to an MCP server - Testing individual tool methods with mocked dependencies - Writing integration tests that validate tool listing and invocation via MCP protocol - Setting up CI test pipelines for MCP servers ## Stop Signals - **No server yet?** → Use `mcp-csharp-create` first ## Inputs | Input | Required | Description | |-------|----------|-------------| | MCP server project path | Yes | Path to the server `.csproj` being tested | | Test framework | Recommended | Default: xUnit. Al