Agent skill
csharp-mcp-server-generator
Generate a complete MCP server project in C# with tools, prompts, and proper configuration
Install this agent skill to your Project
npx add-skill https://github.com/github/awesome-copilot/tree/main/plugins/csharp-mcp-development/skills/csharp-mcp-server-generator
SKILL.md
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
Host.CreateApplicationBuilderfor 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.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
javascript-typescript-jest
Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
create-github-action-workflow-specification
Create a formal specification for an existing GitHub Actions CI/CD workflow, optimized for AI consumption and workflow maintenance.
update-avm-modules-in-bicep
Update Azure Verified Modules (AVM) to latest versions in Bicep files.
gtm-technical-product-pricing
Pricing strategy for technical products. Use when choosing usage-based vs seat-based, designing freemium thresholds, structuring enterprise pricing conversations, deciding when to raise prices, or using price as a positioning signal.
power-bi-dax-optimization
Comprehensive Power BI DAX formula optimization prompt for improving performance, readability, and maintainability of DAX calculations.
review-and-refactor
Review and refactor code in your project according to defined instructions
Didn't find tool you were looking for?