github/awesome-copilot/skills/dotnet-mcp-builder/SKILL.md
dotnet-mcp-builder
Build Model Context Protocol (MCP) servers in C#/.NET against the current ModelContextProtocol 1.x NuGet packages. Especially helps with cases the model often gets wrong without guidance — stale preview versions (it tends to pick 0.3 or 0.4 preview), MCP Apps (interactive UI rendered in the host), elicitation URL mode, per-session HTTP wiring, OAuth and reverse-proxy deploy specifics, and debugging concrete MapMcp / STDIO / Streamable-HTTP errors. Also covers the routine work — STDIO and Streama
- Source repository stars
- 37,126
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-07-28
- Source checked
- 2026-07-28
Decision brief
What it does—and where it fits
This skill helps you write production-quality MCP servers and basic clients in C/.NET against the official ModelContextProtocol NuGet packages, maintained by Microsoft and the MCP project. It targets the stable 1.x line and the current spec (2025-11-25).
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/github/awesome-copilot --skill "skills/dotnet-mcp-builder"Inspect the Agent Skill "dotnet-mcp-builder" from https://github.com/github/awesome-copilot/blob/9933dcad5be5caeb288cebcd370eeeb2fc2f1685/skills/dotnet-mcp-builder/SKILL.md at commit 9933dcad5be5caeb288cebcd370eeeb2fc2f1685. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
When this skill earns its keep
The .NET MCP SDK had years of preview packages (0.x-preview) before reaching 1.0. Without help, the model tends to: - Pin a stale preview version that won't compile against current samples. - Miss recent spec features (elicitation URL mode, MCP Apps, structured content blocks).…
Pin a stale preview version that won't compile against current samples.Miss recent spec features (elicitation URL mode, MCP Apps, structured content blocks).Get HTTP transport details wrong (stateful/stateless, proxy buffering, OAuth wiring). - 02
Mental model in 30 seconds
A .NET MCP server is an ordinary Microsoft.Extensions.Hosting (or WebApplication) app that wires an MCP server through DI:
A .NET MCP server is an ordinary Microsoft.Extensions.Hosting (or WebApplication) app that wires an MCP server through DI:Primitives are plain C methods on classes marked with attributes ([McpServerToolType] + [McpServerTool], [McpServerPromptType] + [McpServerPrompt], [McpServerResourceType] + [McpServerResource]). Parameters bind from JS…Server-to-client features (sampling, elicitation, roots, log/progress notifications) are methods on the injected IMcpServer. - 03
Decision tree → which references to load
Always load references/packages.md if you're creating a new project or unsure of the current package version.
Always load references/packages.md if you're creating a new project or unsure of the current package version.For multi-primitive tasks, load several at once. For trivial edits in an existing file, you usually don't need any. - 04
Cardinal rules (apply always; these prevent the highest-frequency breakages)
1. Pin the current stable package, not a preview. Use ModelContextProtocol / ModelContextProtocol.AspNetCore / ModelContextProtocol.Core at the latest 1.x. If you find yourself writing 0.3-preview or 0.4-preview, stop and check NuGet — preview APIs have breaking differences. 2.…
Pin the current stable package, not a preview. Use ModelContextProtocol / ModelContextProtocol.AspNetCore / ModelContextProtocol.Core at the latest 1.x. If you find yourself writing 0.3-preview or 0.4-preview, stop and…STDIO servers must not write to stdout. Stdout is the JSON-RPC channel. Configure LogToStandardErrorThreshold = LogLevel.Trace before anything else and never Console.WriteLine from a tool.HTTP defaults to stateful. For horizontally-scaled deployments without server-initiated traffic, set options.Stateless = true. Server-to-client features (sampling, elicitation, roots, unsolicited notifications) require… - 05
Working style
Make minimal, additive changes. Add a method to the existing tool class rather than restructuring the project.
Make minimal, additive changes. Add a method to the existing tool class rather than restructuring the project.For non-trivial setups, run dotnet build. Catches missing usings, attribute typos, and TFM mismatches before the user sees them.Confirm transport + .NET version + primitives before scaffolding if context doesn't already make them obvious. Default to .NET 10 for new projects.
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 80/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 37,126 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- github/awesome-copilot
- Skill path
- skills/dotnet-mcp-builder/SKILL.md
- Commit
- 9933dcad5be5caeb288cebcd370eeeb2fc2f1685
- License
- MIT
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
Building MCP servers in .NET
This skill helps you write production-quality MCP servers and basic clients in C#/.NET against the official ModelContextProtocol NuGet packages, maintained by Microsoft and the MCP project. It targets the stable 1.x line and the current spec (2025-11-25).
When this skill earns its keep
The .NET MCP SDK had years of preview packages (0.x-preview) before reaching 1.0. Without help, the model tends to:
- Pin a stale preview version that won't compile against current samples.
- Miss recent spec features (elicitation URL mode, MCP Apps, structured content blocks).
- Get HTTP transport details wrong (stateful/stateless, proxy buffering, OAuth wiring).
- Forget the STDIO stdout/stderr trap.
If the task is one of those, load the matching reference and follow it. If it's truly trivial (e.g. "rename this tool method"), you don't need to read everything — the cardinal rules below are the minimum.
Mental model in 30 seconds
A .NET MCP server is an ordinary Microsoft.Extensions.Hosting (or WebApplication) app that wires an MCP server through DI:
builder.Services
.AddMcpServer()
.WithStdioServerTransport() // OR .WithHttpTransport(...)
.WithToolsFromAssembly() // discover [McpServerToolType] classes
.WithPrompts<MyPrompts>() // optional
.WithResources<MyResources>(); // optional
Primitives are plain C# methods on classes marked with attributes ([McpServerToolType] + [McpServerTool], [McpServerPromptType] + [McpServerPrompt], [McpServerResourceType] + [McpServerResource]). Parameters bind from JSON-RPC; the SDK builds the JSON Schema from the signature plus [Description] attributes.
Server-to-client features (sampling, elicitation, roots, log/progress notifications) are methods on the injected IMcpServer.
Decision tree → which references to load
Always load references/packages.md if you're creating a new project or unsure of the current package version.
| Task | Load |
|---|---|
| New STDIO server | references/transport-stdio.md |
| New HTTP (Streamable) server | references/transport-http.md |
| Add/modify a tool | references/tool-primitive.md |
| Add/modify a prompt | references/prompt-primitive.md |
| Add/modify a resource | references/resource-primitive.md |
| Ask the user a question mid-tool | references/elicitation.md |
| Call the client's LLM from a tool | references/sampling.md |
| Read the user's project roots | references/roots.md |
| Return an interactive UI | references/mcp-apps.md |
| Argument completions, log/progress notifications, filters, server instructions | references/server-features.md |
| Write a .NET program that consumes an MCP server | references/client.md |
| MCP Inspector, in-memory tests, mocks, CI | references/testing.md |
For multi-primitive tasks, load several at once. For trivial edits in an existing file, you usually don't need any.
Cardinal rules (apply always; these prevent the highest-frequency breakages)
- Pin the current stable package, not a preview. Use
ModelContextProtocol/ModelContextProtocol.AspNetCore/ModelContextProtocol.Coreat the latest 1.x. If you find yourself writing0.3-previewor0.4-preview, stop and check NuGet — preview APIs have breaking differences. - STDIO servers must not write to stdout. Stdout is the JSON-RPC channel. Configure
LogToStandardErrorThreshold = LogLevel.Tracebefore anything else and neverConsole.WriteLinefrom a tool. - HTTP defaults to stateful. For horizontally-scaled deployments without server-initiated traffic, set
options.Stateless = true. Server-to-client features (sampling, elicitation, roots, unsolicited notifications) require stateful HTTP or STDIO —Stateless = truewill break them at runtime. - SSE-only is deprecated. Use Streamable HTTP. Only enable legacy SSE (
EnableLegacySse = true) for an old client you must support, and call it out. - Always
[Description]tools and parameters. This is what the LLM sees when picking and shaping calls. Vague descriptions are the #1 reason tools don't get used. - Show the registration line every time you add a primitive. A new
[McpServerPromptType]class without.WithPrompts<...>()(or.WithPromptsFromAssembly()) is invisible. - Don't invent APIs. If you're unsure a method exists, say so and check the API reference — wrong method names cause silent failures.
Working style
- Make minimal, additive changes. Add a method to the existing tool class rather than restructuring the project.
- For non-trivial setups, run
dotnet build. Catches missing usings, attribute typos, and TFM mismatches before the user sees them. - Confirm transport + .NET version + primitives before scaffolding if context doesn't already make them obvious. Default to .NET 10 for new projects.
When the user is stuck
Walk this checklist before guessing:
- STDIO: something is writing to stdout (logger sink,
Console.WriteLine, library banner). - HTTP 404: path mismatch —
app.MapMcp()is root,app.MapMcp("/mcp")puts it under/mcp. - Tool not appearing: missing
[McpServerToolType]on the class, or no.WithToolsFromAssembly()/.WithTools<T>()registered. - Args not bound: parameter names must match the JSON-RPC
argumentskeys; complex types bind viaSystem.Text.Json. - Sampling/elicitation/roots failing: transport is stateless HTTP, or the client doesn't advertise the capability.
Still stuck? Point the user at the EverythingServer sample — it exercises every feature.
Alternatives
Compare before choosing
JasonColapietro/suede-creator-skills
suede-code-grader
Give a blunt A-F ship grade for a code change across correctness, security, data, UX, verification, and deploy readiness. Use for a grade, not a findings review.
wshobson/agents
brand-landingpage
Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens —
github/awesome-copilot
foundry-hosted-agent-copilotkit
Ongoing development guidance for agentic web apps that pair a CopilotKit frontend with Microsoft Agent Framework agents on Azure AI Foundry hosted agents over the AG-UI protocol - add and gate agent tools, wire human-in-the-loop approvals, build generative UI and shared state, debug the event stream, upgrade pre-1.0 packages safely, and deploy hosted agent updates.
wshobson/agents
deployment-pipeline-design
Design multi-stage CI/CD pipelines with approval gates, security checks, and deployment orchestration. Use this skill when designing zero-downtime deployment pipelines, implementing canary rollout strategies, setting up multi-environment promotion workflows, or debugging failed deployment gates in CI/CD.