← Topics

Model Context Protocol (MCP)

An open standard for connecting AI models to external tools and data sources through a unified, structured interface.

Definition

What Is Model Context Protocol (MCP)?

Model Context Protocol (MCP) is an open protocol developed by Anthropic that standardizes how AI models interact with external tools, data sources, and services. MCP defines a structured interface for tool definitions (name, description, input schema), resource access (files, databases, APIs), and prompt templates. Instead of each AI integration building custom tool-calling interfaces, MCP provides a common protocol that any AI client can use to discover and invoke tools from any MCP-compatible server.

Significance

Why It Matters

Before MCP, every AI tool integration was custom. Connecting an LLM to a database required building a specific integration. Connecting it to a different database required building another. MCP eliminates this N-to-M integration problem by providing a standard interface. Build an MCP server once, and any MCP-compatible AI client can use it. This dramatically reduces the integration effort for teams building AI-powered workflows.

Architecture

How It Works

MCP follows a client-server architecture:
┌──────────────────┐         ┌──────────────────┐
│   AI Application │         │   MCP Server     │
│   (MCP Client)   │◄───────►│   (Tool Provider)│
│                  │  JSON   │                  │
│  - Claude Code   │  RPC    │  - Database tools│
│  - Cursor        │         │  - API wrappers  │
│  - Custom agent  │         │  - File access   │
└──────────────────┘         └──────────────────┘

MCP Transport: stdio | HTTP+SSE

Tool Discovery:
  Client → Server: "List available tools"
  Server → Client: [{name, description, inputSchema}]

Tool Invocation:
  Client → Server: {tool: "query_db", args: {sql: "..."}}
  Server → Client: {result: [...rows]}
MCP servers expose tools with JSON Schema-defined inputs. Clients discover tools at connection time and invoke them during LLM interactions.

Examples

Real-World Examples

  • A knowledge management MCP server that exposes constraint search, pattern matching, and lesson retrieval as tools for AI coding agents
  • A database MCP server that gives AI assistants read-only access to production data through parameterized queries
  • A deployment MCP server that lets AI agents trigger CI/CD pipelines, check build status, and roll back releases
  • A documentation MCP server that provides AI assistants with up-to-date API documentation and code examples

Failure Modes

Common Failure Modes

  • Overly permissive tool access — exposing write operations without proper authorization checks creates security risks
  • Schema mismatches — when the MCP server's tool schema does not match what the LLM expects, tool calls fail silently or produce incorrect results
  • Latency assumptions — MCP clients may timeout waiting for slow tool responses if the server does not implement proper streaming or progress reporting
  • State management gaps — MCP is stateless by default; tools that require session state need explicit state management on the server side