Chapter 16

MCP — The USB-C of AI Tools

Every builder hits this wall eventually.

You connect your AI assistant to Slack. That takes a week. Then you connect it to your database. Another week. Then GitHub. Then Notion. Then Google Drive. Each integration is a custom job — different authentication, different data formats, different error handling, different everything.

Now multiply that by the number of AI tools your team uses. Claude Code needs access to the database. Cursor needs it too. ChatGPT needs Slack history. Gemini needs your Figma files. Each AI tool × each data source = one custom integration. If you have 5 AI tools and 8 data sources, that's 40 custom integrations to build and maintain.

This is the N×M problem, and it's the reason most "AI-powered workflows" are actually just one AI tool connected to one data source, with everything else done manually.

This chapter is about the solution — a protocol that turned 40 custom integrations into 13 standard ones.

The N×M Integration Problem

Analogy

Before USB-C, your desk looked like a bowl of spaghetti. Your phone used Lightning. Your laptop used USB-A. Your monitor used DisplayPort. Your headphones used a 3.5mm jack. Your external drive used USB-B. Every device needed its own specific cable to connect to every other specific device. If you had 6 devices and 4 computers, you needed a drawer full of different cables and adapters. Then USB-C arrived: one connector standard that every device could adopt. Suddenly, one cable could charge your phone, connect your monitor, transfer files to your drive, and link your headphones. The N×M spaghetti became N+M — each device needed one port, and any cable worked with any device.

In the AI tools world before 2024, the spaghetti was getting worse, not better. Here's what the integration landscape looked like:

THE N×M PROBLEM (Before MCP)
═══════════════════════════════════════════════════════════════

AI TOOLS                           DATA SOURCES
┌─────────────┐                    ┌─────────────┐
│ Claude Code  │──────────────────→│  PostgreSQL  │
│             │──────────────┐     └─────────────┘
└─────────────┘              │     ┌─────────────┐
┌─────────────┐              └────→│   GitHub     │
│  Cursor     │──────────────────→│             │
│             │──────────┐         └─────────────┘
└─────────────┘          │         ┌─────────────┐
┌─────────────┐          └────────→│   Slack      │
│  ChatGPT    │──────────────────→│             │
│             │──────┐             └─────────────┘
└─────────────┘      │             ┌─────────────┐
┌─────────────┐      └────────────→│   Notion     │
│  Gemini     │──────────────────→│             │
│             │──┐                 └─────────────┘
└─────────────┘  │                 ┌─────────────┐
                 └────────────────→│   Figma      │
                                   └─────────────┘

Every line = a custom integration
5 tools × 5 sources = 25 integrations to build and maintain

Each of those lines represents:

  • A custom authentication flow (OAuth for Slack, SSH keys for GitHub, connection strings for PostgreSQL)
  • A custom data format (Slack messages are JSON with nested blocks, GitHub uses GraphQL, PostgreSQL returns rows and columns)
  • Custom error handling (rate limits, timeouts, permissions)
  • Custom documentation to write and maintain
  • Custom security reviews

When OpenAI added "plugins" to ChatGPT in 2023, they tried to solve this with a plugin standard. It didn't stick — the standard was too specific to ChatGPT, too limited in what it could express, and other AI tools had no reason to adopt it. The N×M problem remained.

Enter MCP: One Standard Connector

In November 2024, Anthropic released the Model Context Protocol (MCP) — an open standard that defines how AI tools connect to external data sources and capabilities. The announcement was quiet. A blog post, a specification document, a few open-source reference implementations. No launch event. No marketing campaign.

Within 16 months, MCP became the universal standard for AI tool integration.

Real-Life Example

By March 2026, the MCP ecosystem has grown to over 10,000 servers (the components that expose data sources), with more than 6,400 listed in the official MCP registry. The SDK (Software Development Kit — the library developers use to build MCP components) has been downloaded over 97 million times per month. That's not hype. That's infrastructure adoption at the scale of npm packages and Python libraries.

Here's what the same integration landscape looks like with MCP:

THE N+M SOLUTION (With MCP)
═══════════════════════════════════════════════════════════════

