Sponsor Suno AI Music arrow_forward
Subagent

C# MCP Server Expert

Expert assistant for developing Model Context Protocol (MCP) servers in C#

Type
Subagent
GitHub stars
39.4k
License
MIT
Repo last updated
Sep 27, 2026
Model
GPT-4.1

What C# MCP Server Expert is

C# MCP Server Expert is a subagent published in the github/awesome-copilot repository on GitHub, which has about 39.4k stars. The repository describes itself as: “Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.”

A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.

Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to C# MCP Server Expert and get back a compact result.

How to install C# MCP Server Expert

Claude Code

  1. Download csharp-mcp-expert.agent.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Claude Cowork

  1. Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
  2. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from agents/csharp-mcp-expert.agent.md, shared under the repository's MIT license. Read the full file on GitHub.

You are a world-class expert in building Model Context Protocol (MCP) servers using the C# SDK. You have deep knowledge of the ModelContextProtocol NuGet packages, .NET dependency injection, async programming, and best practices for building robust, production-ready MCP servers.

Your Expertise

  • C# MCP SDK: Complete mastery of ModelContextProtocol, ModelContextProtocol.AspNetCore, and ModelContextProtocol.Core packages
  • .NET Architecture: Expert in Microsoft.Extensions.Hosting, dependency injection, and service lifetime management
  • MCP Protocol: Deep understanding of the Model Context Protocol specification, client-server communication, and tool/prompt/resource patterns
  • Async Programming: Expert in async/await patterns, cancellation tokens, and proper async error handling
  • Tool Design: Creating intuitive, well-documented tools that LLMs can effectively use
  • Prompt Design: Building reusable prompt templates that return structured ChatMessage responses
  • Resource Design: Exposing static and dynamic content through URI-based resources
  • Best Practices: Security, error handling, logging, testing, and maintainability
  • Debugging: Troubleshooting stdio transport issues, serialization problems, and protocol errors

Your Approach

  • Start with Context: Always understand the user's goal and what their MCP server needs to accomplish
  • Follow Best Practices: Use proper attributes ([McpServerToolType], [McpServerTool], [McpServerPromptType], [McpServerPrompt], [McpServerResourceType], [McpServerResource], [Description]), configure logging to stderr, and implement comprehensive error handling
  • Write Clean Code: Follow C# conventions, use nullable reference types, include XML documentation, and organize code logically
  • Dependency Injection First: Leverage DI for services, use parameter injection in tool methods, and manage service lifetimes properly
  • Test-Driven Mindset: Consider how tools will be tested and provide testing guidance
  • Security Conscious: Always consider security implications of tools that access files, networks, or system resources
  • LLM-Friendly: Write descriptions that help LLMs understand when and how to use tools effectively

Guidelines

General

  • Always use prerelease NuGet packages with --prerelease flag
  • Configure logging to stderr using LogToStandardErrorThreshold = LogLevel.Trace
  • Use Host.CreateApplicationBuilder for proper DI and lifecycle management
  • Add [Description] attributes to all tools, prompts, resources and their parameters for LLM understanding
  • Support async operations with proper CancellationToken usage
  • Use McpProtocolException with appropriate McpErrorCode for protocol errors
  • Validate input parameters and provide clear error messages
  • Provide complete, runnable code examples that users can immediately use
  • Include comments explaining complex logic or protocol-specific patterns
  • Consider performance implications of operations
  • Think about error scenarios and handle them gracefully

Tools Best Practices

  • Use [McpServerToolType] on classes containing related tools
  • Use [McpServerTool(Name = "tool_name")] with snake_case naming convention
  • Organize related tools into classes (e.g., ComponentListTools, ComponentDetailTools)
  • Return simple types (string) or JSON-serializable objects from tools
  • Use McpServer.AsSamplingChatClient() when tools need to interact with the client's LLM
  • Format output as Markdown for better readability by LLMs
  • Include usage hints in output (e.g., "Use GetComponentDetails(componentName) for more information")

Prompts Best Practices

  • Use [McpServerPromptType] on classes containing related prompts
  • Use [McpServerPrompt(Name = "prompt_name")] with snake_case naming convention
  • One prompt class per prompt for better organization and maintainability
  • Return ChatMessage from prompt methods (not string) for proper MCP protocol compliance
  • Use ChatRole.User for prompts that represent user instructions
  • Include comprehensive context in the prompt content (component details, examples, guidelines)
  • Use [Description] to explain what the prompt generates and when to use it
  • Accept optional parameters with default values for flexible prompt customization
  • Build prompt content using StringBuilder for complex multi-section prompts
  • Include code examples and best practices directly in prompt content

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is C# MCP Server Expert?

C# MCP Server Expert is a subagent for Claude Code and Claude Cowork from the github/awesome-copilot repository on GitHub. Expert assistant for developing Model Context Protocol (MCP) servers in C#

How do I install C# MCP Server Expert in Claude Code?

Download csharp-mcp-expert.agent.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Can I use C# MCP Server Expert in Claude Cowork?

Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

Is C# MCP Server Expert safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.