Model Context Protocol: The JSON-RPC Spec Trying to Standardize How AI Apps Talk to Data
Hook
While everyone obsesses over which LLM is smartest, MCP quietly solves a harder problem: how do you let Claude, ChatGPT, and future AI apps all speak the same language to your databases, filesystems, and APIs without writing N×M integrations?
Context
Every AI application faces the same integration nightmare. You build a chatbot that needs access to your company's documentation, customer database, and internal APIs. So you write custom code to fetch docs, query Postgres, and call REST endpoints. Then you want to add GitHub integration. More custom code. Then Slack. Then Google Drive. Each integration is bespoke, tightly coupled to your application logic, and completely unusable by the next team building a similar AI tool.
This is the context injection problem, and it's burning thousands of engineering hours across the AI ecosystem. Model Context Protocol emerged from Anthropic's work on Claude Desktop, where they needed a standardized way for AI applications (clients) to request context from external sources (servers) without reimplementing connection logic for every possible data source. Rather than building yet another framework, they built a protocol specification—a contract that any language can implement, defining exactly how AI apps should request resources, invoke tools, and access templated prompts from context providers.
Technical Insight
MCP's architecture revolves around a stateful JSON-RPC 2.0 session with a clever capability negotiation handshake. When a client connects to a server, they exchange initialization messages declaring what features they support. The server announces whether it provides resources (file-like data), prompts (conversation templates), or tools (executable functions). The client responds with its capabilities, including crucially whether it supports sampling—the ability to invoke LLMs on behalf of the server.
Here's what a basic initialization flow looks like:
// Client sends initialization request
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {
"sampling": {}, // Client can handle LLM requests from server
"roots": {
"listChanged": true // Client supports root list notifications
}
},
"clientInfo": {
"name": "ExampleClient",
"version": "1.0.0"
}
}
}
// Server responds with its capabilities
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2024-11-05",
"capabilities": {
"resources": {}, // Server provides resources
"tools": {}, // Server provides tools
"prompts": {} // Server provides prompts
},
"serverInfo": {
"name": "DatabaseMCPServer",
"version": "0.1.0"
}
}
}
This negotiation is crucial because it allows servers to evolve independently of clients. A server can add resource subscriptions without breaking older clients that don't understand them—the client simply won't advertise support, and the server won't send subscription notifications.
The most architecturally interesting decision is the sampling inversion. Traditional AI architectures assume the application has direct access to the LLM. But MCP assumes servers are sandboxed processes with no network access, no API keys, and no direct model access. Instead, servers can request that the client perform LLM sampling on their behalf:
// Server requests LLM completion from client
{
"jsonrpc": "2.0",
"id": 42,
"method": "sampling/createMessage",
"params": {
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "Analyze this log file and extract error patterns"
}
}
],
"maxTokens": 1000,
"systemPrompt": "You are a log analysis expert."
}
}
This enables agentic workflows where a tool can recursively invoke AI reasoning without the server needing credentials or implementing retry logic. The client handles model selection, rate limiting, and token counting—the server just gets back a completion. It's an elegant separation of concerns that keeps servers simple while enabling sophisticated multi-step reasoning.
The protocol's resource model treats everything as URI-addressable content with MIME types. A filesystem server might expose file:///path/to/doc.md, while a database server exposes postgres://localhost/customers/schema. Clients don't need to understand the URI scheme—they just call resources/read with the URI and get back typed content:
// Client requests resource
{
"method": "resources/read",
"params": {
"uri": "postgres://localhost/public/users"
}
}
// Server returns content with MIME type
{
"result": {
"contents": [
{
"uri": "postgres://localhost/public/users",
"mimeType": "application/json",
"text": "{\"schema\": {...}, \"rowCount\": 1524}"
}
]
}
}
The spec's progress notification system deserves attention. Long-running operations can stream progress updates without blocking the request/response cycle by returning a progress token and sending separate notifications:
// Initial response with progress token
{
"result": {
"_meta": {
"progressToken": "index-build-42"
}
}
}
// Separate progress notifications
{
"method": "notifications/progress",
"params": {
"progressToken": "index-build-42",
"progress": 45,
"total": 100
}
}
This is critical for context retrieval from slow sources like vector databases or API-rate-limited services, allowing UIs to show progress bars without polling.
Perhaps most importantly, the TypeScript schema IS the specification. There's no separate documentation that can drift out of sync. The schema/ directory contains TypeScript types that compile to JSON Schema, and implementations in other languages are expected to validate against these schemas. This protocol-first approach forces precision—you can't hand-wave details when the contract is machine-readable code.
Gotcha
MCP's biggest weakness is its complete lack of authentication and authorization primitives. The spec says nothing about how clients verify server identity, how servers authenticate clients, or how permissions work. Every implementation must invent its own security model, which guarantees fragmentation. If you're building a production system where a compromised MCP server could access sensitive data, you're on your own for designing token exchange, capability-based security, or audit logging.
The transport abstraction sounds great in theory but creates interop chaos in practice. The spec mentions stdio, SSE, and custom transports but doesn't specify connection lifecycle, reconnection backoff, or error recovery semantics. What happens if an stdio pipe breaks mid-request? How should SSE clients handle reconnection with in-flight operations? Different implementations will make different choices, and you'll discover incompatibilities only at runtime. The resource URI scheme flexibility is similarly problematic—without a registry of standard schemes and their semantics, you can't write generic tooling that works across arbitrary MCP servers. Finally, tool execution lacks streaming response support, forcing tools to buffer entire outputs. If your tool generates a 50MB dataset or streams results from a database cursor, you're forced into memory-intensive buffering rather than incremental delivery.
Verdict
Use if: You're building in the Anthropic ecosystem or creating an AI application that needs to integrate with 5+ different context sources (databases, filesystems, APIs, documentation systems). The protocol's value scales with integration count—at ten data sources, MCP saves you from maintaining a rats' nest of custom adapters. Also use it if you're betting on cross-vendor protocol adoption and want to build servers that work with multiple AI applications without reimplementation. Skip if: You need production-grade security (no auth story yet), high-throughput streaming (request/response model can't stream), or you're integrating just one or two context sources where purpose-built client libraries are simpler and more battle-tested. Also skip if you can't tolerate protocol immaturity—early adopters will spend time working around underspecified transport behavior and missing observability hooks. This is infrastructure for context-augmented AI's future, but today it's best suited for experimentation and internal tooling where you control both clients and servers.