creating-dotnet-mcp-servers

creating-dotnet-mcp-servers is a skill for Claude Code, Codex from SebastienDegodez/copilot-instructions. It costs 43 tokens per session (1,209 once invoked), scanned A, original, Apache-2.0.

A guide for building Model Context Protocol servers in .NET. MCP is a standard way for an application to expose tools that an AI agent can call.

In plain words
What is it for?
Use it when creating or testing a .NET MCP server, configuring SSE or standard-input/output connections, or setting up JSON serialization for AOT builds.
Why use it?
It provides the project-specific patterns needed to register tools, connect them over supported transports, and prepare .NET servers for ahead-of-time compilation.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating or testing a .NET MCP server, configuring SSE or standard-input/output connections, or setting up JSON serialization for AOT builds.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add SebastienDegodez/copilot-instructions --skill creating-dotnet-mcp-servers
Clone the repo
git clone --depth 1 https://github.com/SebastienDegodez/copilot-instructions

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for creating-dotnet-mcp-servers

README.md
[![agentmods](https://agentmods.dev/badge/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers/github.svg)](https://agentmods.dev/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers)
Your own site
<a href="https://agentmods.dev/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers"><img src="https://agentmods.dev/badge/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for creating-dotnet-mcp-servers

Your own site · 80×15
<a href="https://agentmods.dev/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers"><img src="https://agentmods.dev/badge/skills/sebastiendegodez/copilot-instructions/creating-dotnet-mcp-servers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,209 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.01209
Opus 5 $0.00022 $0.00605
Sonnet 5 $0.00009 $0.00242
Haiku 4.5 $0.00004 $0.00121

Measured 10d ago against content hash cb7e3780c38f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

creating-dotnet-mcp-servers scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/creating-dotnet-mcp-servers/SKILL.md · 145 lines

How it starts

The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

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

Task Implementation
Install packages dotnet add package ModelContextProtocol + ModelContextProtocol.AspNetCore
Mark tool class [McpServerToolType]
Mark tool method [McpServerTool(Name = "ToolName"), Description("...")]
Parameter description [Description("param description")] string param
Register server services.AddMcpServer().WithHttpTransport().WithTools<T>()
Map endpoints app.MapMcp() (exposes /sse)
AOT serialization Create JsonSerializerContext with [JsonSerializable]
Test transport Use SseClientTransport + McpClientFactory

Basic Setup

1. Install Packages

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:

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

JSON serialization context:

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

Read the full file on GitHub · 145 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 145 lines · 43 tokens per session scan A cb7e3780c38f

Subscribe to this mod's changes

creating-dotnet-mcp-servers is a skill published in the GitHub repository SebastienDegodez/copilot-instructions (193 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 43 tokens to every session and 1,209 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

migrate-mstest-v3-to-v4

Use this skill before answering, planning, or editing any MSTest 3.x-to-4.x upgrade or post-upgrade failure. Triggers include "MSTest v4 breaking changes"; CS0507/CS0103/CS1061/CS1615; ExecuteAsync, CallerInfo, DisplayName, or custom TestMethodAttribute; ClassCleanupBehavior; ContainsKey; ThrowsExactly or…

managedcode/dotnet-skills · 179 tokens

migrate-xunit-to-mstest

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…

managedcode/dotnet-skills · 141 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

semantic-kernel

Build AI-enabled .NET applications with Semantic Kernel using services, plugins, prompts, and function-calling patterns that remain testable and maintainable. USE FOR: adding AI-driven prompts, plugins, or orchestration to a .NET app; reviewing kernel construction, service registration, or plugin usage; building…

managedcode/dotnet-skills · 116 tokens

wpf

Build and modernize WPF applications on .NET with correct XAML, data binding, commands, threading, styling, and Windows desktop migration decisions. USE FOR: working on WPF UI, MVVM, binding, commands, or desktop modernization; migrating WPF from .NET Framework to .NET; integrating newer Windows capabilities into a…

managedcode/dotnet-skills · 122 tokens

worker-services

Build long-running .NET background services with BackgroundService, Generic Host, graceful shutdown, configuration, logging, and deployment patterns suited to workers and daemons. USE FOR: background services; scheduled workers; hosted services; worker extraction; graceful shutdown, health checks, and service hosting…

managedcode/dotnet-skills · 109 tokens