What is MCP? A Complete Architectural Guide to the Model Context Protocol
Discover how the open-source Model Context Protocol standard is transforming AI-assisted software engineering by providing a universal, secure bridge between LLM agents and external technical infrastructure.
1. Executive Overview & The Interoperability Challenge
In the rapid evolution of agentic artificial intelligence, connecting Large Language Models (LLMs) to external data sources, developer tools, and operational environments has historically been an exercise in fragmentation. Developers were forced to build bespoke plugins, proprietary API wrappers, or fragile prompt-injection scripts for every distinct AI assistant and target service.
The Model Context Protocol (MCP), introduced by Anthropic as an open standard, resolves this systemic friction. Often described as the “USB-C for artificial intelligence,”MCP defines a universal, stateful JSON-RPC 2.0 communication protocol that standardizes how AI applications (“Hosts”) discover, query, and execute capabilities provided by local or remote service processes (“Servers”).
Today, major AI engineering platforms—including Claude Desktop, Cursor IDE, VS Code (via Cline and Roo Code), Zed Editor, and Windsurf—natively support Model Context Protocol connections. This allows developers to plug databases, GitHub repositories, cloud infrastructure, and internal microservices directly into their AI workflows in seconds.
2. The Three Architectural Entities of MCP
The MCP specification organizes interactions across three clearly delineated architectural components:
AI Client Host Application
The primary user-facing AI interface (such as Claude Desktop, Cursor IDE, or Zed) that runs the generative model, manages context windows, requests tool executions, and renders visual output to the developer.
MCP Protocol Client
The internal connection manager embedded within the Host. It maintains a 1-to-1 connection with each target MCP server, handles handshake negotiation, serializes JSON-RPC messages, and routes diagnostic telemetry.
MCP Tool Server
A lightweight process (running in Node.js, Python, Go, or Docker) that translates client RPC method calls into live REST requests, database queries, or operating system operations.
3. The Four Core Protocol Primitives
Unlike simple REST endpoints, MCP structures capability exposure around four fundamental primitives:
1. Tools (`tools/list`, `tools/call`)
Executable functions that allow the AI model to perform operations in external systems (e.g. creating a GitHub pull request, executing a SQL query, or submitting a Stripe refund). Each tool exposes a name, comprehensive description, and strict JSON Schema for parameter validation.
2. Resources (`resources/list`, `resources/read`)
Read-only context data exposed by the server. Resources behave like contextual file attachments—such as database schema dumps, live server application logs, or OpenAPI documentation—that the AI agent can inspect to inform reasoning.
3. Prompts (`prompts/list`, `prompts/get`)
Pre-engineered, parameterized prompt templates exposed by the server to guide the AI assistant through standardized multi-step workflows, such as conducting a code review or triaging an incident.
4. Logging (`notifications/message`)
Structured diagnostic streaming over `stderr`. Server processes emit debug, info, warn, and error telemetry directly back to the host client console without contaminating model prompt contexts.
4. Transport Mechanisms: stdio vs Server-Sent Events (SSE)
MCP supports two distinct transport protocols depending on the deployment topography:
| Dimension | Standard I/O (stdio) | Server-Sent Events (SSE) |
|---|---|---|
| Process Lifecycle | Spawned as child subprocess by host client | Runs independently as remote HTTP server |
| Network Transport | stdin / stdout streams | HTTP POST + SSE Stream |
| Security Boundary | 100% local workstation isolation | Requires TLS encryption & Bearer Auth |
| Primary Use Case | Local coding tools (Claude Desktop, Cursor) | Enterprise gateways & cloud microservices |
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "stripe_create_refund",
"arguments": {
"charge_id": "ch_3N8Qv2LkdIwHu7ix0Q4N2mO8",
"amount": 4900,
"reason": "requested_by_customer"
}
}
}5. Multi-Client Installation Matrix
Configuring MCP servers across developer environments involves adding standard JSON declarations to your client configuration files:
Claude Desktop Setup
claude_desktop_config.jsonmacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_TOKEN"
}
}
}
}Cursor IDE Setup
.cursor/mcp.jsonAdd to workspace root at .cursor/mcp.json or configure globally in Cursor Settings.
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
}
}
}6. MCP vs OpenAPI vs Function Calling
How does MCP relate to traditional developer specifications like OpenAPI? They are fundamentally complementary:
- OpenAPI (Swagger): Describes what an HTTP API endpoint expects (paths, parameters, response codes). It is a passive contract definition.
- Model Context Protocol (MCP): Describes how an AI assistant actively invokes operations, reads dynamic data resources, and handles error recovery in conversational loops.
- Automated Translation with MCP-Bridge: MCP-Bridge acts as the automated compiler that parses OpenAPI v3 JSON/YAML specs and transforms them directly into executable MCP server configurations.
7. Security Guidelines & Local Process Hardening
Executing external tools from LLM agents requires strict security precautions:
Security Architecture Principles
- Local Credential Injection: Pass secret API keys strictly via the
envdictionary in local config files. Never hardcode credentials in prompts or Git commits. - Least-Privilege Database Roles: When connecting database MCP servers, create dedicated read-only users (
GRANT SELECT ON ALL TABLES) to prevent accidental deletions. - Docker Sandboxing: For untrusted scripts, run MCP servers in isolated containers with
docker run -i --rm --read-only.
Getting Started with MCP Today
Ready to supercharge your AI coding assistant? Browse our curated directory of native MCP servers and OpenAPI configurations or convert your own OpenAPI specifications in one click: