Tutorials

Claude Code MCP: Add Servers with One Command (2026 Guide)

How to add MCP servers to Claude Code: the claude mcp add command, scopes, OAuth sign-in, seven servers to install first and fixes for common errors.

Oleg Kopachovets
CEO & Founder
Published 8 min read
Claude Code MCP setup with a terminal connected to remote MCP servers

TL;DR: Run claude mcp add --transport http <name> <url> to connect a remote MCP server to Claude Code, then /mcp inside a session to sign in. Add --scope project to share the server with your team through .mcp.json. Local servers use the same command with -- before the launch command.

Claude Code MCP support is what lets the agent read an issue, query a database or check an error tracker without you pasting anything into the terminal. This guide covers the claude mcp add command, the three scopes, authentication, seven servers to install first and the errors you are most likely to hit. Every command here comes from the official Claude Code MCP docs or the server's own README.


Add a remote MCP server#

Remote servers over HTTP are the recommended option. One command adds one:

bash
# Syntax
claude mcp add --transport http <name> <url>

# Example: Notion
claude mcp add --transport http notion https://mcp.notion.com/mcp

The name is yours to choose. It is how the server appears in /mcp and in the other claude mcp commands.

For a server that takes an API key instead of a sign-in, pass a header:

bash
claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

The SSE transport is deprecated. If a service still exposes only an SSE endpoint, the same --transport http command works on recent versions, because Claude Code tries HTTP first and falls back to SSE.

Add a local stdio server#

A stdio server runs as a process on your machine. It suits tools that need direct access to local files or a database on your network.

bash
# Syntax
claude mcp add [options] <name> -- <command> [args...]

# Example: Airtable
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
  -- npx -y airtable-mcp-server

The double dash matters. Everything before -- is an option for Claude Code, and everything after it is the command that starts the server. Without it, Claude Code tries to parse the server's own flags.


Choose a scope: local, project or user#

Scope decides where a server loads and who else gets it.

ScopeLoads inShared with teamStored in
Local (default)Current projectNo~/.claude.json
ProjectCurrent projectYes, through version control.mcp.json in the project root
UserAll your projectsNo~/.claude.json
bash
# Share with the team
claude mcp add --transport http shared-server --scope project https://example.com/mcp

# Available in every project on your machine
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic

A project-scoped server lands in .mcp.json, which you commit:

