This guide explains how to connect Claude Code to external tools and data sources using the Model Context Protocol (MCP). It covers what MCP connections enable, such as working with issue trackers, databases, and monitoring tools; where to find reviewed connectors; how to scaffold your own server with the official mcp-server-dev plugin; and how to install remote HTTP, remote SSE, and local stdio servers, including transport-specific flags, JSON configuration pitfalls, and environment variables like CLAUDE_PROJECT_DIR.
What MCP does for Claude Code
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.
The practical signal for when to connect a server: 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.
With servers connected, Anthropic's documentation lists example requests such as:
- "Add the feature described in JIRA issue ENG-4521 and create a PR on GitHub."
- "Check Sentry and Statsig to check the usage of the feature described in ENG-4521."
- "Find emails of 10 random users who used feature ENG-4521, based on our PostgreSQL database."
- "Update our standard email template based on the new Figma designs that were posted in Slack"
- "Create Gmail drafts inviting these 10 users to a feedback session about the new feature."
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.
Finding and building servers
Reviewed connectors are listed in the Anthropic Directory. Directory connectors use the same MCP infrastructure as Claude Code, so any remote server listed there can be added with claude mcp add.
One caution from the docs is worth repeating: 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, the docs point to 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:
/plugin install mcp-server-dev@claude-plugins-official
If the install fails, match the reported message:
Marketplace "claude-plugins-official" not found: add the marketplace with /plugin marketplace add anthropics/claude-plugins-official, then retry.
- Plugin not found in the marketplace: check the plugin name. Claude Code refreshes a stale marketplace catalog and retries before reporting this, so if you turned off marketplace auto-update, refresh manually with
/plugin marketplace update claude-plugins-official and retry.
If the install summary reports Run /reload-plugins to activate., run that command. Then 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.
Option 1: Remote HTTP servers (recommended for remote)
HTTP is the recommended transport for remote MCP servers and the most widely supported for cloud-based services.
# Basic syntax
claude mcp add --transport http <name> <url>
# 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 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 streamable-http for this transport, so configurations copied from server documentation work without modification.
One configuration error to avoid: a JSON entry with a url but no type. Claude Code reads an entry with no type as a stdio server, so it skips the server and reports MCP server "<name>" has a "url" but no "type"; add "type": "http" (or "sse" / "ws") to this entry. Before v2.1.202, this misconfiguration was reported as command: expected string, received undefined.
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. This requires Claude Code v2.1.219 or later.
Option 2: Remote SSE servers (deprecated)
The SSE (Server-Sent Events) transport is deprecated; use HTTP servers instead where available. Some services still expose only an SSE endpoint. Use the same command shape with --transport sse:
# Basic syntax
claude mcp add --transport sse <name> <url>
# 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: Local stdio servers
Stdio servers run as local processes on your machine. They're suited to tools that need direct system access or custom scripts.
# Basic syntax
claude mcp add [options] <name> -- <command> [args...]
CLAUDE_PROJECT_DIR
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, and sends notifications/roots/list_changed when that set changes. Before v2.1.203, roots/list returned only the launch directory and no change notifications were sent.
Note a subtlety about variable expansion: CLAUDE_PROJECT_DIR is set in the server's environment, not in Claude Code's own environment. 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.
Where to go next
If this is your first server, Anthropic's docs recommend the MCP quickstart for a step-by-step walkthrough; the page summarized here is the full reference.
This guide is based on Anthropic's Claude Code documentation and is not an official Anthropic publication.
claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.