Skip to content

MCP — Model Context Protocol

📖 4 min read claudemcpintegrationtools
Complete guide to the Model Context Protocol — the open standard for connecting AI applications to external tools, data, and services. Architecture, available servers, building custom MCP servers, and debugging.
Key Takeaways
  • MCP is the open standard for connecting AI to external systems — like USB-C for AI tools
  • Supported across Claude, ChatGPT, VS Code, Cursor, and 32+ other tools
  • Standalone JSON-RPC servers expose data and tools to any MCP-compatible AI application

MCP (Model Context Protocol) is an open-source standard for connecting AI applications to external systems. Think of it like USB-C for AI — a standardized way for any AI app to connect to any data source or tool.

graph LR
A["AI Application<br/>(Claude, ChatGPT, VS Code)"] --> B["MCP Client"]
B --> C["MCP Server<br/>(Filesystem)"]
B --> D["MCP Server<br/>(GitHub)"]
B --> E["MCP Server<br/>(Database)"]
B --> F["Custom MCP Server"]
C --> G["Local Files"]
D --> H["Repos & Issues"]
E --> I["Data Queries"]
F --> J["Your API"]
style A fill:#1e3a8a,stroke:#60a5fa,color:#fff
style B fill:#3b82f6,stroke:#93c5fd,color:#fff

Architecture

MCP uses a client-server model:

  • MCP Client: Embedded in the AI application (Claude Code, claude.ai, VS Code)
  • MCP Server: Standalone process exposing tools, resources, and prompts via JSON-RPC
  • Transport: Stdio (local) or HTTP/SSE (remote)

Each MCP server provides:

PrimitivePurposeExample
ToolsActions the AI can invokeSearch files, create issue, run query
ResourcesData the AI can readFile contents, database records, API responses
PromptsTemplated instructions”Summarize this document” with specific format

Available MCP Servers

ServerWhat It Connects ToInstall
FilesystemLocal file system accessnpx @modelcontextprotocol/server-filesystem
GitHubRepos, issues, PRsnpx @modelcontextprotocol/server-github
SlackChannels, messages, usersnpx @modelcontextprotocol/server-slack
Brave SearchWeb and local searchnpx @modelcontextprotocol/server-brave-search
Google DriveDocuments and filesnpx @modelcontextprotocol/server-gdrive
PostgresDatabase read/writenpx @modelcontextprotocol/server-postgres
NotionPages and databasesAvailable via marketplace
FigmaDesign files and assetsAvailable via marketplace
JiraIssues and projectsAvailable via marketplace

For the full directory of 200+ MCP servers: modelcontextprotocol.io/servers

Setting Up MCP with Claude Code

Create .claude/mcp.json in your project:

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/docs"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}

Claude Code automatically starts these servers and connects to them. You can then ask:

Terminal window
claude "read the design spec in docs/ and create a GitHub issue with the implementation plan"

Building a Custom MCP Server

Python (FastMCP)

from mcp.server.fastmcp import FastMCP
mcp = FastMCP("My Custom Server")
@mcp.tool()
def get_customer_info(customer_id: str) -> dict:
"""Get customer information by ID."""
# Your database/API logic
return {"name": "Acme Corp", "plan": "Enterprise"}
@mcp.tool()
def update_subscription(customer_id: str, tier: str) -> dict:
"""Update customer subscription tier."""
# Your business logic
return {"status": "updated", "tier": tier}
if __name__ == "__main__":
mcp.run()

TypeScript

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({
name: "my-custom-server",
version: "1.0.0",
}, {
capabilities: { tools: {} }
});
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "get_customer_info",
description: "Get customer information by ID",
inputSchema: {
type: "object",
properties: { customer_id: { type: "string" } },
required: ["customer_id"]
}
}]
}));
const transport = new StdioServerTransport();
await server.connect(transport);

Testing & Debugging

Terminal window
# Use the MCP Inspector for debugging
npx @modelcontextprotocol/inspector
# Check which servers Claude Code sees
claude "list your connected MCP servers and what tools they provide"
# Debug a specific server
# Add --debug flag to your server command and check logs

Security Considerations

  • Local-only servers: Run on your machine using stdio transport — no network exposure
  • Environment variables: Use env vars for secrets (API keys, tokens), never hardcode
  • Permission model: Claude Code asks permission before using MCP tools on first access
  • Tool scoping: Design server tools to expose only the minimum data needed

Ecosystem Adoption

MCP is supported across a growing ecosystem:

CategoryTools
AI AssistantsClaude, ChatGPT, VS Code Copilot
IDEsVS Code, Cursor, JetBrains
FrameworksLangChain, CrewAI, MCPJam
Enterprise200+ community-built servers for databases, APIs, and SaaS tools

For the full list, see modelcontextprotocol.io/clients.