How to Add an MCP Server to Claude Code

Add a remote or local MCP server to Claude Code with claude mcp add, pick a scope, and confirm the connection with claude mcp list and /mcp.

Updated · Markdown version

You add an MCP server to Claude Code with the claude mcp add command, choosing a transport and a scope that controls who can use it. After adding it, claude mcp list and the /mcp view show whether the connection worked. The steps below follow the official MCP page as of 2026-11-21; check the current docs if a flag has changed.

Choose a transport and a scope

Two decisions shape the command. The transport is http for a remote server that has a URL, or stdio for a local process that Claude Code starts itself. The scope decides where the configuration lives and who gets it.

ScopeWhere it is storedWho gets the server
local (default)~/.claude.json, under the current project pathYou, in this project only
project.mcp.json in the project rootEveryone who clones the repository
user~/.claude.jsonYou, in every project

Pick project only when the server configuration is safe to commit, because the file goes into version control. Secrets such as API keys belong in environment variables, not in the file.

Steps

  1. Add a remote server. For example, claude mcp add --transport http notion https://mcp.notion.com/mcp registers a server named notion.
  2. Add a local stdio server. Pass environment variables with --env and place the server command after --, as in claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server.
  3. Set the scope if the default does not fit. Append --scope project (or --scope user) to the command.
  4. For a remote server that needs sign-in, start Claude Code in the project, run /mcp, and follow the browser login. From a shell, claude mcp login <name> does the same job.
  5. Check the result with claude mcp list or claude mcp get <name>. A healthy server shows Connected.

Check that it worked

Run claude mcp list and look for Connected next to your server name. If the status is Needs authentication, finish the OAuth step in step 4. If it is Failed to connect, run claude mcp get <name> to read the stored URL or command and fix that value before adding again.

Pitfalls

  • Server flags land in the wrong place. Without the -- separator, flags such as --port that belong to the server are parsed as Claude Code options. Put -- directly before the server command.
  • `--env` is out of position. Put another option, such as --transport stdio, between --env and the server name. Notice this when the server starts without its key.
  • Project servers stay pending. A project-scoped server from .mcp.json shows Pending approval until you approve it in an interactive session. Run claude mcp reset-project-choices if an earlier choice needs to be undone.
  • Scripted runs cannot finish OAuth. claude -p and Agent SDK runs cannot complete the browser flow. Sign in from an interactive session first, then run the script.
  • Removing a server keeps its tokens at the provider. claude mcp remove deletes the local OAuth tokens but does not revoke them. Run claude mcp logout <name> before removing if you want the access revoked.

When to use a skill instead

Adding a server is a configuration task, and the command above covers it. The harder work starts when you write the server yourself and need to decide its tools, input schemas and error shapes before connecting it. mcp-server-builder is a related skill on this site that reviews a server design for those choices, including the transport decision between stdio and HTTP. Use it before the steps above when the server does not exist yet. For a server someone else already maintains, the command-line steps are enough and no skill is needed.

FAQ

How do I remove an MCP server from Claude Code? Run claude mcp remove <name>. For a remote server with OAuth, run claude mcp logout <name> first so the tokens are revoked at the provider.

Why does Claude Code ask me to approve a server? Servers defined in a project's .mcp.json need your approval in an interactive session before Claude Code uses them. The approval protects you from running a server a teammate committed without your review.

What does "Needs authentication" mean in the list output? The server answered with a 401 or 403 response, so Claude Code treats it as requiring sign-in. Open /mcp in an interactive session and complete the login, or use claude mcp login <name>.

Platform Score is our assessment under a published method. It is not a safety guarantee.

Terms this guide uses

This item is a worked example in the AI glossary for:

Next steps

  1. Claude skills vs MCP vs plugins: what each one is for Read next.
  2. What Is Claude Code and What It Can Touch on Your Machine Read next.
  3. Claude Code compatibility Install evidence per tool.
  4. All guides by topic Browse everything.

Sources

This page is not offered to search engines yet: The content file does not mark this page indexable yet.