Agent skill

Creating Dotnet MCP Servers

by SebastienDegodez in SebastienDegodez/copilot-instructions

A skill your agent uses when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints

Apache-2.0Auto-check passedAgent Workflows

Install Creating Dotnet MCP Servers

skills CLI
$ npx skills add SebastienDegodez/copilot-instructions --skill creating-dotnet-mcp-servers -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install SebastienDegodez/copilot-instructions creating-dotnet-mcp-servers --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/SebastienDegodez/copilot-instructions.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/creating-dotnet-mcp-servers .claude/skills/creating-dotnet-mcp-servers && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
creating-dotnet-mcp-servers
GitHub stars
198
Token cost
~1.3k tokens
SKILL.md length
272 words
Files
4 (incl. references)
Skills in repo
19
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints

  • Works in 2 steps: Install Packages → Enable AOT
  • Building Model Context Protocol (MCP) servers in .NET
  • SKILL.md covers When to Use, Quick Reference, Basic Setup and Tool Implementation, plus 4 more sections
  • Calls dotnet

What it does

Creating Dotnet MCP Servers is an agent skill from SebastienDegodez/copilot-instructions. Use when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/advanced.md`, `references/error-handling.md` and `references/testing.md`).

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol and .NET. The repository describes itself as: A comprehensive codebase of best practices, coding rules, and workflow automation for AI-assisted development with GitHub Copilot. Includes DDD, Clean Architecture, testing… The licence is Apache-2.0.

When your agent uses it

  • Building Model Context Protocol (MCP) servers in .NET
  • Configuring tools
  • Transports (SSE/stdio)
  • JSON serialization for AOT

Example prompts

  • “/creating-dotnet-mcp-servers”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Install Packages
  2. Enable AOT

What it can do on your machine

Read from SKILL.md and the folder at commit 0f0dccf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • modelcontextprotocol.io
    • nuget.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Creating Dotnet MCP Servers loads about 1.3k tokens when it runs, and up to ~11k if it reads all its reference files. Until then it costs about 47 tokens; SKILL.md has 272 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~11k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from SebastienDegodez/copilot-instructions at commit 0f0dccf, republished under its Apache-2.0 licence (© SebastienDegodez). 272 words, ~1,256 tokens.

Download SKILL.mdSave it as .claude/skills/creating-dotnet-mcp-servers/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
creating-dotnet-mcp-servers
description
Use when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints

Creating .NET MCP Servers

Build production-ready Model Context Protocol (MCP) servers in .NET with AOT compatibility.

Core principle: MCP servers expose tools via standardized protocol using attribute-based registration and explicit JSON serialization contexts for AOT.

When to Use

mermaid
graph TD
    A[Need to build server?] -->|Yes| B[Using .NET?]
    B -->|Yes| C[MCP Protocol?]
    C -->|Yes| D[✅ Use this skill]
    C -->|No| E[❌ Use REST/gRPC guide]
    B -->|No| F[❌ See Python/TS MCP docs]
    A -->|No| G[❌ Skip]

Use this skill when:

  • Building new MCP server in .NET
  • Configuring SSE or stdio transport
  • Enabling AOT compilation
  • Need testing or error handling patterns

Not for: Non-.NET MCP, client-side integration, generic APIs

Quick Reference

TaskImplementation
Install packagesdotnet add package ModelContextProtocol + ModelContextProtocol.AspNetCore
Mark tool class[McpServerToolType]
Mark tool method[McpServerTool(Name = "ToolName"), Description("...")]
Parameter description[Description("param description")] string param
Register serverservices.AddMcpServer().WithHttpTransport().WithTools<T>()
Map endpointsapp.MapMcp() (exposes /sse)
AOT serializationCreate JsonSerializerContext with [JsonSerializable]
Test transportUse SseClientTransport + McpClientFactory

Basic Setup

1. Install Packages
bash
dotnet add package ModelContextProtocol --version 0.3.0-preview.1
dotnet add package ModelContextProtocol.AspNetCore --version 0.3.0-preview.1
# For testing (optional)
dotnet add package ModelContextProtocol.Client --version 0.3.0-preview.1
2. Enable AOT

Project configuration:

xml
<PropertyGroup>
  <PublishAot>true</PublishAot>
  <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup>

JSON serialization context:

csharp
[JsonSerializable(typeof(PackageMetadata))]
[JsonSerializable(typeof(IEnumerable<PackageMetadata>))]
public partial class McpJsonContext : JsonSerializerContext { }

Register in Program.cs:

csharp
builder.Services.AddMcpServer()
    .WithTools<PackageTools>(serializerOptions: McpJsonContext.Default.Options);

Critical: Add ALL tool return types to [JsonSerializable] attributes.

Tool Implementation

Minimal example:

csharp
[McpServerToolType]
public sealed class PackageTools
{
    public const string SearchPackages = "SearchPackages";
    
    [McpServerTool(Name = SearchPackages)]
    [Description("Search for NuGet packages by name or keyword")]
    public async Task<IEnumerable<PackageMetadata>> SearchAsync(
        [Description("The package name or search keyword")] string query,
        [Description("Maximum number of results (default: 10)")] int limit = 10,
        CancellationToken cancellationToken = default)
    {
        // Implementation
    }
}

Key patterns: Sealed classes, const tool names, [Description] on method and parameters, always accept CancellationToken.

Transport Configuration

SSE (HTTP):

csharp
builder.Logging.AddConsole(options => options.LogToStandardErrorThreshold = LogLevel.Trace);
builder.Services.AddMcpServer().WithHttpTransport().WithTools<PackageTools>(...);
app.MapMcp();  // Exposes /sse

Stdio (CLI):

csharp
builder.Services.AddMcpServer().WithStdioTransport().WithTools<PackageTools>(...);
// No MapMcp() needed

Testing and Error Handling

📖 See references:

Common Mistakes

MistakeFix
Forgot [JsonSerializable] for return typeAdd all tool return types to JsonSerializerContext
Not logging to stderrSet LogToStandardErrorThreshold = LogLevel.Trace
Missing CancellationTokenAlways add CancellationToken parameter
Throwing exceptions in toolsReturn ToolResult<T> with structured errors
Magic strings for tool namesUse const string in tool class
No [Description] on parametersAdd [Description] to all parameters
Forgetting MapMcp()Required for HTTP/SSE transport

References

© SebastienDegodez, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/creating-dotnet-mcp-servers of SebastienDegodez/copilot-instructions.

  • SKILL.md
  • references/advanced.md
  • references/error-handling.md
  • references/testing.md

Open the folder on GitHubat commit 0f0dccf

Compare with similar skills

Creating Dotnet MCP Servers next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Creating Dotnet MCP Servers compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Creating Dotnet MCP Servers this skillSebastienDegodez/copilot-instructions198—~1.3kAutomated safety check: PassApache-2.0
MCP Csharpatherio-danp/cde-dotnetcc109—~1.2kAutomated safety check: NotesNone
Csharp MCP Server GeneratorILoveDotNet/ilovedotnet155—~560Automated safety check: PassCC0-1.0
Dotnet MCP Builderboshi-xixixi/TraeSkill276—~1.7kAutomated safety check: PassMIT
Dotnet MCP Buildergithub/awesome-copilot40k—~2.1kAutomated safety check: PassMIT
Microsoft Docsmicrosoft/ai-agents-for-beginners77k—~1.5kAutomated safety check: PassMIT

Similar skills

  • MCP Csharp

    atherio-danp/cde-dotnetcc

    Create, debug, test, and publish MCP (Model Context Protocol) servers in C using the official ModelContextProtocol SDK — tools/prompts/resources, stdio vs HTTP transport, MapMcp hosting.

    109 GitHub stars~1.2k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check: notes
  • Csharp MCP Server Generator

    ILoveDotNet/ilovedotnet

    Generate a complete MCP server project in C with tools, prompts, and proper configuration

    155 GitHub stars~560 tokensUpdated 4 days ago
    Agent WorkflowsAuto-check passed
  • Dotnet MCP Builder

    boshi-xixixi/TraeSkill

    Build Model Context Protocol (MCP) servers in C/.NET against the current ModelContextProtocol 1.x NuGet packages.

    276 GitHub stars~1.7k tokensUpdated 5 mo ago
    Agent WorkflowsAuto-check passed
  • Dotnet MCP Builder

    github/awesome-copilot

    Official

    Build Model Context Protocol (MCP) servers in C/.NET against the current ModelContextProtocol 2.x NuGet packages.

    40k GitHub stars~2.1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Microsoft Docs

    microsoft/ai-agents-for-beginners

    Official

    Küsib ametlikku Microsofti dokumentatsiooni, et leida mõisteid, juhendeid ja koodinäiteid Azure'i, .NET-i, Agent Frameworki, Aspire'i, VS Code'i, GitHubi ja muu kohta.

    77k GitHub stars~1.5k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Copilot SDK

    intellectronica/agent-skills

    This skill helps with GitHub Copilot SDK work across Node.js/TypeScript, Python, Go, .NET, and Java.

    295 GitHub stars~3.2k tokensUpdated 5 mo ago
    Agent WorkflowsAuto-check passed

More from SebastienDegodez/copilot-instructions

All 19 skills in this repo
  • Setup Husky Dotnet

    SebastienDegodez/copilot-instructions

    A skill your agent uses when configuring Git hooks in .NET projects before team commits occur, to enforce commit message standards and code formatting automatically

    198 GitHub stars~1.3k tokensUpdated 3 days ago
    Auto-check passed
  • Clean Architecture Dotnet

    SebastienDegodez/copilot-instructions

    A skill your agent uses when domain logic leaks into API/Infrastructure, project references violate layer boundaries, or you need to decide between CQS (always), CQRS bus (complex domains), and DDD…

    198 GitHub stars~5.1k tokensUpdated 3 days ago
    Auto-check passed
  • Outside In TDD

    SebastienDegodez/copilot-instructions

    A skill your agent uses when writing tests from the outside-in, defining behavior before code, or any feature where tests should start from observable business behavior and let internal design emerge

    198 GitHub stars~1.8k tokensUpdated 3 days ago
    Auto-check passed
  • Generate Microcks Openapi Samples

    SebastienDegodez/copilot-instructions

    A skill your agent uses when creating OpenAPI mock examples for Microcks, setting up request/response routing with dispatchers, or mapping request fields to mock responses

    198 GitHub stars~2.5k tokensUpdated 3 days ago
    Auto-check passed
  • Analyzing Code

    SebastienDegodez/copilot-instructions

    A skill your agent uses when understanding project composition by language, measuring code change impact, or generating code statistics for CI/CD metrics

    198 GitHub stars~1k tokensUpdated 3 days ago
    Auto-check passed
  • Extracting Code Structure

    SebastienDegodez/copilot-instructions

    A skill your agent uses when listing all methods, functions, or classes in a file, exploring unfamiliar code, getting API overviews, or deciding what to read selectively without loading entire files

    198 GitHub stars~1.3k tokensUpdated 3 days ago
    Auto-check passed

Categories

Questions about Creating Dotnet MCP Servers

What does Creating Dotnet MCP Servers do?

A skill your agent uses when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints. Creating Dotnet MCP Servers is an agent skill from SebastienDegodez/copilot-instructions.

When should I use Creating Dotnet MCP Servers?

Creating Dotnet MCP Servers fits situations like: building Model Context Protocol (MCP) servers in .NET; configuring tools; transports (SSE/stdio); JSON serialization for AOT.

How do I install Creating Dotnet MCP Servers in Claude Code?

Run `npx skills add SebastienDegodez/copilot-instructions --skill creating-dotnet-mcp-servers -a claude-code`. Or copy the skill folder (skills/creating-dotnet-mcp-servers in SebastienDegodez/copilot-instructions) into .claude/skills/creating-dotnet-mcp-servers in your project. Claude Code loads it when a task matches its description.

How do I install Creating Dotnet MCP Servers in Codex?

Run `npx skills add SebastienDegodez/copilot-instructions --skill creating-dotnet-mcp-servers -a codex`. Or copy the skill folder (skills/creating-dotnet-mcp-servers in SebastienDegodez/copilot-instructions) into .agents/skills/creating-dotnet-mcp-servers in your project. Codex loads it when a task matches its description.

Can I use Creating Dotnet MCP Servers in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add SebastienDegodez/copilot-instructions --skill creating-dotnet-mcp-servers -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/creating-dotnet-mcp-servers, .gemini/skills/creating-dotnet-mcp-servers, .github/skills/creating-dotnet-mcp-servers and .opencode/skills/creating-dotnet-mcp-servers in your project.

What does Creating Dotnet MCP Servers need to run?

Going by SKILL.md and its folder, Creating Dotnet MCP Servers needs the command-line tools its instructions call (dotnet).

Does Creating Dotnet MCP Servers access the network?

SKILL.md names 2 domains. As links in the text: modelcontextprotocol.io and nuget.org. This is read from the text; nothing was executed.

Is Creating Dotnet MCP Servers safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Creating Dotnet MCP Servers use?

Creating Dotnet MCP Servers is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Creating Dotnet MCP Servers use?

About 1.3k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 9.6k tokens, read only when the agent opens those files.

What are the alternatives to Creating Dotnet MCP Servers?

Skills that share tags, products or a category with Creating Dotnet MCP Servers: MCP Csharp (atherio-danp/cde-dotnetcc, 109 stars), Csharp MCP Server Generator (ILoveDotNet/ilovedotnet, 155 stars), Dotnet MCP Builder (boshi-xixixi/TraeSkill, 276 stars) and Dotnet MCP Builder (github/awesome-copilot, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Creating Dotnet MCP Servers?

SebastienDegodez (a GitHub user) maintains it in SebastienDegodez/copilot-instructions, which has 198 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 6, 2026.

Source: SebastienDegodez/copilot-instructions on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.