← cd ../blog

Understanding MCP: The Protocol That Gives AI Assistants Superpowers

AI assistants are no longer confined to answering questions from their training data. With the Model Context Protocol (MCP), they can read your files, query databases, call APIs, and interact with the tools you already use — all in a standardized, secure way. This post breaks down what MCP is, how it works under the hood, and how you can start building with it today.

What is MCP?

Model Context Protocol (MCP) is an open standard introduced by Anthropic that defines how AI models communicate with external tools, data sources, and services. Think of it as a universal adapter — rather than every AI application reinventing the wheel for tool integrations, MCP provides a single, consistent interface.

Before MCP, connecting an LLM to external capabilities meant custom, bespoke integrations for every tool: a one-off plugin for GitHub, another for Slack, another for your database. MCP replaces all of that with a single protocol that any tool can implement once and any MCP-compatible AI can use.

The Core Problem MCP Solves

LLMs are powerful reasoning engines, but they are inherently isolated. A model trained on data up to a certain date cannot:

  • Know what’s in your codebase right now
  • Read emails or calendar events
  • Query live databases
  • Call internal APIs

The traditional fix was function calling — the model emits a structured JSON payload, and your application handles the side effects. That works, but it puts the integration burden entirely on the application developer. Every team builds the same glue code over and over.

MCP flips this model. Instead of the application wiring tools to the model, tools advertise themselves through a standard interface that any compliant AI client can discover and use.

How MCP Works: The Architecture

MCP follows a client–server architecture with three key roles:

┌─────────────┐       MCP Protocol        ┌─────────────┐
│  MCP Client │ ◄────────────────────────► │  MCP Server │
│ (AI / Host) │                            │   (Tool)    │
└─────────────┘                            └─────────────┘

MCP Hosts

The host is the AI application the user interacts with — Claude Desktop, Claude Code, an IDE plugin, or a custom application you build. The host manages one or more MCP client connections and decides which servers to connect to.

MCP Clients

Each client maintains a 1:1 connection to an MCP server. The client speaks the protocol, relays tool invocations from the model, and returns results. Clients are typically embedded in the host application.

MCP Servers

An MCP server is a lightweight process (local or remote) that exposes capabilities via the protocol. A server can offer any combination of:

  • Tools — functions the AI can call (e.g., search_files, run_query)
  • Resources — data the AI can read (e.g., file contents, database rows)
  • Prompts — reusable prompt templates the user or AI can invoke

The Transport Layer

MCP is transport-agnostic. The two most common transports are:

TransportUse Case
stdioLocal servers — the host spawns a child process and communicates over stdin/stdout
HTTP + SSERemote servers — standard HTTP with Server-Sent Events for streaming responses

This means you can run MCP servers locally for security-sensitive tools, or host them remotely for shared team access.

Primitives in Depth

Tools

Tools are the workhorse of MCP. They expose callable functions with a JSON Schema describing their inputs:

{
  "name": "search_codebase",
  "description": "Search for a pattern across all source files",
  "inputSchema": {
    "type": "object",
    "properties": {
      "pattern": {
        "type": "string",
        "description": "Regex or literal string to search for"
      },
      "path": {
        "type": "string",
        "description": "Directory to search in (default: project root)"
      }
    },
    "required": ["pattern"]
  }
}

When the AI decides to call a tool, it sends the tool name and arguments to the MCP client, which forwards the request to the server. The server executes the logic and returns a result — which the AI uses to continue reasoning.

Resources

Resources expose readable content — think of them like a virtual filesystem the AI can browse:

mcp://filesystem/src/components/Header.tsx
mcp://database/users/schema
mcp://github/repos/myorg/myrepo/issues

Resources are particularly useful for giving the AI access to large or structured data without cramming everything into the system prompt.

Prompts

Prompts are parameterized templates that encode common workflows. A “code review” prompt might pull in the diff, the relevant tests, and the team’s coding standards — all assembled automatically when invoked.

A Real-World Example: Filesystem MCP Server

Let’s look at what a minimal MCP server looks like in TypeScript using the official SDK:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { readFileSync, readdirSync } from "fs";

const server = new Server(
  { name: "filesystem", version: "1.0.0" },
  { capabilities: { tools: {}, resources: {} } }
);

// Expose a "list_files" tool
server.setRequestHandler("tools/call", async (request) => {
  if (request.params.name === "list_files") {
    const { directory } = request.params.arguments;
    const files = readdirSync(directory);
    return {
      content: [{ type: "text", text: files.join("\n") }],
    };
  }
});

// Start listening on stdio
const transport = new StdioServerTransport();
await server.connect(transport);

Point an MCP-compatible host at this server, and it can immediately ask the AI to list files, read contents, or perform any other operation you implement.

Security and Trust Model

MCP has a well-defined trust model:

  1. Servers don’t have direct access to the model — they only respond to requests from the client.
  2. Users grant consent — hosts must inform users what servers are connected and what capabilities they expose.
  3. Tool calls are auditable — every invocation passes through the client, giving hosts full visibility and control.
  4. Sandboxing is encouraged — sensitive servers (like filesystem access) should run locally, not be exposed over the internet.

This layered approach means you can give an AI access to powerful tools without handing over unchecked execution privileges.

Why MCP Matters for Developers

Ecosystem Reuse

Once a tool exposes an MCP server, it works with any MCP-compatible AI. You build the integration once; every compliant client benefits. The community is already building MCP servers for:

  • GitHub — search code, manage issues and PRs
  • PostgreSQL / SQLite — run queries, inspect schemas
  • Slack — read channels, send messages
  • Web browsers — navigate pages, extract content
  • Docker — manage containers and images

Composability

Multiple MCP servers can run simultaneously. An AI assistant can read your code from a filesystem server, check related issues via a GitHub server, and query your metrics database — all in a single conversation turn.

Separation of Concerns

MCP cleanly separates the AI’s reasoning from the tool’s implementation. You don’t need to modify the model or the host application to add a new capability — just ship a new server.

Getting Started

1. Install the SDK

npm install @modelcontextprotocol/sdk
# or
pip install mcp

2. Configure your MCP host

For Claude Desktop, add servers to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
    }
  }
}

3. Explore the official servers

Anthropic maintains a collection of reference servers at github.com/modelcontextprotocol/servers — a great starting point before writing your own.

What’s Next for MCP

MCP is still evolving. Areas to watch:

  • Authentication — standardized OAuth flows for remote servers
  • Streaming — long-running tools that stream partial results
  • Multi-agent — MCP as the communication layer between AI agents
  • Marketplace — discoverable, rated server registries

The protocol is fully open, and Anthropic has committed to developing it as a community standard — not a proprietary lock-in.

Conclusion

MCP is a fundamental shift in how AI systems interact with the world. By standardizing the interface between models and tools, it unlocks an ecosystem where integrations are built once and reused everywhere. Whether you’re building internal developer tools, data pipelines, or full AI-powered applications, MCP gives you a clean, secure, and composable foundation.

The age of isolated AI assistants is over. With MCP, your AI works with your stack, not alongside it.

$ echo "EOF"