此登錄庫釘選版本所收錄的最新上游作者日期。

csharp-mcp-server-generator

已凍結 v1.0.0 收錄的最新變更: 沒有已驗證的上游歷程。

Generate a complete MCP server project in C# with tools, prompts, and proper configuration

摘要

用途
建立以 C# 撰寫的 Model Context Protocol 伺服器專案,使用主機建置器管理相依性注入與 stdio 傳輸,並提供可自動探索的工具及實務操作說明。
使用時機
當你需要建立 .NET 8 以上的主控台伺服器,以提供自訂 MCP 工具,並包含設定、驗證與執行和測試指引時使用。
輸出結果
產出設定為 MCP stdio 傳輸與 stderr 記錄的主控台專案,內含至少一個具屬性標記且含驗證和錯誤處理的工具,以及執行與測試說明。
⚠ 已凍結/無上游

此技能沒有已驗證的上游來源。它凍結於 v1.0.0,不會再收到更新。

npx skills add "lettucebo/Skills#v2.2.0@csharp-mcp-server-generator" --full-depth

⚠ v2.2.0 發布後即可使用

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.

歷程

v1.0.0 bootstrap
v1.0.0 license-refresh