How to add an MCP server to Claude Code

Last updated

Add an MCP server to Claude Code with claude mcp add. For a remote server, run claude mcp add --transport http <name> <url>. For a local program, run claude mcp add <name> -- <command>. Then start a new session, and use /mcp to sign in if the server asks you to.

Add a remote server (HTTP)

Most hosted MCP servers use HTTP, also called Streamable HTTP:

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

If the server takes a fixed token instead of a sign-in, pass it as a header:

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

SSE servers still work, but Claude Code's documentation calls SSE deprecated. Use HTTP where a server offers it.

Add a local server (stdio)

A local server is a program Claude Code starts on your computer. Put Claude Code's own options first, then --, then the command that starts the server:

claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server

Everything after -- goes to the server unchanged. Because --env accepts several values, don't put the server's name straight after it: Claude Code would read the name as another value.

Choose a scope

The scope decides where the server is available and who else gets it:

A server you add without --scope user is missing in other folders. Add it again there, or add it with --scope user.

Share a server with your team (.mcp.json)

claude mcp add --scope project writes a file like this to the project. Commit it to share the server:

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

Each person still signs in with their own account. The file can use environment variables such as ${API_KEY}, so no one commits a secret.

Sign in with /mcp

Many remote servers use OAuth sign-in instead of a token. After adding one, start Claude Code, type /mcp, choose the server and choose Authenticate. A browser page opens; sign in there. Claude Code keeps the sign-in and refreshes it on its own.

Claude Code also has a claude mcp login <name> command. For Memlo, use /mcp: in Claude Code 2.1.281, claude mcp login stopped after the sign-in page with "Existing OAuth client information is required when exchanging an authorization code".

Check, list and remove servers

Other ways to add servers

When a server doesn't work

  1. Restart the session. Claude Code loads servers when a session starts. Type /exit and start Claude Code again.
  2. Check the URL. It must be the server's full MCP address. For Memlo that is https://memlo.ai/mcp, ending in /mcp.
  3. Check sign-in. claude mcp get <name> should say Connected. If it says "Needs authentication", sign in with /mcp.
  4. Check the scope. If the server works in one folder and not another, it was added with the local scope.
  5. Slow to start. For a local server that takes a while, raise the startup timeout, for example MCP_TIMEOUT=10000 claude for 10 seconds.
  6. Large results. Claude Code warns when a tool's answer is over 10,000 tokens and caps it at 25,000 by default. Change the cap with MAX_MCP_OUTPUT_TOKENS.

Example: add a memory server

A memory server gives Claude Code notes that last between sessions. To add Memlo for every project:

claude mcp add --transport http --scope user memlo https://memlo.ai/mcp

Then sign in with /mcp and start a new session. Full steps, including a hook that loads memory when each session starts: How to give Claude Code memory between sessions.

Frequently asked questions

Where does Claude Code store MCP servers?

Servers with the local or user scope are in ~/.claude.json. Servers with the project scope are in .mcp.json at the root of the project.

Do I need to restart Claude Code after adding an MCP server?

Yes. Claude Code loads MCP servers when a session starts. End the session with /exit and start a new one.

What is the difference between http and sse?

Both are ways to reach a remote server. HTTP (Streamable HTTP) is the current one; SSE is the older one and is deprecated in Claude Code. If a server offers both, use HTTP.

How do I add an MCP server for all projects?

Add --scope user, for example claude mcp add --transport http --scope user <name> <url>.

How do I add the same server to Codex?

Use codex mcp add <name> --url <url> for a remote server, or codex mcp add <name> -- <command> for a local one. Codex keeps servers in ~/.codex/config.toml. See how to give Codex memory between sessions.

Sources

Checked on October 30, 2026:

Try Memlo

Memlo is invitation only for now. Join the waitlist and we'll email you when your invitation is ready.

Join the waitlist