What Is MCP? The Model Context Protocol Explained

Large language models are powerful, but they have a fundamental limitation: they are isolated. An AI can generate brilliant code, write compelling text, and reason through complex problems, but it cannot check your database, read your Slack messages, query your GitHub issues, or interact with the tools you use every day. At least, it could not until the Model Context Protocol came along.

MCP, or the Model Context Protocol, is an open standard that lets AI models connect to external tools, data sources, and services in a structured, secure way. Think of it as a universal adapter between AI and the rest of your digital infrastructure. It is one of the most important developments in AI tooling since the introduction of function calling, and understanding it is essential for anyone building or working with AI-powered applications.

The Problem MCP Solves

Before MCP, connecting an AI model to an external tool required custom integration work for every single tool. Want your AI assistant to query a PostgreSQL database? You need to write custom code that translates between the AI's output and the database's query interface. Want it to also read files from your local filesystem? That is another custom integration. GitHub? Another one. Slack? Another one.

This created two major problems:

  1. The M-times-N problem. If you have M different AI applications and N different tools, you need M times N custom integrations. Every new AI application needs to build its own connectors to every tool. Every new tool needs to build connectors for every AI application. The work does not scale.

  2. Inconsistent interfaces. Each custom integration had its own conventions for authentication, error handling, data formatting, and capability discovery. Developers building AI applications had to learn and manage a different interface for every external tool they wanted to support.

MCP solves both problems by providing a single, standardized protocol that any AI application can use to connect to any tool. Build one MCP server for your database, and every MCP-compatible AI client can use it. Build one MCP client into your AI application, and it can connect to every MCP server. The M-times-N problem becomes M-plus-N.

How MCP Works: The Architecture

MCP uses a client-server architecture with three core components:

MCP Hosts are the AI applications that end users interact with. Claude Code, Claude Desktop, Cursor, and other AI tools act as hosts. The host is responsible for the overall user experience and for managing connections to MCP servers.

MCP Clients are protocol-level components within the host that maintain connections to individual MCP servers. Each client handles the communication with one server, managing the lifecycle of that connection. A single host can run multiple clients simultaneously, connecting to many servers at once.

MCP Servers are lightweight programs that expose specific capabilities through the standardized protocol. A server might provide access to a database, a filesystem, a web API, or any other tool or data source. Servers declare what they can do, and clients discover those capabilities dynamically.

The communication between clients and servers happens through a defined transport layer. MCP supports two primary transports:

Newer versions of the protocol also support a Streamable HTTP transport that simplifies the HTTP-based approach and enables better scalability.

What MCP Servers Expose

MCP servers can expose three types of capabilities to AI clients:

Tools are functions that the AI can call to perform actions. A GitHub MCP server might expose tools like create_issue, search_repositories, or create_pull_request. A database server might expose query and execute tools. Tools are the most commonly used capability and the one that unlocks the most powerful workflows.

Resources are data that the AI can read. A filesystem server might expose files as resources. A documentation server might expose knowledge base articles. Resources provide context that helps the AI make better decisions without requiring explicit tool calls.

Prompts are reusable templates that help the AI interact with the server effectively. A database server might include a prompt template for "analyze this table's schema and suggest optimizations." Prompts encode domain expertise about how to best use the server's capabilities.

When a client connects to a server, it discovers all available tools, resources, and prompts through the protocol. The AI model can then decide when and how to use them based on the user's requests.

Real-World MCP Servers

The MCP ecosystem has grown rapidly. Here are some of the most useful and widely deployed MCP servers available today:

Filesystem MCP Server. This server gives AI models controlled access to your local filesystem. It can read files, write files, list directories, and search for content. Crucially, it enforces access boundaries, so you can restrict the AI to specific directories. This is the foundation for tools like Claude Code that operate on your project files.

GitHub MCP Server. This server connects AI to the GitHub API, enabling operations like searching repositories, reading and creating issues, managing pull requests, reviewing code, and interacting with GitHub Actions. A developer using this server can say "find all open issues labeled as bugs in my repository and summarize them" and get actionable results.

PostgreSQL and SQLite MCP Servers. Database servers let AI models query and understand your data. You can ask questions like "what are our top 10 customers by revenue this quarter" and the AI will write and execute the SQL query, then interpret the results. These servers typically operate in read-only mode by default for safety, with write access available as an opt-in configuration.

Slack MCP Server. This server connects AI to your Slack workspace, enabling it to read messages, search conversations, and post updates. It is particularly useful for building AI workflows that bridge communication and development.

Brave Search and Web MCP Servers. These servers give AI models the ability to search the web and fetch content from URLs, enabling research workflows that combine AI reasoning with real-time information.

Memory MCP Server. This server provides persistent memory for AI interactions, storing and retrieving information across sessions using a knowledge graph. It helps AI assistants maintain context over long-running projects.

Many organizations also build custom MCP servers for their internal tools, proprietary APIs, and domain-specific systems. The protocol is designed to make building new servers straightforward.

Building Your First MCP Server

One of MCP's greatest strengths is how simple it is to build a server. You do not need specialized infrastructure or deep protocol knowledge. A basic MCP server can be built in well under 100 lines of code.

