Skillshub csharp-mcp-server-generator
Generate a complete MCP server project in C# with tools, prompts, and proper configuration
install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/github/awesome-copilot/csharp-mcp-server-generator" ~/.claude/skills/comeonoliver-skillshub-csharp-mcp-server-generator && rm -rf "$T"
manifest:
skills/github/awesome-copilot/csharp-mcp-server-generator/SKILL.mdsource content
Generate C# MCP Server
Create a complete Model Context Protocol (MCP) server in C# with the following specifications:
Requirements
- Project Structure: Create a new C# console application with proper directory structure
- NuGet Packages: Include ModelContextProtocol (prerelease) and Microsoft.Extensions.Hosting
- Logging Configuration: Configure all logs to stderr to avoid interfering with stdio transport
- Server Setup: Use the Host builder pattern with proper DI configuration
- Tools: Create at least one useful tool with proper attributes and descriptions
- 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
for DI and lifecycle managementHost.CreateApplicationBuilder - Configure
with stdio transportAddMcpServer() - Use
for automatic tool discoveryWithToolsFromAssembly() - Ensure the server runs with
RunAsync()
Tool Implementation
- Use
attribute on tool classes[McpServerToolType] - Use
attribute on tool methods[McpServerTool] - Add
attributes to tools and parameters[Description] - 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.