Official MCP C# SDK
Official C# SDK for Model Context Protocol servers and clients, maintained by the MCP project in collaboration with Microsoft, with NuGet packages for core MCP APIs, hosting and dependency injection extensions, ASP.NET Core HTTP servers, samples, API documentation, and cross-application access support.
Open the source and read safety notes before installing.
Safety notes
- The official C# SDK is a protocol library; production risk comes from the MCP tools, resources, prompts, transports, and identity flows you implement with it.
- Treat every MCP tool handler as an API endpoint: validate arguments, enforce permissions, bound side effects, and sanitize errors.
- HTTP MCP servers need normal web-service controls, including authentication, TLS, request limits, logging policy, and abuse protections.
- Cross-application access and identity assertion flows are security-sensitive and should be tested against the current MCP specification and enterprise policy.
Privacy notes
- MCP clients and servers built with the SDK may expose tool arguments, tool results, resource contents, prompt templates, user identity assertions, errors, traces, and logs.
- Avoid leaking private resources, customer data, internal identifiers, tokens, privileged paths, or operational metadata in schemas, responses, examples, and logs.
- Document which MCP client, server, model provider, transport, and logging system can observe each request before production use.
Prerequisites
- .NET project compatible with the SDK package targets and your chosen MCP transport.
- A package choice: `ModelContextProtocol.Core`, `ModelContextProtocol`, or `ModelContextProtocol.AspNetCore`.
- Authentication, authorization, and transport-security requirements for any HTTP-accessible MCP server.
- Reviewed tool, resource, prompt, and identity-flow behavior before deploying beyond local development.
Schema details
- Install type
- cli
- Troubleshooting
- No
- Scope
- Source repo
- Estimated setup
- 15 minutes
- Difficulty
- intermediate
- Pricing
- free
- Disclosure
- editorial
- Application category
- DeveloperApplication
- Operating system
- Cross-platform
Full copyable content
dotnet add package ModelContextProtocolAbout this resource
Overview
The official MCP C# SDK is the Model Context Protocol project's .NET
implementation for building MCP clients and servers. The repository is
maintained under the modelcontextprotocol organization in collaboration with
Microsoft and publishes NuGet packages for core protocol APIs, hosting and
dependency injection extensions, and ASP.NET Core HTTP server integrations.
This entry covers the official SDK. It is distinct from community MCP libraries and from individual MCP servers that happen to be written in C#.
Package Options
| Package | Best Fit |
|---|---|
ModelContextProtocol.Core |
Client or low-level server APIs with fewer dependencies |
ModelContextProtocol |
Main package for most client, stdio server, hosting, and dependency injection usage |
ModelContextProtocol.AspNetCore |
HTTP-based MCP servers on ASP.NET Core |
Quick Start
Install the main package:
dotnet add package ModelContextProtocol
For an HTTP MCP server, install the ASP.NET Core package instead:
dotnet add package ModelContextProtocol.AspNetCore
The upstream documentation includes conceptual getting-started material, package-selection guidance, samples, and generated API documentation for the current package surface.
MCP Fit
Choose the official C# SDK when a .NET application, worker service, ASP.NET Core app, internal platform, or enterprise integration needs first-party MCP protocol types and package guidance. It is especially relevant for teams that already standardize on .NET hosting, dependency injection, NuGet packaging, and ASP.NET Core operations.
Because the SDK provides protocol building blocks, safe production behavior still depends on the application you build around it. Treat MCP tools as model-callable APIs and resources as model-visible data surfaces.
Use Cases
- Add an MCP server to a .NET service, CLI, worker, or desktop integration.
- Build an MCP client in C# for testing or internal automation.
- Expose an HTTP-based MCP server with ASP.NET Core.
- Integrate MCP server registration with .NET hosting and dependency injection.
- Review sample MCP clients and servers before designing a production surface.
- Evaluate cross-application access and identity assertion support in .NET.
Source Review
Verified on 2026-06-18:
- The upstream README identifies
modelcontextprotocol/csharp-sdkas the official C# SDK for Model Context Protocol clients and servers. - The README states that the SDK is maintained in collaboration with Microsoft.
- The README documents the three main NuGet packages:
ModelContextProtocol.Core,ModelContextProtocol, andModelContextProtocol.AspNetCore. - NuGet resolves the
ModelContextProtocolpackage and lists current versions. - The documentation site resolves at
csharp.sdk.modelcontextprotocol.io. - The README and license file document Apache License 2.0 licensing for the project.
Safety and Privacy
The SDK does not decide which local files, services, identities, resources, or side effects your MCP server exposes. Keep schemas narrow, require authorization for sensitive actions, and avoid returning private data in error messages or debug logs.
HTTP and identity-enabled deployments should be reviewed like any other production API. Add authentication, transport security, request limits, audit logging, and clear retention rules before exposing a server outside localhost.
Duplicate Check
Checked current content/mcp/, content/tools/, content/skills/, open pull
requests, and repository-wide content for modelcontextprotocol/csharp-sdk,
official MCP C# SDK, Model Context Protocol C# SDK, ModelContextProtocol NuGet,
.NET MCP server SDK, ASP.NET Core MCP server, and MCP C# examples. No dedicated
official C# SDK entry, exact source URL duplicate, target file, or open
duplicate PR was found.
Source citations
Add this badge to your README
How it compares
Official MCP C# SDK side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Official MCP C# SDK Official C# SDK for Model Context Protocol servers and clients, maintained by the MCP project in collaboration with Microsoft, with NuGet packages for core MCP APIs, hosting and dependency injection extensions, ASP.NET Core HTTP servers, samples, API documentation, and cross-application access support. Open dossier | Official MCP Go SDK Official Go SDK for Model Context Protocol servers and clients, maintained by the MCP project in collaboration with Google, with packages for MCP, JSON-RPC, OAuth primitives, OAuth protected-resource metadata, clients, servers, transports, examples, and conformance work. Open dossier | Official MCP Java SDK Official Java SDK for Model Context Protocol clients and servers, maintained in collaboration with Spring AI, with Java 17+ support, Maven artifacts, synchronous and asynchronous APIs, Reactive Streams, Project Reactor, JDK HttpClient, Servlet transport, JSON binding modules, and conformance tests. Open dossier | Official MCP TypeScript SDK Official TypeScript SDK for Model Context Protocol clients and servers, with the production v1 `@modelcontextprotocol/sdk` package, active v2 server and client package work, Node.js, Bun, and Deno support, transports, OAuth helpers, tools, resources, prompts, examples, and API documentation. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Category | tools | tools | tools | tools |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | Model Context Protocol | Model Context Protocol | Model Context Protocol | Model Context Protocol |
| Added | 2026-06-18 | 2026-06-18 | 2026-06-18 | 2026-06-18 |
| Platforms | CLI | CLI | CLI | CLI |
| Source repo | — | — | — | — |
| Safety notes | ✓The official C# SDK is a protocol library; production risk comes from the MCP tools, resources, prompts, transports, and identity flows you implement with it. Treat every MCP tool handler as an API endpoint: validate arguments, enforce permissions, bound side effects, and sanitize errors. HTTP MCP servers need normal web-service controls, including authentication, TLS, request limits, logging policy, and abuse protections. Cross-application access and identity assertion flows are security-sensitive and should be tested against the current MCP specification and enterprise policy. | ✓The official Go SDK is a protocol library; the risk is in the MCP clients, servers, tools, resources, prompts, and transports you build with it. Validate inputs, enforce capability checks, and bound side effects for every tool handler. Use local transports for local-only integrations, and add authentication, TLS, authorization, logging, and rate limits before exposing network transports. OAuth and protected-resource metadata are security-sensitive surfaces; test them against the current MCP specification and client expectations. | ✓The official Java SDK is a protocol library; production risk comes from your MCP tools, resources, prompts, transports, authorization hooks, and framework integration. Validate tool inputs, enforce caller permissions, bound side effects, and avoid returning raw Java exceptions or internal stack details to MCP clients. Servlet, Spring, and remote transport deployments need authentication, TLS, request limits, observability policy, cancellation behavior, and abuse protection. Spring AI MCP security and annotation support may simplify integration, but application owners still need to review authorization, tenant boundaries, and data retention. | ✓The official TypeScript SDK is a protocol library; your MCP server's tool handlers, resources, prompts, transports, and auth logic determine the real risk. Treat every registered tool as a model-callable API endpoint and validate inputs, enforce permissions, bound side effects, and sanitize failures. HTTP and framework middleware deployments need host validation, authentication, TLS, request limits, logging policy, and abuse controls. The upstream main branch documents v2 pre-alpha work; use the production v1 package for stable deployments unless you intentionally accept alpha API churn. |
| Privacy notes | ✓MCP clients and servers built with the SDK may expose tool arguments, tool results, resource contents, prompt templates, user identity assertions, errors, traces, and logs. Avoid leaking private resources, customer data, internal identifiers, tokens, privileged paths, or operational metadata in schemas, responses, examples, and logs. Document which MCP client, server, model provider, transport, and logging system can observe each request before production use. | ✓MCP clients and servers built with the SDK may expose request metadata, tool arguments, tool results, resource contents, prompt templates, OAuth state, errors, traces, and logs. Do not leak private resource contents, customer data, internal identifiers, tokens, privileged paths, or operational metadata in schemas, error messages, examples, or logs. Document which model provider, client, server, and transport can observe each request before deploying outside localhost. | ✓Java MCP clients and servers may expose tool arguments, tool results, resource contents, prompt templates, request metadata, correlation IDs, logs, traces, and authorization context. Avoid leaking secrets, customer data, private resources, internal identifiers, stack traces, privileged paths, or token values through schemas, responses, errors, or logs. Document which MCP client, server process, Java framework, model provider, transport, and observability system can observe each request. | ✓MCP clients and servers built with the SDK may expose tool arguments, tool results, resource contents, prompt templates, OAuth state, errors, traces, and logs. Avoid returning secrets, private file contents, customer data, privileged paths, internal identifiers, or operational metadata through schemas, examples, errors, or logs. Document which MCP client, server, model provider, transport, middleware layer, and logging system can observe each request. |
| Prerequisites |
|
|
|
|
| Install | | | | |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.