AI TOOLS (Clients)         MCP Protocol         MCP SERVERS
┌─────────────┐                                ┌──────────────┐
│ Claude Code  │─────┐                    ┌───→│ PostgreSQL   │
└─────────────┘      │                    │    │ MCP Server   │
┌─────────────┐      │    ┌──────────┐    │    └──────────────┘
│  Cursor     │──────┼───→│   MCP    │────┤    ┌──────────────┐
└─────────────┘      │    │ Protocol │    ├───→│ GitHub       │
┌─────────────┐      │    │ (JSON-   │    │    │ MCP Server   │
│  ChatGPT    │──────┤    │  RPC)    │    │    └──────────────┘
└─────────────┘      │    └──────────┘    │    ┌──────────────┐
┌─────────────┐      │                    ├───→│ Slack        │
│  Gemini     │──────┘                    │    │ MCP Server   │
└─────────────┘                           │    └──────────────┘
                                          │    ┌──────────────┐
                                          ├───→│ Notion       │
                                          │    │ MCP Server   │
                                          │    └──────────────┘
                                          │    ┌──────────────┐
                                          └───→│ Figma        │
                                               │ MCP Server   │
                                               └──────────────┘

5 client implementations + 5 server implementations = 10 total
Instead of 25 custom integrations

Each AI tool implements the MCP client protocol once. Each data source implements the MCP server protocol once. Any client can talk to any server. The 25 custom integrations collapse to 10 standard implementations. Scale this to 50 AI tools and 200 data sources: 10,000 custom integrations become 250 standard ones.

That's the power of a shared protocol.

How MCP Works: The Architecture

MCP follows a client-server architecture with three layers. The specification lives at modelcontextprotocol.io, and it's worth reading — it's one of the clearest protocol specifications in the industry.

The Three Layers

MCP ARCHITECTURE
═══════════════════════════════════════════════════════════════

┌─────────────────────────────────────────────────────────────┐
│                        HOST APPLICATION                       │
│  (Claude Code, Cursor, ChatGPT, your custom app)            │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐   │
│  │                     MCP CLIENT                        │   │
│  │  - Discovers available servers                        │   │
│  │  - Sends requests (JSON-RPC 2.0)                     │   │
│  │  - Receives responses                                 │   │
│  │  - Manages server lifecycle                           │   │
│  └────────────────────┬─────────────────────────────────┘   │
│                       │                                      │
└───────────────────────┼──────────────────────────────────────┘
                        │
            ┌───────────┴───────────┐
            │    TRANSPORT LAYER     │
            │  - stdio (local)       │
            │  - HTTP + SSE (remote) │
            │  - Streamable HTTP     │
            └───────────┬───────────┘
                        │
┌───────────────────────┼──────────────────────────────────────┐
│                       │                                      │
│  ┌────────────────────┴─────────────────────────────────┐   │
│  │                     MCP SERVER                        │   │
│  │                                                       │   │
│  │  Exposes three types of capabilities:                 │   │
│  │                                                       │   │
│  │  ┌─────────┐  ┌────────────┐  ┌──────────────────┐  │   │
│  │  │  TOOLS  │  │ RESOURCES  │  │    PROMPTS       │  │   │
│  │  │         │  │            │  │                   │  │   │
│  │  │ Actions │  │ Data the   │  │ Reusable prompt  │  │   │
│  │  │ the AI  │  │ AI can     │  │ templates for    │  │   │
│  │  │ can     │  │ read       │  │ common tasks     │  │   │
│  │  │ perform │  │            │  │                   │  │   │
│  │  └─────────┘  └────────────┘  └──────────────────┘  │   │
│  └──────────────────────────────────────────────────────┘   │
│                        MCP SERVER                            │
│  (runs locally or remotely, close to the data source)       │
└──────────────────────────────────────────────────────────────┘

Layer 1: The Host Application — This is the AI tool the user interacts with. Claude Code, Cursor, ChatGPT, or a custom application you build. The host contains an MCP client that knows how to speak the protocol.

