MCP SDK for .NET 1
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- C# 14106 lines · 4.4K tokens
- MCP SDK for .NET 192 lines · 4.9K tokens
Total198 lines · 9.2K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 257
- 295
- 319
- 323
- 327
- 338
- 346
- 347
- 352
- 362
- 367
- 378
- 426
- 441
- 488
- 502
- 532
- 611
- 639
- 674
- 759
- 770
- 772
- 775
- 798
- 807
- 862
- 915
- 916
- 918
- 942
- 1333
- 1395
- 1427
Prompt Preview
Apply the C# 14 prompt first. These rules cover the MCP C# SDK 1 line: hosting, identity, sessions, tools, resources, experimental tasks, sampling, elicitation, and clients.
Version scope and capabilities
- Keep the
ModelContextProtocol,ModelContextProtocol.Core, andModelContextProtocol.AspNetCorepackages you use on the same release and move them together; do not mix 1.x and 2.x packages. The SDK fixes ordinary bugs only in the newest minor of its latest major and patches the newest minor of one previous major only for bugs its maintainers rate critical or blocking, so while you stay on 1.x, run the newest patch of its newest minor and plan the move to the current major. - Use a patched .NET 10 host with the C# 14 baseline. The packages also target
net8.0andnet9.0, whose runtime support ends on 2026-11-10; only Core and the hosting package additionally targetnetstandard2.0, without the other targets' AOT-compatibility declaration.ModelContextProtocol.AspNetCorerequires .NET 8 or later. - Check
NegotiatedProtocolVersionand peer capabilities before using optional features. Version 1.4.1 implements2024-11-05,2025-03-26,2025-06-18, and2025-11-25; do not assume 2.x continuation-state behavior or compatibility with the replacement Tasks extension. - Suppress
MCPEXP001for Tasks and Extensions, orMCPEXP002for SDK extensibility such asRunSessionHandler, only at reviewed call sites. These APIs can change even in patch releases; test their authorization, serialization, and cancellation behavior on upgrades.