Back to all articles
ai automationModel Context Protocol

MCP Architecture Explained: Tools, Resources, Prompts and Boundaries

Model Context Protocol (MCP) standardizes how AI applications connect to external data sources and tools. This guide deconstructs the JSON-RPC client-server primitives, transport layers (stdio and SSE), and security boundaries of MCP.

August 20, 2026
12-14 min read
Digital Elliptical Engineering (Principal Systems Architect)
mcp_json_rpc_inspector.exe
MCP CLIENT (HOST)
AI Application / IDEOriginates JSON-RPC requests over stdio/SSE
JSON-RPC 2.0 WIREstdio / SSE
> REQ:
{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "query_db", "arguments": {"query": "SELECT * FROM users"}}, "id": 1}
< RES:
{"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": "20 rows returned"}]}, "id": 1}
latency: 2.1ms
MCP SERVER
Tool & Resource ProviderExposes tools, resources, and prompt templates
Server Capability:TOOLS

Executive Summary

  • MCP standardizes LLM-to-tool communication using open JSON-RPC 2.0 primitives.
  • The protocol defines three core capabilities: Tools (executable actions), Resources (readable data), and Prompts (reusable templates).
  • Transports operate over standard input/output (stdio) for local tools or Server-Sent Events (SSE) for remote servers.
  • Clean protocol separation isolates host applications from third-party tool implementation details.
  • Security boundaries require client-side confirmation gates before executing mutating tools.

Why the ecosystem needed the Model Context Protocol

Before the Model Context Protocol (MCP) emerged, connecting language models to external tools was an engineering mess. Every AI framework (LangChain, LlamaIndex, AutoGen, custom scripts) invented its own ad-hoc tool definition format.

If a developer built a Postgres query tool for Claude, they had to rewrite it completely to work with OpenAI, and rewrite it again to integrate into an IDE extension. This fragmentation created massive integration debt across the software industry.

MCP solves this by establishing an open, standardized client-server protocol. An MCP server exposes tools, data resources, and prompt templates once; any MCP-compliant client (whether an IDE, desktop assistant, or cloud agent) can connect to it seamlessly over standard JSON-RPC.

The USB-C of AI interfaces

MCP does for AI tool connectivity what USB-C did for hardware peripherals: standardizes the physical and protocol interface so any host can connect to any device without custom adapters.

The three core MCP primitives: Tools, Resources, Prompts

The MCP specification is built around three foundational server capabilities:

1. Tools: Functions that an LLM can invoke to perform computation or execute side effects (e.g. `execute_sql`, `git_commit`). Tools take structured parameters defined by JSON Schema and return structured content blocks.

2. Resources: Read-only data sources that can be attached to context (e.g. `file:///var/log/app.log`, `postgres://db/users/schema`). Resources are identified by URIs and support dynamic subscription notifications when data changes.

3. Prompts: Parameterized prompt templates exposed by the server (e.g. `analyze_codebase_diff`), allowing domain experts to curate optimal reasoning scaffolding directly alongside the data source.

The three MCP protocol primitives compared

FeaturePrimitivePrimary PurposeMutation RiskInvocation Model
ToolsExecute code, query APIs, modify dataHigh (Requires permission checks)Model-driven tool calling (`tools/call`)
ResourcesProvide static or streaming context dataZero (Read-only observation)Application/User attached (`resources/read`)
PromptsProvide structured reasoning workflowsZero (Template generation)User/Workflow initiated (`prompts/get`)

JSON-RPC 2.0 wire format & protocol framing

MCP uses standard JSON-RPC 2.0 for all message exchanges. Every interaction consists of a structured Request object and a corresponding Response object.

When an MCP client connects, it issues an `initialize` request to negotiate capabilities (such as tools, resources, and logging). Once initialized, the client can query available tools using `tools/list` and execute specific functions using `tools/call`.

Because JSON-RPC is text-based and language-agnostic, MCP servers can be implemented in Python, TypeScript, Go, Rust, or C++ with zero framework lock-in.

mcp_protocol_wire.json
JSON-RPC 2.0 Protocol Frame
// 1. Client requests tool execution { "jsonrpc": "2.0", "id": 42, "method": "tools/call", "params": { "name": "calculate_risk_score", "arguments": { "transactionAmount": 15000, "userCountry": "US" } } } // 2. Server returns structured observation { "jsonrpc": "2.0", "id": 42, "result": { "content": [ { "type": "text", "text": "Risk Score: 0.82 (High Risk: Requires Step-up Auth)" } ], "isError": false } }

TypeScript MCP server implementation pattern

The code below demonstrates a production-grade MCP server implemented using the official TypeScript SDK.

DatabaseMcpServer.ts
TypeScript MCP Server
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; import { z } from "zod"; const server = new Server({ name: "db-mcp-server", version: "1.0.0" }, { capabilities: { tools: {} } }); // 1. Expose tool catalog server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [{ name: "query_database", description: "Execute read-only SQL queries against the replica database", inputSchema: { type: "object", properties: { sql: { type: "string" } }, required: ["sql"] } }] })); // 2. Handle tool execution server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name === "query_database") { const { sql } = request.params.arguments as { sql: string }; const rows = await executeQuerySafely(sql); return { content: [{ type: "text", text: JSON.stringify(rows) }] }; } throw new Error("Tool not found"); }); const transport = new StdioServerTransport(); await server.connect(transport);

Transport architectures: stdio vs Server-Sent Events (SSE)

MCP supports two primary transport mechanisms depending on the deployment topology:

1. Standard I/O (stdio): Used when the MCP server runs as a local child process spawned by the client (e.g. an IDE running a local git or file tool). stdio provides zero-latency IPC with zero network exposure.

2. Server-Sent Events (SSE) over HTTP: Used when the MCP server runs on a remote server or in a shared Kubernetes cluster. The client sends JSON-RPC requests via HTTP POST and receives streaming responses via an open SSE connection.

Security boundaries and client-side confirmation gates

Because MCP tools can execute arbitrary code or query internal databases, security is paramount. The MCP architecture enforces strict separation of concerns.

The MCP server is responsible for parameter schema validation and execution isolation (e.g. running queries against read-only replicas).

The MCP client (the host application) is responsible for user authorization and confirmation gates. If a tool is flagged as mutating (e.g. `delete_branch`), the client must display an explicit confirmation dialog to the human operator before dispatching the JSON-RPC request.

MCP server development checklist

Verify these architectural and security requirements before deploying MCP servers.

MCP server deployment checklist

1Protocol & Typing
  • Server exposes standard JSON-RPC 2.0 capabilities during initialize
  • Tool parameters are rigorously typed using standard JSON Schema
  • Tool descriptions provide clear natural language context for LLM selection
2Transport & Performance
  • stdio transport is used for local zero-latency developer tooling
  • SSE transport implements proper connection keep-alives and reconnection
  • Large resource payloads support streaming and pagination
3Security & Permissions
  • Mutating tools require explicit human approval gates in the client UI
  • SQL tools execute against unprivileged, read-only database replicas
  • Outbound network egress is restricted to whitelisted API endpoints
Decision path

Build and deploy production-grade MCP servers

Connecting AI models to internal databases via ad-hoc scripts is unmaintainable. We will help you architect standardized, secure Model Context Protocol servers.

Schedule an MCP architecture session

Keep Reading