
Csharp Mcp Server Generator
Scaffold a stdio MCP server in C# with DI, tools, and logging configured for agent hosts like Claude Code or Cursor.
Overview
csharp-mcp-server-generator is an agent skill for the Build phase that scaffolds a complete C# MCP server with Host DI, stdio transport, attributed tools, and stderr logging.
Install
npx skills add https://github.com/github/awesome-copilot --skill csharp-mcp-server-generatorWhat is this skill?
- Full .NET 8+ console app layout with ModelContextProtocol and Microsoft.Extensions.Hosting packages
- Host.CreateApplicationBuilder pattern with AddMcpServer, stdio transport, and WithToolsFromAssembly discovery
- Logging routed to stderr so stdio MCP transport stays clean
- Sample tools using McpServerToolType, McpServerTool, and Description attributes with async support
- Built-in validation and error-handling guidance for tool parameters
Adoption & trust: 8.4k installs on skills.sh; 34.6k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want custom tools in your coding agent but lack a correct .NET MCP project layout, packages, and stdio-safe logging setup.
Who is it for?
Solo .NET developers adding first-party MCP tools to Claude Code, Cursor, or similar stdio-based agent hosts.
Skip if: Teams that only need REST APIs without MCP, or repos already on a maintained internal MCP template with CI.
When should I use this skill?
Asked to generate or create a complete MCP server project in C# with tools, prompts, and proper configuration.
What do I get? / Deliverables
You receive a runnable C# MCP server skeleton with at least one tool, proper attributes, and host configuration ready to extend and register with your agent.
- C# MCP console project with Host builder and stdio server config
- At least one attributed MCP tool with descriptions
- NuGet manifest with ModelContextProtocol and hosting packages
Recommended Skills
Journey fit
MCP servers are built when you extend your agent stack with custom tools—not during idea or launch work. agent-tooling is the canonical shelf for skills that generate Model Context Protocol servers and tool surfaces for coding agents.
How it compares
A procedural project generator for MCP on .NET—not a hosted MCP marketplace or a Ruby/Python scaffold.
Common Questions / FAQ
Who is csharp-mcp-server-generator for?
Indie and solo builders on .NET 8+ who need a correct MCP server bootstrap with tools, DI, and stdio transport for agent clients.
When should I use csharp-mcp-server-generator?
Use it in the Build phase when agent-tooling is on your roadmap—before you implement domain-specific MCP tools or publish a server your agent can discover.
Is csharp-mcp-server-generator safe to install?
Review the Security Audits panel on this Prism page and inspect generated code and NuGet prerelease dependencies before running in production environments.
SKILL.md
READMESKILL.md - Csharp Mcp Server Generator
# 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.