json
{
  "mcpServers": {
    "shared-server": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}

Claude Code asks each teammate to approve project-scoped servers before using them. When the same server name exists in more than one scope, local wins over project, and project wins over user.

Keep secrets out of .mcp.json. Use local scope for servers with personal credentials, or reference environment variables in the project file.


Sign in to a server#

Many remote servers use OAuth. Add the server, then authenticate from inside a session:

bash
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

Then, in Claude Code:

text
/mcp

Select the server and follow the browser flow. Tokens are stored and refreshed for you. You can also sign in from your shell with claude mcp login sentry, which helps over SSH because it prints the URL when no browser is available. claude mcp logout sentry clears the stored credentials.

Headless runs with claude -p have no /mcp panel, so complete the sign-in from an interactive session first.

Manage your servers#

bash
claude mcp list            # all configured servers
claude mcp get notion      # details for one server
claude mcp remove notion   # remove it

Inside a session, /mcp shows the status of each server and whether it needs sign-in. If you already set up servers in Claude Desktop, claude mcp add-from-claude-desktop imports them.


Seven MCP servers to add to Claude Code first#

These cover the work most sessions involve: code hosting, errors, docs, a browser and a database. Each command is copied from Anthropic's docs or the project's README.

1. GitHub. Review pull requests, open issues and search repositories. It authenticates with a fine-grained personal access token.

bash
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"

2. Sentry. Pull the stack trace for a production error into the session that will fix it.

bash
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

3. Context7. Fetch current library documentation, so the agent does not code against an API from its training data. The Context7 README recommends a free API key for higher rate limits.

bash
claude mcp add --transport http context7 https://mcp.context7.com/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

4. Playwright. Drive a real browser to check a UI change. The command is from the Playwright MCP README.

bash
claude mcp add playwright npx @playwright/mcp@latest

5. A database through DBHub. Query PostgreSQL and other relational databases. Use a read-only database user so the agent cannot change data.

bash
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
  --dsn "postgresql://readonly:pass@prod.db.com:5432/analytics"

6. Notion. Read specs and write docs back to the workspace.

bash
claude mcp add --transport http notion https://mcp.notion.com/mcp

7. Stripe. Work with your Stripe account from the session while you build billing code.

bash
claude mcp add --transport http stripe https://mcp.stripe.com

Add servers when a task needs them. A server that duplicates something Claude Code already does, such as reading files, adds noise without adding ability.

More servers, one command each#

Every server on the MCPize marketplace is hosted at its own HTTPS endpoint, and its page shows the ready-made claude mcp add --transport http command, with your API key in a header when the server needs one. Browse database servers, version control or project management. Authentication, API keys and usage limits run through the MCPize gateway.

Browse MCP servers for Claude Code

Connectors from claude.ai show up automatically#

If you sign in to Claude Code with a claude.ai account, the connectors you added in claude.ai are available in Claude Code without extra setup. /mcp lists them with a marker showing where they come from. They do not load when you authenticate with an API key or through a third-party provider such as Amazon Bedrock.

A server you add with claude mcp add takes precedence over a claude.ai connector that points at the same URL. For the claude.ai side, see the Claude connectors guide.

Keep context usage low#

Tool definitions take up context. Tool search, on by default, defers them: only tool names and server instructions load at session start, and Claude fetches a tool's full definition when it needs it. Adding another server costs little context.

Large tool results are the other cost. Claude Code warns when a tool returns more than 10,000 tokens, and by default caps MCP output at 25,000 tokens. Raise the cap for a session when you need to:

bash
export MAX_MCP_OUTPUT_TOKENS=50000
claude

Fix common errors#

What you seeCauseFix
has a "url" but no "type"A JSON entry with a URL and no transport type is read as stdioAdd "type": "http" to the entry
MCP server <name> already exists in local configYou added the same name at the same scope twiceRemove it first, or pick another name
Server listed as needing authenticationThe server returned 401 or 403Run /mcp, select the server and sign in
Connection fails with a header configuredThe token in --header is wrong or expiredFix the token. Claude Code does not fall back to OAuth
The server's flags are rejectedThe -- separator is missingPut -- before the launch command
A teammate's .mcp.json server does not loadThe approval prompt was declinedRun claude mcp reset-project-choices

claude mcp add saves a configuration without checking credentials. A placeholder token is accepted at add time and fails at connect time, so check /mcp for a checkmark after you add a server.


FAQ#

How do I add an MCP server to Claude Code?#

Run claude mcp add --transport http <name> <url> for a remote server, or claude mcp add <name> -- <command> for a local one. Then open a session and run /mcp to confirm it connected.

Where does Claude Code store MCP servers?#

Local and user scopes are stored in ~/.claude.json. Project scope is stored in .mcp.json at the project root, which you commit so the team shares the same servers.

What are the best MCP servers for Claude Code?#

Start with the ones that match daily work: GitHub for code review, Sentry for errors, Context7 for current docs, Playwright for browser checks and a database server such as DBHub. Add others when a task needs them.

Does Claude Code support remote MCP servers?#

Yes. HTTP is the recommended transport for remote servers, and Claude Code supports OAuth sign-in for them through /mcp or claude mcp login <name>.

How do I remove an MCP server from Claude Code?#

Run claude mcp remove <name>. For a remote server this also deletes the OAuth tokens Claude Code stored for it. To revoke them at the provider as well, run claude mcp logout <name> first.

Can I use Claude Desktop servers in Claude Code?#

Yes. Run claude mcp add-from-claude-desktop and pick the servers to import. Remote connectors from your claude.ai account appear automatically when you sign in with that account.


Next steps#

  1. Add one remote server and sign in through /mcp.
  2. Move the servers your team shares into project scope and commit .mcp.json.
  3. Have an API of your own? Host it as a remote MCP server and anyone can add it with one command.
Find servers on MCPize Build your own server

Sources:

More on the same topic, from the MCPize blog

View all articles