Connect Claude Code to tools via MCP - Claude Code Docs
Documentation Index Fetch the complete documentation index at: /docs/llms.txt Use this file to discover all available pages before exploring further. Skip to main content Assistant Responses are generated using AI and may contain mistakes. Claude Code can connect to hundreds of external tools and data sources through the Model Context Protocol (MCP) , an open source standard for AI-tool integrations. MCP servers give Claude Code access to your tools, databases, and APIs.
Connect a server when you find yourself copying data into chat from another tool, like an issue tracker or a monitoring dashboard. Once connected, Claude can read and act on that system directly instead of working from what you paste. If you’re connecting your first server, start with the MCP quickstart for a step-by-step walkthrough. This page is the full reference. What you can do with MCP With MCP servers connected, you can ask Claude Code to: Implement features from issue trackers : “Add the feature described in JIRA issue ENG-4521 and create a PR on GitHub.” Analyze monitoring data : “Check Sentry and Statsig to check the usage of the feature described in ENG-4521.” Query databases : “Find emails of 10 random users who used feature ENG-4521, based on our PostgreSQL database.” Integrate designs : “Update our standard email template based on the new Figma designs that were posted in Slack” Automate workflows : “Create Gmail drafts inviting these 10 users to a feedback session about the new feature.” React to external events : an MCP server can also act as a channel that pushes messages into your session, so Claude reacts to Telegram messages, Discord chats, or webhook events while you’re away.
Find and build MCP servers Browse reviewed connectors in the Anthropic Directory . Directory connectors use the same MCP infrastructure as Claude Code, so you can add any remote server listed there with claude mcp add . Verify you trust each server before connecting it. Servers that fetch external content can expose you to prompt injection risk . To build your own server, see the MCP server guide for protocol fundamentals and the Claude connector building docs for authentication, testing, and Directory submission.
You can also have Claude scaffold a server for you with the official mcp-server-dev plugin . 1 Install the plugin In the VS Code extension or the desktop app, follow Install a plugin instead of this step. In a terminal, start Claude Code by running claude , then enter this at its prompt: /plugin install mcp-server-dev@claude-plugins-official If the install fails, match the message Claude Code reports: Marketplace "claude-plugins-official" not found : add the marketplace with /plugin marketplace add anthropics/claude-plugins-official , then retry the install.
Plugin "<name>" not found in marketplace "claude-plugins-official" : your local copy of the marketplace catalog may be out of date. Refresh it with /plugin marketplace update claude-plugins-official , then retry the install. If the retry prints the same message, see Plugin not found in marketplace . If the install summary reports Run /reload-plugins to apply. , Claude Code then runs that reload for you. If the reload warns that your next message would re-read the conversation, run /reload-plugins --force .
2 Run the build skill /mcp-server-dev:build-mcp-server Claude asks about your use case and scaffolds a remote HTTP or local stdio server. Installing MCP servers MCP servers can be configured in several ways depending on your needs: Option 1: Add a remote HTTP server HTTP servers are the recommended option for connecting to remote MCP servers. This is the most widely supported transport for cloud-based services. # Basic syntax claude mcp add --transport http < nam e > < ur l > # Real example: Connect to Notion claude mcp add --transport http notion https://mcp.notion.com/mcp # Example with Bearer token claude mcp add --transport http secure-api https://api.example.com/mcp \ --header "Authorization: Bearer your-token" When configuring MCP servers via JSON in .mcp.json , ~/.claude.json , or claude mcp add-json , the type field accepts streamable-http as an alias for http .
The MCP specification uses the name streamable-http for this transport, so configurations copied from server documentation work without modification. A JSON entry that has a url but no type is a configuration error, because Claude Code reads an entry with no type as a stdio server. Claude Code skips that server and reports MCP server "<name>" has a "url" but no "type"; add "type": "http" (or "sse" / "ws") to this entry .
Only an SDK host application, such as an Agent SDK application or the desktop app , can register an in-process "type": "sdk" server. Claude Code skips a "type": "sdk" entry in .mcp.json , ~/.claude.json , or settings and reports Skipped — MCP server "<name>" declares type "sdk", which only an SDK host application can register . In --output-format stream-json runs, Claude Code also reports a skipped --mcp-config entry in the system/init event’s mcp_server_errors field , so scripts can detect that the server never loaded.
Option 2: Add a remote SSE server The SSE (Server-Sent Events) transport is deprecated. Use HTTP servers instead, where available. Some services still expose only an SSE endpoint. Add these with the same claude mcp add --transport http <name> <url> command as an HTTP server . Claude Code tries the HTTP transport first and switches to SSE when the server doesn’t accept it. The automatic switch requires Claude Code v2.1.265 or later.
On an earlier version, or to connect over SSE directly, pass --transport sse instead: # Basic syntax claude mcp add --transport sse < nam e > < ur l > # Real example: Connect to Asana claude mcp add --transport sse asana https://mcp.asana.com/sse # Example with authentication header claude mcp add --transport sse private-api https://api.company.com/sse \ --header "X-API-Key: your-key-here" Option 3: Add a local stdio server Stdio servers run as local processes on your machine.
They’re ideal for tools that need direct system access or custom scripts. Claude Code sets CLAUDE_PROJECT_DIR in the spawned server’s environment to the project root, so your server can resolve project-relative paths without depending on the working directory. This is the same directory hooks receive in their CLAUDE_PROJECT_DIR variable. Read it from inside your server process, for example process.env.CLAUDE_PROJECT_DIR in Node or os.environ["CLAUDE_PROJECT_DIR"] in Python.
CLAUDE_PROJECT_DIR is the stable project root and doesn’t change when you add or remove working directories mid-session. A server that limits its own filesystem access to a set of allowed directories should implement the MCP roots/list request instead. Claude Code answers roots/list with the session’s launch directory plus every additional working directory you’ve granted with --add-dir , /add-dir , or the additionalDirectories setting.
Claude Code sends notifications/roots/list_changed when that set changes. This variable is set in the server’s environment, not in Claude Code’s own environment, so referencing it via ${VAR} expansion in the command or args of a project-scoped .mcp.json entry or a local- or user-scoped server entry in ~/.claude.json requires a default such as ${CLAUDE_PROJECT_DIR:-.} . Plugin-provided MCP configurations substitute ${CLAUDE_PROJECT_DIR} directly and don’t need the default. # Basic syntax claude mcp add [options] < name > -- < command > [args...] # Real example: Add Airtable server claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \ -- npx -y airtable-mcp-server For stdio servers, the -- (double dash) separates Claude’s own options, such as --transport , --env , and --scope , from the command and arguments that run the server.
Everything after -- is passed to the server untouched. For example: claude mcp add --transport stdio myserver -- npx server → ru
The rest of this page is on the live site.