Model Context Protocol (MCP): The USB-C Standard for AI Tool Integration
on Ai, Mcp, Llm, Agents, Protocol
Model Context Protocol (MCP): The USB-C Standard for AI Tool Integration
When Anthropic released the Model Context Protocol (MCP) in late 2024, it looked like another vendor-specific integration spec. By mid-2026, it’s become the de facto standard for connecting AI agents to tools, data sources, and services — adopted by OpenAI, Google DeepMind, and every major AI platform. Understanding MCP is now a prerequisite for anyone building production AI systems.
Photo by Lars Kienle on Unsplash
What MCP Solves
Before MCP, connecting an LLM to external tools was the wild west. Each AI framework had its own tool-calling convention:
- OpenAI:
toolsarray with JSON Schema function definitions - LangChain:
@tooldecorator with its own metadata format - LlamaIndex: yet another tool spec
- Custom agents: whatever the developer invented
The result: every tool had to be reimplemented for every framework. A database connector written for LangChain didn’t work in Claude. A file-reading tool for GPT-4 required rewriting for Gemini.
MCP’s insight: separate the tool server from the AI client. Tools speak MCP. Clients speak MCP. They connect over a standard protocol.
Architecture Overview
MCP has three main components:
┌─────────────────────────────────────────────┐
│ MCP Client │
│ (Claude, ChatGPT, Cursor, custom agent) │
└──────────────────┬──────────────────────────┘
│ JSON-RPC 2.0 over
│ stdio / SSE / WebSocket
┌──────────────────┴──────────────────────────┐
│ MCP Server │
│ Exposes: Tools / Resources / Prompts │
└──────────────────┬──────────────────────────┘
│
┌──────────┴──────────┐
│ External System │
│ (DB, API, Files, │
│ Browser, Shell) │
└─────────────────────┘
Core Primitives
Tools — Functions the AI can call:
{
"name": "query_database",
"description": "Execute a read-only SQL query against the production database",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string", "description": "SQL SELECT statement" }
},
"required": ["query"]
}
}
Resources — Data the AI can read (files, URLs, database records):
{
"uri": "file:///project/README.md",
"name": "Project README",
"mimeType": "text/markdown"
}
Prompts — Reusable prompt templates:
{
"name": "code-review",
"description": "Standard code review prompt with security focus",
"arguments": [
{ "name": "language", "required": true },
{ "name": "code", "required": true }
]
}
Building an MCP Server
Here’s a minimal MCP server in Python using the official SDK:
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent
import mcp.types as types
import httpx
app = Server("weather-server")
@app.list_tools()
async def list_tools() -> list[Tool]:
return [
Tool(
name="get_weather",
description="Get current weather for a city",
inputSchema={
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"},
"units": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"default": "celsius"
}
},
"required": ["city"]
}
)
]
@app.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
if name == "get_weather":
city = arguments["city"]
units = arguments.get("units", "celsius")
async with httpx.AsyncClient() as client:
resp = await client.get(
f"https://wttr.in/{city}",
params={"format": "j1"}
)
data = resp.json()
temp = data["current_condition"][0]["temp_C"]
if units == "fahrenheit":
temp = round(int(temp) * 9/5 + 32)
condition = data["current_condition"][0]["weatherDesc"][0]["value"]
return [TextContent(
type="text",
text=f"Weather in {city}: {condition}, {temp}°{'C' if units=='celsius' else 'F'}"
)]
raise ValueError(f"Unknown tool: {name}")
async def main():
async with stdio_server() as (read_stream, write_stream):
await app.run(read_stream, write_stream, app.create_initialization_options())
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Run it, and any MCP-compatible client (Claude Desktop, Cursor, your custom agent) can use your weather tool — without knowing anything about your implementation.
MCP in Production: Patterns and Anti-Patterns
Pattern 1: Database Read Gateway
Expose read-only SQL access through MCP. The AI gets query capabilities without direct database access:
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "query_analytics":
query = arguments["query"]
# Enforce read-only
if not query.strip().upper().startswith("SELECT"):
return [TextContent(type="text", text="Error: Only SELECT queries allowed")]
# Enforce row limit
if "LIMIT" not in query.upper():
query += " LIMIT 1000"
results = await db.fetch_all(query)
return [TextContent(type="text", text=format_as_table(results))]
Pattern 2: Multi-Server Composition
An AI agent can connect to multiple MCP servers simultaneously. Build specialized servers and compose them:
// Claude Desktop config
{
"mcpServers": {
"database": { "command": "python", "args": ["./mcp-db-server.py"] },
"github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] },
"slack": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-slack"] },
"filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"] }
}
}
Pattern 3: OAuth-Scoped Servers
MCP supports OAuth 2.0 for remote servers. Each user gets their own scoped access:
from mcp.server.auth import OAuthServerProvider
# Server validates OAuth tokens before serving tools
app = Server("github-server", auth_provider=OAuthServerProvider(
client_id="your-github-oauth-app-id",
scopes=["repo:read", "issues:write"]
))
❌ Anti-Pattern: Overly Broad Tools
# Bad — gives the AI too much power
Tool(name="execute_shell", description="Run any shell command")
# Better — scope precisely
Tool(name="run_tests", description="Run the test suite for a specific module")
Tool(name="lint_code", description="Run ESLint on a specific file")
❌ Anti-Pattern: No Input Validation
# Bad — trust the AI's inputs directly
results = await db.execute(arguments["query"])
# Better — validate and sanitize
query = arguments["query"]
if any(keyword in query.upper() for keyword in ["DROP", "DELETE", "INSERT", "UPDATE"]):
raise ValueError("Mutation queries not allowed")
The Ecosystem in 2026
The MCP ecosystem has exploded. Notable servers available today:
| Category | Notable Servers |
|---|---|
| Version Control | GitHub, GitLab, Bitbucket |
| Databases | PostgreSQL, MySQL, SQLite, MongoDB, Snowflake |
| Cloud | AWS, GCP, Azure (read-only resource inspection) |
| Communication | Slack, Linear, Jira, Notion |
| Dev Tools | Docker, Kubernetes kubectl, Terraform |
| Search | Brave Search, Exa, Perplexity |
| Files | Filesystem, Google Drive, Dropbox, S3 |
| Browser | Playwright, Puppeteer |
The MCP Registry lists 2,000+ community servers.
MCP vs Function Calling vs RAG
These aren’t mutually exclusive:
| Approach | Best For |
|---|---|
| MCP Tools | Structured actions: query DB, call API, manipulate files |
| Function Calling | Same idea — MCP tools are function calls, just standardized |
| RAG (Vector Search) | Unstructured knowledge retrieval at scale |
| MCP Resources | Structured data the AI can read (files, records) |
A production agent typically uses all three: MCP for tool actions, RAG for knowledge lookup, and native reasoning for synthesis.
Transport Options
MCP supports three transport mechanisms:
stdio (local) — Process communication, lowest latency, most common for local tools:
# Server launched as subprocess, communicates via stdin/stdout
SSE (Server-Sent Events) — For remote servers over HTTP, real-time streaming:
GET /sse HTTP/1.1
Host: mcp.yourtoolserver.com
Accept: text/event-stream
WebSocket — Bidirectional, for interactive tools (browser automation, etc.):
ws://mcp.yourtoolserver.com/ws
Getting Started
1. Install the SDK:
# Python
pip install mcp
# TypeScript
npm install @modelcontextprotocol/sdk
2. Browse community servers:
npx @modelcontextprotocol/inspector
3. Connect to Claude Desktop: Edit ~/Library/Application Support/Claude/claude_desktop_config.json
4. Inspect any MCP server:
npx @modelcontextprotocol/inspector python your-server.py
Conclusion
MCP is doing for AI tools what USB-C did for device connectors: ending the fragmentation. If you’re building an AI agent, tool, or integration today, implement MCP rather than a proprietary interface. You’ll get compatibility with the entire ecosystem for free.
The pattern is clear: tools speak MCP, clients speak MCP, and the AI industry moves faster together.
References:
- Model Context Protocol Specification
- MCP GitHub Organization
- Anthropic MCP announcement
- MCP Server Registry
이 글이 도움이 되셨다면 공감 및 광고 클릭을 부탁드립니다 :)
