Skip to content

claude mcp add: every form of the command, with examples

Better Design

Direct answer

claude mcp add registers an MCP server with Claude Code: use --transport http <name> <url> for a remote server, or <name> -- <command> [args...] for a local stdio server. Related forms are claude mcp add-json <name> '<json>' for a JSON entry and claude mcp add-from-claude-desktop to import servers from Claude Desktop.

A hand-drawn terminal showing the command or error this guide covers: claude mcp add command.

Every form of claude mcp add

Each command below comes from the official docs, read on November 12, 2026. The comment above each line says what it does.

commands and config
# Adds a remote HTTP server, the recommended transport for remote servers.
claude mcp add --transport http <name> <url>

# Real example from the docs: connects the Notion server.
claude mcp add --transport http notion https://mcp.notion.com/mcp

# Adds a remote HTTP server that needs a bearer token header.
claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

# Adds a server over the deprecated SSE transport; on v2.1.265 or later, --transport http falls back to SSE on its own.
claude mcp add --transport sse asana https://mcp.asana.com/sse

# Adds an SSE server with an API key header.
claude mcp add --transport sse private-api https://api.company.com/sse \
  --header "X-API-Key: your-key-here"

# Adds a local stdio server; everything after -- goes to the server untouched.
claude mcp add [options] <name> -- <command> [args...]

# Real stdio example from the docs with an environment variable.
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
  -- npx -y airtable-mcp-server

# Quickstart example: adds the Playwright server at local scope (stdio is the default transport).
claude mcp add playwright -- npx -y @playwright/mcp@latest

# Sets the scope explicitly; local is the default.
claude mcp add --transport http stripe --scope local https://mcp.stripe.com

# Writes the server to .mcp.json in the project root to share it with the team.
claude mcp add --transport http shared-server --scope project https://example.com/mcp

# Makes the server available in all your projects.
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic

# Fixes the OAuth callback port to match a pre-registered redirect URI http://localhost:PORT/callback.
claude mcp add --transport http \
  --callback-port 8080 \
  my-server https://mcp.example.com/mcp

# Adds a server from a JSON entry (the object inside mcpServers, not the wrapper).
claude mcp add-json <name> '<json>'

# add-json example for an HTTP server with a header.
claude mcp add-json weather-api '{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer token"}}'

# add-json example for a stdio server.
claude mcp add-json local-weather '{"type":"stdio","command":"/path/to/weather-cli","args":["--api-key","abc123"],"env":{"CACHE_DIR":"/tmp"}}'

# WebSocket servers can be added only with add-json or .mcp.json; --transport does not accept ws.
claude mcp add-json events-server \
  '{"type":"ws","url":"wss://mcp.example.com/socket","headers":{"Authorization":"Bearer YOUR_TOKEN"}}'

# Opens a dialog to pick Claude Desktop servers to import; works only on macOS and WSL.
claude mcp add-from-claude-desktop

The steps for claude mcp add command

Four steps take you from the problem to a working MCP server.

A hand-drawn four-step path: Pick the transport: http or stdio, Choose the scope: local, project or user, Run claude mcp add, Check it with claude mcp list.
  1. Step 1: Pick the transport: http or stdio
  2. Step 2: Choose the scope: local, project or user
  3. Step 3: Run claude mcp add
  4. Step 4: Check it with claude mcp list

The flags claude mcp add accepts

--transport <transport>
Short form

-t

What it does

Transport type: stdio, sse or http. Defaults to stdio.

--scope <scope>
Short form

-s

What it does

Where the config is stored: local (default), project or user.

--env KEY=value
Short form

-e

What it does

Sets an environment variable for the server; accepts several pairs.

--header "Name: value"
Short form

-H

What it does

Sets a header for HTTP or SSE servers.

--callback-port <port>
Short form

What it does

Fixed port for the OAuth callback.

--client-id <clientId>
Short form

What it does

OAuth client ID for HTTP or SSE servers.

--client-secret
Short form

What it does

Prompts for the OAuth client secret, or reads MCP_CLIENT_SECRET.

Caveats the docs call out

  • Put -- before a stdio server's command; without it Claude Code parses the server's flags, such as --port, as its own.
  • If the server name comes directly after --env, the CLI reads the name as another KEY=value pair and rejects it; put another option such as --transport stdio between them.
  • A JSON entry with a url but no type fails, because Claude Code reads an entry with no type as a stdio server; add "type": "http", "sse" or "ws".
  • Names added through claude mcp may use only letters, numbers, hyphens and underscores; adding the same name again at the same scope fails with MCP server <name> already exists in local config.

Steal this workflow

Run this guide in your own assistant. The prompt carries the guide link and the workflow summary, so the assistant can adapt it to your project.

Read the guide "claude mcp add: every form of the command, with examples" at https://better-design.com/blog/claude-mcp-add and help me apply it to my project.

claude mcp add registers an MCP server with Claude Code: use --transport http <name> <url> for a remote server, or <name> -- <command> [args...] for a local stdio server. Related forms are claude mcp add-json <name> '<json>' for a JSON entry and claude mcp add-from-claude-desktop to import servers from Claude Desktop.

Start by asking what I am building and which tools I use. Then walk me through the workflow step by step, adapted to my answers.

Claude and ChatGPT open with the prompt filled in. Gemini copies the prompt to your clipboard first, so paste it when the app opens.

Questions

Which scope does claude mcp add use by default?

Local scope: the server loads only in the current project and is stored in ~/.claude.json under that project's path.

How do I add a server whose instructions were written for Claude Desktop or Cursor?

Pass the object inside its mcpServers block to claude mcp add-json <name> '<json>', adding a type field if the entry has a url.

How do I check that the server connected?

Each add prints an Added ... line; run claude mcp get <name> to see its connection status.

Where these commands and paths come from

Each command, path and caveat comes from the official docs, read on November 12, 2026. Commands change between releases, so check the docs for your version.

Add design guidance to the same setup

MCP servers give your coding agent tools and data. Better Design is an MCP server too: it gives the agent a design system, interface principles and review rules, so the screens it builds look designed.