What is MCP?
MCP (Model Context Protocol) is an open standard from Anthropic that lets Claude Code call external tools and access real data sources. Instead of pasting content into prompts, Claude can directly query your database, read GitHub PRs, search the web, or control a browser — in real-time, during your conversation.
Each MCP server is a local process that exposes a set of tools. Claude Code starts them automatically when you open a session and can call their tools the same way it calls built-in tools like Read or Bash.
How to Add an MCP Server
The fastest way is the CLI:
# Add a server globally (available in all projects)
claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Add a server per-project (committed to .claude/settings.json)
claude mcp add postgres -- npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydb
Or edit .claude/settings.json directly:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "ghp_yourtoken" }
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/you/projects"]
}
}
}
Official MCP Servers (Anthropic)
npx -y @modelcontextprotocol/server-github
npx -y @modelcontextprotocol/server-filesystem /path
npx -y @modelcontextprotocol/server-postgres $DB_URL
npx -y @modelcontextprotocol/server-brave-search
npx -y @modelcontextprotocol/server-slack
npx -y @modelcontextprotocol/server-gdrive
npx -y @modelcontextprotocol/server-sqlite
npx -y @modelcontextprotocol/server-puppeteer
Community MCP Servers
npx -y mcp-server-playwright
npx -y @linear/mcp-server
npx -y mcp-server-sentry
npx -y @cloudflare/mcp-server-cloudflare
npx -y @vercel/mcp-adapter
npx -y mcp-server-redis
Securing MCP Servers
MCP servers run with the same permissions as your shell. Follow these practices:
- Use
permissionsinsettings.jsonto require human approval for destructive MCP tool calls. - Add a
PreToolUsehook that inspectsCLAUDE_TOOL_NAMEand exits 1 to block any call you didn't expect. - Pass credentials via
envin the server config — never hardcode tokens in args. - Use read-only database users where writes aren't needed (e.g. Postgres
GRANT SELECTonly).
Building a Custom MCP Server
Any process that speaks MCP JSON-RPC over stdio is a valid server. Minimal TypeScript example:
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({ name: "my-tool", version: "1.0.0" }, {
capabilities: { tools: {} }
});
server.setRequestHandler("tools/list", async () => ({
tools: [{ name: "hello", description: "Say hello", inputSchema: {
type: "object", properties: { name: { type: "string" } }, required: ["name"]
}}]
}));
server.setRequestHandler("tools/call", async (req) => ({
content: [{ type: "text", text: `Hello, ${req.params.arguments.name}!` }]
}));
await server.connect(new StdioServerTransport());
Register it: claude mcp add hello -- node /path/to/server.js
Browse All Claude Code Skills
Slash commands, hooks, MCP servers, and automation patterns — all in one place.
Open Claude Skills Browser →