MCP (Model Context Protocol) is an open standard that lets Claude Code connect to external tools and data sources. MCP servers give Claude Code new abilities like fetching web content, querying databases, or interacting with third-party APIs.
MCP follows a client-server architecture:
When you add an MCP server, its tools become available to Claude Code just like built-in tools.
Use the claude mcp add command:
# Add a filesystem MCP server claude mcp add filesystem -- npx -y @anthropic-ai/mcp-filesystem /path/to/dir # Add a PostgreSQL MCP server claude mcp add postgres -- npx -y @anthropic-ai/mcp-postgres "postgresql://localhost/mydb" # Add a web fetch MCP server claude mcp add fetch -- npx -y @anthropic-ai/mcp-fetch
# List all configured MCP servers claude mcp list # Remove an MCP server claude mcp remove postgres # Get details about a server claude mcp get filesystem
MCP servers can be configured at different scopes:
# Project-level (stored in .claude/settings.json) claude mcp add --scope project my-server -- command args # User-level (stored in ~/.claude/settings.json) claude mcp add --scope user my-server -- command args
| Server | Purpose | Example Use |
|---|---|---|
| mcp-filesystem | Access files outside project | Read config files from other directories |
| mcp-postgres | Query PostgreSQL | Check database schema and data |
| mcp-fetch | Fetch web URLs | Read API docs, check endpoints |
| mcp-github | GitHub integration | Manage issues, PRs, repos |
| mcp-slack | Slack integration | Send messages, read channels |
Once configured, MCP tools appear automatically. For example, with the postgres server:
> Show me all tables in the database # Claude uses the MCP postgres tool to query information_schema > What columns does the users table have? # Claude queries the table structure directly
You can create your own MCP servers for custom integrations. The MCP SDK is available in TypeScript and Python:
npm install @modelcontextprotocol/sdk
A minimal MCP server exposes tools that Claude Code can call:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({ name: "my-server", version: "1.0.0" });
server.tool("hello", "Say hello", { name: { type: "string" } },
async ({ name }) => ({
content: [{ type: "text", text: `Hello, ${name}!` }]
})
);
const transport = new StdioServerTransport();
await server.connect(transport);
MCP servers extend Claude Code’s capabilities by connecting it to external tools and data sources. From databases to APIs to custom integrations, MCP makes Claude Code infinitely extensible. Next, we’ll cover advanced tips and tricks to maximize your productivity.