Layer 2: The Transport — How messages travel between client and server. MCP supports three transport mechanisms:

  • stdio — Standard input/output. The client spawns the server as a child process on the same machine. Messages pass through the process's stdin and stdout. This is how most local MCP servers work — fast, secure, no network involved.
  • HTTP + SSE (Server-Sent Events) — For remote servers. The client sends requests via HTTP POST and receives streaming responses via SSE. This enables MCP servers hosted in the cloud.
  • Streamable HTTP — A newer transport added in the 2025 spec revision, combining request-response and streaming into a single HTTP-based mechanism.

Layer 3: The MCP Server — The component that sits close to a data source and exposes it through three types of capabilities:

  1. Tools — Actions the AI can perform. "Run this SQL query." "Create a GitHub issue." "Send a Slack message." "Take a screenshot of this webpage." Tools are the most commonly used capability. When you see Claude Code running a database query or taking a browser screenshot, it's calling an MCP tool.

  2. Resources — Data the AI can read. "Here's the contents of this file." "Here's the schema of this database." "Here's the list of channels in this Slack workspace." Resources are like read-only data feeds. They let the AI understand what's available before deciding what to do.

  3. Prompts — Reusable prompt templates. "Here's a template for generating a code review." "Here's a template for summarizing a Slack thread." Prompts are the least-used capability but enable servers to ship domain-specific interaction patterns.

The Protocol: JSON-RPC Under the Hood

MCP uses JSON-RPC 2.0 (a standard for calling remote functions using JSON-formatted messages) as its wire format. A request to list available tools looks like this:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

The server responds:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "query_database",
        "description": "Execute a read-only SQL query against the PostgreSQL database",
        "inputSchema": {
          "type": "object",
          "properties": {
            "sql": {
              "type": "string",
              "description": "The SQL query to execute"
            }
          },
          "required": ["sql"]
        }
      }
    ]
  }
}

When the AI wants to call a tool, the client sends:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "query_database",
    "arguments": {
      "sql": "SELECT COUNT(*) FROM users WHERE created_at > '2026-01-01'"
    }
  }
}
Why This Exists

The protocol is deliberately minimal. It defines how to discover capabilities, how to call them, and how to return results. It does not define what capabilities should exist or how they should behave. This separation of concerns is what makes MCP universal — the protocol is the grammar, not the vocabulary. Each server brings its own vocabulary.

The Lifecycle: Discovery, Initialization, Operation

When an MCP client connects to a server, a handshake happens:

  1. Initialize — The client and server exchange capabilities. "I support tools/list and tools/call." "I expose 3 tools and 2 resources."
  2. Discover — The client asks the server what it offers. The server responds with names, descriptions, and input schemas for its tools, resources, and prompts.
  3. Operate — The AI model sees the available tools in its context. When it decides to use one, the client sends the request to the appropriate server. The server executes the action and returns results.
  4. Shutdown — The client sends a shutdown signal, and the server cleans up.

This lifecycle means MCP servers are dynamic — they can be started, discovered, used, and stopped as needed. You can add a new server to Claude Code by editing a JSON config file. The next time you start a conversation, Claude Code discovers the new server's capabilities automatically.

The Ecosystem: March 2026

The adoption curve of MCP has been remarkable. Here are the numbers:

MetricValue (March 2026)
Total MCP servers in the wild10,000+
Servers in the official registry6,400+
Monthly SDK downloads97M+
Major AI tools with MCP support6+

Who Adopted MCP

The list of AI tools that support MCP as a client reads like a who's-who of the industry:

  • Claude Code (Anthropic) — MCP was designed here. Claude Code can connect to any MCP server, and many of its built-in capabilities (browser automation, code execution) are implemented as MCP servers internally.
  • ChatGPT (OpenAI) — Added MCP client support in early 2025, replacing the earlier "plugins" system.
  • Cursor (Anysphere) — The AI-native code editor was an early adopter. MCP lets Cursor users connect to databases, documentation sites, and internal tools without custom plugins.
  • Gemini (Google DeepMind) — Added MCP support as part of its developer tooling integration.
  • Microsoft Copilot — Integrated MCP across its developer tools, including Visual Studio and the broader Copilot ecosystem.
  • Visual Studio Code — GitHub Copilot in VS Code gained MCP server support, letting developers expose custom tools to Copilot.
