Model Context Protocol (MCP) for .NET

Model Context Protocol (MCP) is an open JSON-RPC protocol that standardizes how language model clients discover and invoke tools hosted by external servers. Introduced in late 2024 and revised through 2025 (the current revision is 2025-11-25), MCP solves a concrete problem: tool discovery and capability negotiation across a heterogeneous set of LLM clients and servers.

The protocol is not magic. It is JSON-RPC with conventions on top, and those conventions matter most when you have many tools, many clients, or both.

What MCP Covers

MCP defines three server-side primitives: resources (data the model can read), prompts (templated workflows), and tools (functions the model can call). The current spec version is 2025-11-25. Transports are either stdio (process-local) or Streamable HTTP.

The official C# SDK (ModelContextProtocol, ModelContextProtocol.AspNetCore) is maintained in collaboration with Microsoft. The ASP.NET Core transport package requires .NET 8 or later; the core packages also target .NET Standard 2.0.

Production Concerns

Running an MCP server in production introduces the same distributed-systems challenges as any public API, plus a set of LLM-specific attack surfaces: prompt injection through tool outputs, tool description poisoning, and aggressive fan-out from model clients. Articles in this section address these concerns directly.

Building an MCP Server in .NET Without Buying the Hype

Building an MCP Server in .NET Without Buying the Hype

MCP is JSON-RPC with conventions, not magic. This guide builds a Model Context Protocol server in .NET with the official SDK: stdio and Streamable HTTP transports, tightly-scoped typed tools, JWT authentication, prompt-injection defenses, OpenTelemetry tracing, and the production failure modes the demos never mention.