Table of Contents
What is MCP?
Model Context Protocol (MCP) is a standardized protocol that defines how AI models interact with external tools, data sources, and services. Think of it as a USB-C port for AI — a universal interface that lets any AI model plug into any tool without custom integration code.
Before MCP, every AI integration was bespoke. Want GPT to query your database? Write a custom adapter. Want Claude to search your docs? Another custom adapter. MCP eliminates this by providing a structured, standardized communication layer.
The Problem MCP Solves
Traditional AI integrations suffer from three core problems:
1. Fragmentation — Every AI provider has its own function-calling format. OpenAI uses one schema, Anthropic another, Google yet another.
2. Tight Coupling — Tools built for one model can't be reused with another without significant rewrites.
3. No Discovery — AI models have no standard way to discover what tools are available or what they can do.
MCP Architecture
MCP follows a client-server architecture. The MCP Host (your AI application) connects to one or more MCP Servers. Each server exposes tools, resources, and prompts through a standardized JSON-RPC protocol.
The key components are:
- MCP Host: The application that embeds the AI model (e.g., Claude Desktop, your custom app) - MCP Client: A protocol client that maintains a 1:1 connection with an MCP server - MCP Server: A lightweight program that exposes tools, resources, and prompts - Transport Layer: Communication channel (stdio, HTTP+SSE, or WebSocket)
// Example MCP Server exposing a tool
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({ name: "my-tools", version: "1.0.0" });
// Register a tool
server.tool("get_weather", { city: z.string() }, async ({ city }) => {
const weather = await fetchWeather(city);
return { content: [{ type: "text", text: JSON.stringify(weather) }] };
});
// Connect via stdio
const transport = new StdioServerTransport();
await server.connect(transport);Real-World Use Cases
MCP is already transforming how production AI systems work:
- Database Querying: An MCP server exposes safe, read-only SQL access. The AI model can query your database without raw connection strings.
- Document Search: Expose your company's knowledge base as an MCP resource. The AI can search and cite specific documents.
- Code Execution: Sandbox code execution environments as MCP tools. The AI writes code, the server runs it safely.
- API Orchestration: Wrap your internal APIs as MCP tools. The AI can book meetings, create tickets, or send notifications through structured interfaces.
MCP vs Traditional Function Calling
While function calling lets AI models invoke predefined functions, MCP takes this further:
- Discovery: Models can discover available tools at runtime, not just at prompt time. - Standardization: One tool works with any MCP-compatible model. - Resources: Beyond tools, MCP supports resources (data the model can read) and prompts (pre-built prompt templates). - Security: Built-in permission model — the host controls which tools the model can access.
Key Takeaways
MCP standardizes AI-tool communication like HTTP standardized web communication
Client-server architecture with JSON-RPC protocol for interoperability
Supports tools, resources, and prompts — not just function calling
Already supported by Claude, with growing ecosystem adoption
Enables building AI applications that are model-agnostic from day one
Written by Surya Kanagaraj
Senior Fullstack Developer & AWS Cloud Engineer. Building production serverless apps on AWS. Available for freelancing.