Build or consume Model Context Protocol (MCP) servers and clients in .NET using the official MCP C# SDK, including stdio, Streamable HTTP, tools, prompts, resources, and capability negotiation. USE FOR: .NET MCP servers or clients; stdio versus HTTP transport choices; tools, resources, prompts, completions, and capability negotiation. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run rele
SkillScore96Maintained
Automatic
◆AI Engineer pack
Last verified 8/19/2026
What it changes
Passed 22 of 23 test cases with the skill, and 12 of 23 without it.
Without skill52%
With skill96%
Checks it passed that the model alone missed
The response identifies IdentityAssertionGrantProvider.
The tool method is marked with [McpServerTool] attribute.
The code configures HTTP transport using WithHttpTransport.
and 14 more in the full report
11 fixed11 passed either way0 still failing1 broke
Pass-rate lift
+43 pp
Tokens
+88%
Agent turns
0%
Response time
-52%
Model gemini-3.6-flashMeasured 8/19/2026v322 of 23 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 11 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 11
Prompt
When reconnecting a .NET client to a Streamable HTTP server that was temporarily disconnected, which method on the client class should be called to restore the existing session?
What was checked, without and with the skill
Checked
Without skill
With skill
The response specifies calling McpClient.ResumeSessionAsync.
Missed
Passed
case-14 · gemini-3.6-flash · 8/19/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md223 lines3 files
MCP C# SDK for .NET
Trigger On
building or consuming MCP servers from a .NET application or library
choosing between stdio and HTTP transport for MCP
exposing tools, resources, prompts, completions, or logging to an MCP host
connecting a .NET app to an existing MCP server and passing discovered tools into IChatClient
bootstrapping a minimal MCP client/server from the .NET AI quickstarts or publishing a server to the MCP Registry
implementing capability-aware flows such as roots, sampling, elicitation, subscriptions, session resumption, or enterprise managed authorization
Use This Skill Instead Of
Use mcp when protocol interoperability is the requirement.
Use microsoft-extensions-ai when you only need model/provider abstraction or local tool orchestration without the MCP wire protocol.
Use microsoft-agent-framework when the main problem is agent orchestration; combine it with mcp only when those agents must consume or expose MCP endpoints.
Use the .NET AI quickstarts for the very first vertical slice, then come back here to harden transport, capability negotiation, publishing, and host interoperability.
Test C# MCP servers at multiple levels: unit tests for individual tools and integration tests using the MCP client SDK. USE FOR: unit testing MCP tool methods, integration testing with in-memory MCP client/server, end-to-end testing via MCP protocol, testing HTTP MCP servers with WebApplicationFactory, mocking dependencies in tool tests, creating evaluations for MCP servers, writing eval questions, measuring tool quality. DO NOT USE FOR: testing MCP clients (this is server testing only), load or