AI SummaryPurpose: Make agents instantly productive. Follow ONLY patterns proven in this repo; don’t invent abstractions. 1. Copy structure from an existing sample; reference . 2. Implement with same pattern (parse settings -> add services -> ).
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to add the "mcp-dotnet-samples — Copilot Instructions" prompt rules to my project. Repository: https://github.com/microsoft/mcp-dotnet-samples Please read the repo to find the rules/prompt file, then: 1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type) 2. If there's an existing rules file, merge the new rules in rather than overwriting 3. Confirm what was added
Description
A comprehensive set of samples of creating and using MCP servers and clients with .NET
Adding / Modifying Tools
• Create public class or method with [McpServerTool] (and [Description] for method + parameters). Return lightweight DTO / primitives; let host format. • For prompts use [McpServerPrompt]. No manual DI registration unless you need extra services—then add via builder.Services before BuildApp.
Copilot Instructions (Concise) – MCP .NET Samples
Purpose: Make agents instantly productive. Follow ONLY patterns proven in this repo; don’t invent abstractions.
Architecture & Runtime
• Mono-repo of independent Hybrid MCP servers: awesome-copilot/, markdown-to-html/, todo-list/, outlook-email/ + shared lib shared/McpSamples.Shared/. • Hybrid pattern: same Program.cs can run STDIO (default) or stateless HTTP when -- http (or env UseHttp=true). Selection via AppSettings.UseStreamableHttp(...); final wiring through BuildApp(useStreamableHttp). • Discovery: Tools / Prompts / Resources auto-registered by assembly scan (With*FromAssembly). New public attributed types in the entry assembly just work—avoid manual registration. • HTTP mode: single POST /mcp; some samples add dual OpenAPI docs (swagger 2.0 + openapi 3.0) via McpDocumentTransformer<T>.
Sample-Specific Nuance
• awesome-copilot: Large metadata.json; reuse IMetadataService (don’t repeatedly load whole file). Tools: search & load instructions. • markdown-to-html: Extra switches -tc, -p, --tags only parsed AFTER -- delimiter. • todo-list: In‑memory SQLite kept alive by one singleton SqliteConnection; use EF Core set-based ops (ExecuteUpdateAsync/ExecuteDeleteAsync). • outlook-email: Supports auth parameters (--tenant-id/-t, --client-id/-c, --client-secret/-s) or user secrets; can also host via Azure Functions (see sample README). Only add auth handling inside this sample—do not leak to shared.
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
Works With
Any AI assistant that accepts custom rules or system prompts