Real-Life Example

The fact that OpenAI adopted MCP — a protocol created by their primary competitor — tells you everything about how strong the ecosystem pull was. When developers started building MCP servers instead of ChatGPT plugins, OpenAI had a choice: create a competing standard (and split the ecosystem) or adopt MCP (and benefit from 6,400+ existing servers). They chose adoption. Anthropic, recognizing that a protocol owned by one company would always face trust issues, donated MCP's governance to the Agentic AI Foundation — a new entity under the Linux Foundation, co-founded by Anthropic, Block (Square's parent company), and OpenAI. This governance move was critical: it signaled that MCP was a public standard, not a competitive weapon.

What You Can Connect

The MCP registry at March 2026 includes servers for:

Databases: PostgreSQL, MySQL, SQLite, MongoDB, Redis, Supabase, PlanetScale, Neon Code & DevOps: GitHub, GitLab, Linear, Jira, Sentry, Docker, Kubernetes Communication: Slack, Discord, Microsoft Teams, Email (IMAP/SMTP) Documents & Knowledge: Notion, Confluence, Google Docs, Google Drive, Obsidian, Roam Design: Figma, Canva Cloud: AWS, Google Cloud, Cloudflare, Vercel, Netlify Browsers: Playwright (browser automation), Puppeteer, Chrome DevTools Protocol Files: Local filesystem, S3, Google Cloud Storage Search: Brave Search, Google Search, Exa, Tavily Analytics: PostHog, Mixpanel, Amplitude Payments: Stripe Custom APIs: Any REST or GraphQL API can be wrapped in an MCP server

