首页/AI 代码生成与质效/csharp-mcp-server-generator
C

csharp-mcp-server-generator

by @githubv
4.5(290)

生成一个完整的C# MCP服务器项目,包含必要的工具、提示和正确的配置。

c#server-side-generationcopilot-platformcode-scaffoldingGitHub
安装方式
npx skills add github/awesome-copilot --skill csharp-mcp-server-generator
compare_arrows

Before / After 效果对比

1
使用前

手动搭建C# MCP服务器项目耗时且易出错,工具和配置复杂。开发初期投入巨大,延缓项目启动速度。

使用后

自动生成完整的C# MCP服务器项目,包含工具和正确配置。快速启动开发,确保项目符合最佳实践。

SKILL.md

Generate C# MCP Server

Create a complete Model Context Protocol (MCP) server in C# with the following specifications:

Requirements

  1. Project Structure: Create a new C# console application with proper directory structure
  2. NuGet Packages: Include ModelContextProtocol (prerelease) and Microsoft.Extensions.Hosting
  3. Logging Configuration: Configure all logs to stderr to avoid interfering with stdio transport
  4. Server Setup: Use the Host builder pattern with proper DI configuration
  5. Tools: Create at least one useful tool with proper attributes and descriptions
  6. Error Handling: Include proper error handling and validation

Implementation Details

Basic Project Setup

  • Use .NET 8.0 or later
  • Create a console application
  • Add necessary NuGet packages with --prerelease flag
  • Configure logging to stderr

Server Configuration

  • Use Host.CreateApplicationBuilder for DI and lifecycle management
  • Configure AddMcpServer() with stdio transport
  • Use WithToolsFromAssembly() for automatic tool discovery
  • Ensure the server runs with RunAsync()

Tool Implementation

  • Use [McpServerToolType] attribute on tool classes
  • Use [McpServerTool] attribute on tool methods
  • Add [Description] attributes to tools and parameters
  • Support async operations where appropriate
  • Include proper parameter validation

Code Quality

  • Follow C# naming conventions
  • Include XML documentation comments
  • Use nullable reference types
  • Implement proper error handling with McpProtocolException
  • Use structured logging for debugging

Example Tool Types to Consider

  • File operations (read, write, search)
  • Data processing (transform, validate, analyze)
  • External API integrations (HTTP requests)
  • System operations (execute commands, check status)
  • Database operations (query, update)

Testing Guidance

  • Explain how to run the server
  • Provide example commands to test with MCP clients
  • Include troubleshooting tips

Generate a complete, production-ready MCP server with comprehensive documentation and error handling.

用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量8.4K
评分4.5 / 5.0
版本
更新日期2026年5月17日
对比案例1 组

用户评分

4.5(290)
5
23%
4
51%
3
23%
2
2%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

时间线

创建2026年3月16日
最后更新2026年5月17日