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

Canonical: https://cwyn.com/pages/claude-code-guide-mcp-setup.html
Last updated: 2026-11-23T07:34:54-05:00

Claude Code setup guide

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 November 23, 2026

By CWYN · Published Nov 23, 2026 · Commands and config paths as of Nov 22, 2026 · [Anthropic’s MCP reference for local commands such as `claude mcp add <name> -- <command>`](https://code.claude.com/docs/en/mcp)

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.

| Transport | Add command | When to use it |
| --- | --- | --- |
| HTTP | `claude 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. |
| stdio | `claude mcp add [options] <name> -- <command> [args...]` | Use stdio when Claude Code needs to launch a local command to talk to the server. |
| WebSocket | `claude 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.

| Scope | Config file | Who can use the entry |
| --- | --- | --- |
| Local (default) | `~/.claude.json` | Only you, in this project. Use it to try a server before sharing it. |
| Project | `.mcp.json` at the project root | Your team in this repository. Add `--scope project` and commit the file so teammates can review the server. |
| User | `~/.claude.json` | You, 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](https://cwyn.com/pages/claude-code-guide-settings-json-precedence.html).

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](https://cwyn.com/pages/claude-code-guide-mcp-servers-not-loading.html).

## 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

- [All 34 Claude Code guides](https://cwyn.com/guides/claude-code/)
- [Claude Code setup walkthrough](https://cwyn.com/setup/claude-code/)
- [Free setup file checker](https://cwyn.com/score/setup-file-checker/)
- [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html)

### Check your project instructions

[Check your CLAUDE.md with the free setup file checker](https://cwyn.com/score/setup-file-checker/)

## Email me the CLAUDE.md + settings starter

Get the editable CLAUDE.md template and a project setting you can merge into .claude/settings.json.

Email address

Email me this file. Also send up to 4 short follow-up emails with tips and one related CWYN product. Unsubscribe any time. [Privacy policy](https://cwyn.com/pages/privacy.html)

### Plan a shared Claude Code setup

The [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html) includes an MCP decision worksheet and a setup and rollback checklist.

Claude Code Complete Setup Pack $12.95

Set up project instructions, permission rules, hooks, a reviewer skill and subagent, and MCP connections for Claude Code.