This list grows weekly. The low barrier to building a server (which we'll cover next) means that whenever a developer wants their AI tool to talk to a new service, they build an MCP server and publish it.

Building an MCP Server: It's Easier Than You Think

One of MCP's design strengths is the low barrier to creating a server. The official SDKs exist for TypeScript, Python, Java, Kotlin, C#, Swift, and Go. A functional MCP server that exposes a tool can be built in under 100 lines of code.

Here's a Python MCP server that exposes a single tool — querying a SQLite database:

# sqlite_server.py
from mcp.server.fastmcp import FastMCP
import sqlite3
 
# Create the MCP server
mcp = FastMCP("SQLite Explorer")
 
# Define a tool that queries a SQLite database
@mcp.tool()
def query_database(sql: str, database_path: str = "app.db") -> str:
    """Execute a read-only SQL query against a SQLite database.
 
    Args:
        sql: The SQL query to execute (SELECT only)
        database_path: Path to the SQLite database file
    """
    if not sql.strip().upper().startswith("SELECT"):
        return "Error: Only SELECT queries are allowed for safety"
 
    conn = sqlite3.connect(database_path)
    conn.row_factory = sqlite3.Row
    try:
        cursor = conn.execute(sql)
        rows = cursor.fetchall()
        if not rows:
            return "Query returned no results"
 
        # Format as readable table
        columns = rows[0].keys()
        result = " | ".join(columns) + "\n"
        result += "-" * len(result) + "\n"
        for row in rows:
            result += " | ".join(str(row[col]) for col in columns) + "\n"
        return result
    except Exception as e:
        return f"Query error: {e}"
    finally:
        conn.close()
 
# Define a resource that shows the database schema
@mcp.resource("schema://database")
def get_schema() -> str:
    """Returns the complete schema of the SQLite database"""
    conn = sqlite3.connect("app.db")
    cursor = conn.execute(
        "SELECT sql FROM sqlite_master WHERE type='table'"
    )
    schemas = [row[0] for row in cursor.fetchall() if row[0]]
    conn.close()
    return "\n\n".join(schemas)
 
if __name__ == "__main__":
    mcp.run()

That's it. A working MCP server in 45 lines. The FastMCP helper (part of the official Python SDK) handles the JSON-RPC protocol, transport negotiation, and lifecycle management. You focus on the logic.

To connect this to Claude Code, you add it to the MCP configuration file:

{
  "mcpServers": {
    "sqlite": {
      "command": "python",
      "args": ["sqlite_server.py"],
      "cwd": "/path/to/your/project"
    }
  }
}

Next time Claude Code starts, it discovers the SQLite server, sees the query_database tool and schema://database resource, and can use them in conversation. You can ask Claude Code: "Show me the top 10 users by activity in my database" — and it will call query_database with the appropriate SQL.

The TypeScript Version

For Node.js developers, the pattern is similar:

// sqlite-server.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import Database from "better-sqlite3";
import { z } from "zod";
 
const server = new McpServer({
  name: "SQLite Explorer",
  version: "1.0.0",
});
 
server.tool(
  "query_database",
  "Execute a read-only SQL query against the SQLite database",
  {
    sql: z.string().describe("The SQL query to execute (SELECT only)"),
  },
  async ({ sql }) => {
    if (!sql.trim().toUpperCase().startsWith("SELECT")) {
      return {
        content: [{ type: "text", text: "Error: Only SELECT queries allowed" }],
      };
    }
 
    const db = new Database("app.db", { readonly: true });
    try {
      const rows = db.prepare(sql).all();
      return {
        content: [{ type: "text", text: JSON.stringify(rows, null, 2) }],
      };
    } catch (e) {
      return {
        content: [{ type: "text", text: `Query error: ${e}` }],
      };
    } finally {
      db.close();
    }
  }
);
 
const transport = new StdioServerTransport();
await server.connect(transport);

Notice how both versions share the same structure: create a server, define tools with names and descriptions and input schemas, and connect a transport. The SDK abstracts the protocol. You write the business logic.

Why This Exists

The simplicity of MCP server creation is a design choice, not an accident. The MCP team studied why previous standards (like ChatGPT plugins, or older standards like CORBA) failed to gain adoption. The answer was always the same: too much boilerplate, too many concepts to learn, too much ceremony before you could ship something useful. MCP's SDK was designed to make "Hello World" take 15 minutes and a production server take a day.

Real-World MCP in Action

Anthropic's Code Execution via MCP

When Claude Code runs your Python script or executes a shell command, it's using MCP internally. The code execution capability isn't hardcoded into Claude — it's exposed through an MCP server that provides tools like bash (execute a shell command), read_file (read a file from disk), and write_file (write content to a file).

This architecture means Anthropic can update Claude's tool capabilities without changing the model itself. Adding browser automation meant adding a Playwright MCP server. Adding file search meant adding a glob/grep MCP server. The model's intelligence stays separate from the tools it can use — a clean separation that makes both easier to improve independently.

Cloudflare Browser Rendering MCP

Cloudflare built an MCP server for their Browser Rendering service that runs headless Chrome instances in the cloud. Any MCP client can connect to it and get capabilities like:

  • take_screenshot — Render a webpage and return a screenshot
  • extract_text — Get the text content of a webpage
  • run_javascript — Execute JavaScript in a browser context
  • fill_form — Fill out and submit web forms

This means a Claude Code session can browse the web, take screenshots of your staging environment, fill out forms to test workflows, and extract data from websites — all through standardized MCP tools, no custom integration needed.

The Playwright MCP Server

Perhaps the most widely used community MCP server is the Playwright integration. Playwright is Microsoft's browser automation library. The MCP server wraps it to give any AI tool the ability to:

  • Navigate to URLs
  • Click elements, fill forms, type text
  • Take screenshots and snapshots (accessibility tree representations)
  • Handle dialogs, upload files
  • Inspect network requests and console messages

This server ships with Claude Code and is one of the reasons AI-assisted testing and debugging has become practical. When you tell Claude Code "go to my staging site and test the login flow," it's using the Playwright MCP server to drive a real browser.

The Governance Story: From Corporate Project to Public Standard

MCP's governance journey is instructive for anyone building in the AI ecosystem.

Phase 1: Corporate Open Source (November 2024 - Mid 2025) — Anthropic released MCP as an open-source project under the MIT license. Anyone could use it, but Anthropic controlled the spec. Adoption was fast among developers but slow among competing companies. Why would OpenAI or Google adopt a protocol governed by Anthropic?

Phase 2: Foundation Donation (Late 2025) — Anthropic donated MCP's governance to the newly created Agentic AI Foundation, housed within the Linux Foundation. The foundation was co-founded by Anthropic, Block (the fintech company behind Square and Cash App), and OpenAI. This was the turning point. With governance shared among competitors and managed by a neutral body (the Linux Foundation has decades of experience with multi-stakeholder open standards like Linux, Kubernetes, and Node.js), the trust barrier dissolved.

Phase 3: Industry Standard (2026) — With neutral governance, adoption accelerated. Google added MCP support to Gemini. Microsoft integrated it into Copilot and Visual Studio. The registry grew from hundreds to thousands of servers. SDK downloads crossed 97 million per month.

Real-Life Example

The Linux Foundation governance model works because it's been battle-tested. Linux itself is governed this way — contributed to by Google, Microsoft, Meta, Red Hat, and dozens of other companies that compete fiercely in the market but cooperate on shared infrastructure. MCP followed the same path: compete on AI capabilities, cooperate on AI connectivity.

Security Considerations

MCP servers have access to your data. A database MCP server can read your entire database. A filesystem MCP server can read your files. This power demands care.

The permission model: MCP clients are designed to ask for user approval before calling tools. When Claude Code wants to execute a database query through an MCP server, it shows you the query and waits for your approval. You can approve individual calls, approve all calls to a specific tool, or approve all calls to a specific server.

Local vs. remote servers: Local MCP servers (running via stdio on your machine) have the same permissions as the user running them. This is no different from running a script yourself. Remote MCP servers (running via HTTP) require authentication — typically OAuth 2.0 or API keys. The MCP spec includes a standard authentication flow for remote servers.

What to watch for:

  1. Overly permissive servers — A server that exposes DELETE FROM users as a tool with no confirmation is dangerous. Well-designed servers restrict operations (read-only queries, for example) and validate inputs.
  2. Data exfiltration — A malicious MCP server could send your data to an external service. Only use servers from trusted sources, and prefer local servers for sensitive data.
  3. Prompt injection via tools — If an MCP server returns data that includes instructions like "ignore previous instructions and...", the AI model might follow those injected instructions. This is an active research area in AI safety with no complete solution yet.

Comparison: MCP vs. Alternatives

MCP isn't the only approach to AI tool integration. Here's how it compares:

FeatureMCPOpenAI Function CallingLangChain ToolsCustom REST APIs
Standard across AI toolsYesOpenAI onlyLangChain onlyNo
Discovery (auto-detect capabilities)YesNoPartialNo
Streaming responsesYesYesVariesVaries
GovernanceLinux FoundationOpenAIOpen sourceN/A
Server ecosystem10,000+N/AHundredsN/A
Implementation effortLow (SDK)MediumMediumHigh
Works with any AI modelYesNoPartialYes

The key differentiator is universality. Function calling is a model capability (the AI knows how to format tool calls), but each AI provider has their own format. MCP is a protocol that works across all providers. LangChain provides a tool abstraction within its framework, but it's tied to LangChain. MCP works with any client that implements the protocol.

What MCP Means for Product Builders

If you're building AI-powered products, MCP changes your integration strategy:

Before MCP: You built custom integrations for each data source, each one a maintenance burden. Adding a new data source meant weeks of engineering work.

After MCP: You implement MCP client support once, and your product can connect to any MCP server. Want to add Notion integration? Point your client at the Notion MCP server. Database access? PostgreSQL MCP server. Browser automation? Playwright MCP server. Each integration takes minutes to configure, not weeks to build.

For platform companies: If you run a platform (a project management tool, a CRM, an analytics product), building an MCP server means every AI tool can integrate with your product. You write one MCP server, and Claude Code, Cursor, ChatGPT, and every other MCP client can use it. This is a distribution advantage — your product becomes accessible through every AI assistant.

For AI product companies: Implementing MCP client support means your users can connect to any data source without waiting for you to build the integration. This accelerates your time-to-value dramatically.

Why This Exists

MCP is following the same adoption curve as APIs did in the 2010s. First, a few pioneering companies (Stripe, Twilio, SendGrid) built great APIs and proved the model. Then API-first became table stakes — every SaaS product needed an API. MCP-first is heading the same direction. By 2027, shipping a software product without an MCP server will feel like shipping without an API in 2020 — technically possible but strategically foolish.

Exercise: Connect Claude Code to a Database via MCP

Goal: Set up a local MCP server that lets Claude Code query a SQLite database.

Prerequisites: Python 3.10+, Claude Code installed.

Step 1: Install the MCP Python SDK:

pip install mcp[cli]

Step 2: Create a sample database:

# setup_db.py
import sqlite3
 
conn = sqlite3.connect("products.db")
conn.execute("""
    CREATE TABLE IF NOT EXISTS products (
        id INTEGER PRIMARY KEY,
        name TEXT NOT NULL,
        category TEXT NOT NULL,
        price REAL NOT NULL,
        stock INTEGER NOT NULL
    )
""")
 
products = [
    ("Wireless Earbuds", "Electronics", 2499.00, 150),
    ("Cotton T-Shirt", "Apparel", 599.00, 500),
    ("Python Cookbook", "Books", 3200.00, 75),
    ("Standing Desk", "Furniture", 18999.00, 20),
    ("Mechanical Keyboard", "Electronics", 7500.00, 85),
    ("Running Shoes", "Sports", 4999.00, 200),
    ("LED Monitor 27-inch", "Electronics", 15999.00, 45),
    ("Yoga Mat", "Sports", 999.00, 300),
]
 
conn.executemany(
    "INSERT INTO products (name, category, price, stock) VALUES (?, ?, ?, ?)",
    products
)
conn.commit()
conn.close()
print("Database created with 8 products")

Step 3: Create the MCP server (use the sqlite_server.py code from earlier in this chapter).

Step 4: Add the server to your Claude Code MCP config. Create or edit .claude/mcp.json in your project directory:

{
  "mcpServers": {
    "products-db": {
      "command": "python",
      "args": ["sqlite_server.py"],
      "cwd": "/path/to/your/project"
    }
  }
}

Step 5: Start Claude Code in your project directory and try these prompts:

  • "What products do we have in stock?"
  • "Which category has the highest average price?"
  • "Show me all electronics sorted by price"
  • "What's our total inventory value?"

What to observe:

  • Claude Code discovers the query_database tool automatically
  • It formulates SQL queries based on your natural language questions
  • It asks for your approval before executing each query
  • It interprets the results in natural language

Stretch goal: Add a list_tables tool that returns all table names, and a describe_table tool that returns column names and types for a given table. This helps the AI understand the database structure before writing queries.

Looking Ahead

MCP solved the connectivity problem — how AI tools talk to data sources. But connectivity is the foundation, not the ceiling. The protocol is evolving in several directions:

Authentication standardization: The current spec supports OAuth 2.0 and API keys, but the community is working on standardized authentication flows that make remote MCP servers as easy to connect as local ones.

Agent-to-agent communication: As AI agents become more autonomous (covered in Chapter 15), they'll need to communicate with each other. MCP's architecture — discover capabilities, call them, get results — maps naturally to agent-to-agent coordination.

Marketplace dynamics: The MCP registry is becoming a marketplace. Server authors can publish servers that thousands of AI tools can use. This creates a new category of developer tooling — and a new opportunity for platform companies.

The USB-C of AI tools is plugged in and charging. The question for builders isn't whether to adopt MCP — it's how fast they can build their MCP strategy.

Chapter endnotes

  1. Anthropic. "Introducing the Model Context Protocol." Anthropic Blog, November 2024. https://www.anthropic.com/news/model-context-protocol
  2. Model Context Protocol Specification. https://modelcontextprotocol.io
  3. MCP SDK GitHub Repository. https://github.com/modelcontextprotocol
  4. Anthropic. "MCP Governance and the Agentic AI Foundation." Anthropic Blog, 2025.
  5. Cloudflare. "Browser Rendering MCP Server." Cloudflare Developer Docs, 2025.
  6. The adoption numbers (10,000+ servers, 6,400+ registry, 97M+ monthly downloads) are sourced from the MCP ecosystem dashboard and Anthropic's public reporting as of March 2026.
  7. Playwright MCP Server. https://github.com/modelcontextprotocol/servers/tree/main/src/playwright