Here is a simplified example of what an MCP server looks like in TypeScript using the official SDK:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new McpServer({
  name: "weather-server",
  version: "1.0.0",
});

server.tool(
  "get-weather",
  "Get the current weather for a city",
  {
    city: z.string().describe("The city name"),
  },
  async ({ city }) => {
    // In a real server, you would call a weather API here
    const weather = await fetchWeather(city);
    return {
      content: [
        {
          type: "text",
          text: `Weather in ${city}: ${weather.temperature}°F, ${weather.conditions}`,
        },
      ],
    };
  }
);

const transport = new StdioServerTransport();
await server.connect(transport);

This server exposes a single tool called get-weather that takes a city name and returns weather information. The key elements are:

  1. Create the server with a name and version.
  2. Define tools with a name, description, parameter schema (using Zod for validation), and a handler function.
  3. Connect to a transport (stdio in this case) to start accepting connections.

Once built, you configure your MCP host (like Claude Code or Claude Desktop) to connect to this server. The AI model then automatically discovers the get-weather tool and can use it whenever a user asks about the weather.

Python developers can build MCP servers just as easily using the Python SDK:

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("weather-server")

@mcp.tool()
def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    weather = fetch_weather(city)
    return f"Weather in {city}: {weather['temperature']}°F, {weather['conditions']}"

mcp.run()

The Python SDK's FastMCP interface is even more concise, using decorators to define tools with minimal boilerplate.

Configuring MCP in Claude Code

To use an MCP server with Claude Code, you add it to your configuration. This can be done at the project level (in a .mcp.json file in your project root) or globally. A typical configuration looks like this:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "your-github-token-here"
      }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
    }
  }
}

Each entry specifies the command to run the server, any arguments, and environment variables (like API tokens). When Claude Code starts, it launches these servers and discovers their capabilities. You can then use the tools they expose naturally in your conversations.

For example, with the GitHub MCP server configured, you can simply ask Claude Code: "What are the open pull requests in my repository?" Claude will use the GitHub MCP server's tools to fetch and present the information.

Why MCP Matters for the Future of AI Development

MCP is significant for several reasons that extend well beyond convenience:

It creates a standard. Before MCP, every AI tool vendor was building proprietary integrations. MCP provides a common language that prevents vendor lock-in. If you build an MCP server for your internal tool, it works with Claude, Cursor, and any other MCP-compatible host. You write the integration once.

It makes AI more useful. An AI that can only process text you paste into it is fundamentally limited. An AI that can query your database, search your documents, interact with your APIs, and use your tools is orders of magnitude more capable. MCP is the bridge that makes AI contextually aware of your actual working environment.

It enables composability. Because MCP servers are modular and independent, you can compose them to create powerful workflows. An AI assistant with access to your GitHub server, your database server, and your Slack server can do things like: analyze code changes in a pull request, check whether they might affect production data by querying the database schema, and post a summary to your team's Slack channel. Each server does one thing well, and the AI orchestrates them.

It pushes security forward. MCP includes built-in concepts for access control, user consent, and capability boundaries. Servers declare what they can do, and hosts can enforce policies about what they are allowed to do. This is a much more structured and auditable approach to AI-tool interaction than ad hoc integrations.

It lowers the barrier to AI integration. Organizations that want to AI-enable their internal tools no longer need to build complex, custom AI pipelines. They can build a simple MCP server that exposes their tool's capabilities and immediately make those capabilities available to any MCP-compatible AI assistant their team uses.

The Growing MCP Ecosystem

The MCP ecosystem is expanding rapidly. Anthropic open-sourced the protocol specification along with SDKs for TypeScript and Python. The community has built hundreds of MCP servers for tools ranging from cloud platforms like AWS and Google Cloud to developer tools like Docker and Kubernetes to productivity tools like Google Drive and Notion.

Major AI tool vendors have adopted or announced support for MCP, validating it as an emerging standard rather than a single vendor's proprietary approach. The protocol specification continues to evolve, with recent additions including better authentication flows, improved streaming support, and more granular capability negotiation.

For developers, the practical implication is clear: learning to build and use MCP servers is an investment that will pay dividends as the AI tool ecosystem continues to mature. The protocol is well-documented, the SDKs are actively maintained, and the community is welcoming to new contributors.

Getting Started with MCP

If you want to explore MCP, here is a practical path forward:

  1. Use existing MCP servers. Start by configuring Claude Code or Claude Desktop with a few community-built MCP servers. The filesystem and GitHub servers are excellent starting points.
  2. Read the specification. The MCP documentation at modelcontextprotocol.io provides a thorough overview of the protocol, its capabilities, and its design philosophy.
  3. Build a simple server. Pick an API or tool you use regularly and build an MCP server for it. The official SDK tutorials walk you through the process step by step.
  4. Share your work. The MCP community thrives on contributions. If you build a server for a popular tool, others will benefit from it.

MCP represents a fundamental shift in how AI interacts with the world beyond its training data. Understanding it is not just useful for developers building AI tools. It is essential for anyone who wants to understand where AI-assisted work is heading.

To dive deeper into MCP, AI-assisted development, and the tools shaping the future of software engineering, read our free Vibe Coding and Working with AI Tools Effectively textbooks.