Claude Code setup guide

How to add an MCP server in Claude Code and find its config file

For a remote MCP server in Claude Code, run claude mcp add --transport http <name> <url>. For a local process, run claude mcp add <name> -- <command>. Add --scope project before the name to write .mcp.json at the project root for your team. Check the connection with claude mcp list.

Last updated

By CWYN · Published · Commands and config paths as of · Anthropic’s MCP reference for local commands such as claude mcp add <name> -- <command>

MCP (Model Context Protocol) is an open standard for connecting Claude Code to tools, databases and APIs. Verify that you trust the server before connecting it. A server that fetches external content can expose Claude Code to prompt injection through instructions embedded in that content.

1. Pick a transport

Start with what the provider gives you. A URL usually points to a running service. A command such as npx tells Claude Code how to start a process on your machine.

TransportAdd commandWhen to use it
HTTPclaude mcp add --transport http <name> <url>Use HTTP for a remote MCP endpoint. It is the recommended remote transport.
SSE (deprecated)claude mcp add --transport sse <name> <url>Use this for an SSE-only endpoint on versions earlier than v2.1.265. From v2.1.265, the HTTP command automatically falls back to SSE.
stdioclaude mcp add [options] <name> -- <command> [args...]Use stdio when Claude Code needs to launch a local command to talk to the server.
WebSocketclaude mcp add-json events-server '{"type":"ws","url":"wss://mcp.example.com/socket"}'Use a JSON entry for a WebSocket URL. Claude Code accepts ws only as a JSON type, through add-json or .mcp.json.

2. Pick a scope and find the config file

The Claude Code MCP config file is ~/.claude.json for local and user scope. For project scope, it is .mcp.json at the project root. Both claude mcp add and claude mcp add-json default to local scope.

ScopeConfig fileWho can use the entry
Local (default)~/.claude.jsonOnly you, in this project. Use it to try a server before sharing it.
Project.mcp.json at the project rootYour team in this repository. Add --scope project and commit the file so teammates can review the server.
User~/.claude.jsonYou, across your projects. Add --scope user for a personal tool you use in several repositories.

For example, run this from the project root to share the Notion endpoint. Review the resulting .mcp.json before committing it. Keep credentials out of the shared file.

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

3. Convert setup instructions from another client

The provider gives you a URL

Give the endpoint a name and pass the URL to the HTTP command. For a private Notion entry in the current project, run this in your terminal.

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

If your provider requires a bearer token, put --header "Authorization: Bearer your-token" before --transport http and replace the token placeholder.

The provider gives you an npx command

Keep the command and its arguments together after --. For the Airtable example, replace YOUR_KEY with your API key.

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

Everything after -- goes to the server unchanged. Without that separator, Claude Code tries to parse server flags such as --port itself. Keep --transport stdio between the environment assignment and the server name. If the name immediately follows --env and its value, the CLI reads the name as another KEY=value pair and rejects it. Claude Code also sets CLAUDE_PROJECT_DIR in the server’s environment.

The provider gives you an mcpServers JSON block

Claude Desktop or Cursor instructions may give you a whole config file. The same outer mcpServers object belongs in a shared .mcp.json. Here is the full file for the Notion example.

{
  "mcpServers": {
    "notion": {
      "type": "http",
      "url": "https://mcp.notion.com/mcp"
    }
  }
}

To import it with the CLI, use the entry key as the server name and pass only the object inside that key to add-json. Server names can contain letters, numbers, hyphens and underscores.

claude mcp add-json notion '{"type":"http","url":"https://mcp.notion.com/mcp"}'

If a remote entry omits type, Claude Code reads it as stdio and skips it. The warning names the affected server.

MCP server "notion" has a "url" but no "type"; add "type": "http" (or "sse" / "ws") to this entry

Add "type": "http" in the object that contains the URL, as shown above. Claude Code also accepts streamable-http as an alias for http.

4. Verify and manage the connection

A successful add prints an Added ... line. Run claude mcp list in the project directory and look for the server name.

  • ✔ Connected. Open /mcp inside your Claude Code session and select the server to see its tools.
  • ! Needs authentication. Open /mcp, select the server and follow its sign-in flow.
  • ✘ Failed to connect. Run claude mcp get <name> to inspect the entry and its connection details.
  • ⏸ Pending approval (run claude to approve). Run claude in the repository and review the project server’s command or URL before approving it.

A cloned repository cannot approve its own servers. Claude Code ignores enableAllProjectMcpServers and enabledMcpjsonServers committed in .claude/settings.json until you trust the workspace. A disabledMcpjsonServers entry in any settings file rejects the named server. See which Claude Code settings file applies.

If you sign in with a claude.ai account, connectors you have added at claude.ai/customize/connectors appear automatically in /mcp.

To disconnect, run claude mcp logout <name> first if you want to revoke tokens on a server that supports revocation. Then run claude mcp remove <name> to delete the entry. Removing the entry alone deletes stored tokens locally.

Still not loading? Troubleshoot a missing MCP server or tool in Claude Code.

5. Claude Code MCP setup FAQ

Where is the Claude Code MCP config file?

Look in ~/.claude.json for a server you added for yourself. Local entries apply to the project where you added them, and user entries apply across projects. Shared entries live in .mcp.json at the repository root.

How do I share an MCP server with my team?

Run the add command with --scope project and commit the resulting .mcp.json. Each teammate can review and approve the server when they open Claude Code in the repository.

Why does my .mcp.json server say “Pending approval”?

Claude Code is waiting for you to approve a server defined by the repository. Run claude in that workspace, review the command or endpoint, and approve it if you trust it. Then check claude mcp list again.

Why does an MCP server with a url fail to load?

A JSON entry with a url but no type is interpreted as stdio and skipped. Set "type": "http" for HTTP, "type": "sse" for SSE or "type": "ws" for WebSocket in the same object as the URL.

Next steps

Check your project instructions

Check your CLAUDE.md with the free setup file checker

Plan a shared Claude Code setup

The Claude Code Complete Setup Pack ($12.95) includes an MCP decision worksheet and a setup and rollback checklist.