Claude Code MCP: add, scope, authenticate, and debug servers

Claude Code MCP setup as of November 2026: claude mcp commands, local, project, and user scopes, OAuth, secrets, tool permissions, limits, and fixes.

Published
Reading time
14 min read
Level
Intermediate
By
AI for Devs
TL;DR
  • Claude Code MCP setup runs through claude mcp add: --transport http plus a URL for a remote server, or a launch command after -- for a local stdio server.
  • Local scope (the default) and user scope live in ~/.claude.json, and project scope lives in a committed .mcp.json. On a name clash, local beats project beats user, and the winner is used whole.
  • Remote servers sign in with OAuth from /mcp or claude mcp login. A .mcp.json can reference ${VAR}, but Claude Code blanks its own and cloud credentials in remote URLs and headers.
  • Defaults as of November 16, 2026: a 30 second startup timeout, a 25,000 token output cap with a warning at 10,000, backgrounding after 2 minutes, and about 28 hours of wall clock per call.
  • For a team, one entry pointing at an MCP gateway replaces per-server entries, and the gateway applies auth, tool filtering, and logs.

Claude Code MCP support lets the terminal agent call tools from any Model Context Protocol server once the server is registered with claude mcp add or listed in a .mcp.json file. This guide covers using existing servers: commands, scopes, OAuth, secrets, permissions, limits, status checks, serving, gateways, and fixes. Every command and flag was checked against Anthropic's docs and the --help output of Claude Code 2.1.318 on November 16, 2026. To write a server of your own first, build an MCP server covers the code and its registration step.

#Claude Code as an MCP client

Claude Code is an MCP host. For each configured server it opens one MCP client connection, fetches the server's tools, prompts, and resources, and offers each tool to the model under the name mcp__<server>__<tool>. The MCP architecture overview names Claude Code as an example host and says each client keeps a dedicated connection to one server.

People often call the whole application the "MCP client," but in MCP terms the client is the connector inside the host. Claude Code speaks four transports:

TransportHow to add itAuthWhen the connection fails
HTTP (streamable-http)claude mcp add --transport httpOAuth, static headers, or headersHelper3 retries on first connect, 5 reconnects mid-session
SSE, deprecated--transport http falls back to SSE on 2.1.265 and laterOAuth or headersSame as HTTP
Stdioclaude mcp add <name> -- <command>Environment variablesNo automatic retry in an interactive session
WebSocketclaude mcp add-json with "type": "ws"Headers or headersHelper onlyNo first-connect retry, reconnects mid-session

Prefer HTTP for anything remote: Anthropic recommends it, SSE is deprecated, and WebSocket supports neither OAuth nor the --transport flag. Use stdio for tools that need your local files or binaries.

Claude Code 2.1.323 (November 12, 2026) removed the older v1 MCP client, per its changelog. The remaining client speaks protocol revision 2026-07-28 and uses the earlier handshake with older servers.

#Add a server with claude mcp add

Give the server a name of letters, numbers, hyphens, and underscores, choose a transport, and pass a URL or a launch command after --. These commands follow the Claude Code MCP docs and were not run, because they write to your configuration.

Not run here: writes to your Claude Code config
Shell
# Remote HTTP server
claude mcp add --transport http notion https://mcp.notion.com/mcp
 
# Remote server that takes a static token header
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer $GITHUB_PAT"
 
# Local stdio server: everything after -- is the launch command
claude mcp add --env AIRTABLE_API_KEY="$AIRTABLE_API_KEY" --transport stdio airtable \
  -- npx -y airtable-mcp-server
 
# WebSocket server, or any JSON entry copied from another client
claude mcp add-json events '{"type":"ws","url":"wss://mcp.example.com/socket"}'

The docs flag these details:

  • Without --, Claude Code parses the server's own flags, such as --port, as its options.
  • A server name right after --env is read as another KEY=value pair and rejected, so put another option between them.
  • claude mcp add saves the entry without testing credentials, so a bad token appears later as a failed connection.
  • A JSON entry with a url and no type is read as stdio and skipped. Add "type": "http".

The claude mcp subcommands, from claude mcp --help on version 2.1.318 (the newest npm release was 2.1.325 on November 16, 2026):

CommandWhat it does
claude mcp addAdds a stdio, SSE, or HTTP server, with --transport, --scope, --env, --header, and the OAuth flags
claude mcp add-jsonAdds a stdio, SSE, HTTP, or WebSocket server from one JSON entry
claude mcp add-from-claude-desktopImports servers from Claude Desktop, on macOS and WSL only
claude mcp listLists servers and health-checks the approved ones
claude mcp get <name>Shows one server, with an Issue: line when it fails
claude mcp remove <name>Deletes the entry and its locally stored OAuth tokens, without revoking them
claude mcp login <name> / logout <name>Runs or clears a server's OAuth sign-in from the shell
claude mcp reset-project-choicesForgets which .mcp.json servers you approved or rejected
claude mcp serveStarts Claude Code as a stdio MCP server

#Choose a scope: local, project, or user

The scope, set with --scope (or -s), decides which projects load a server and whether teammates get it. Local is the default.

ScopeStored inLoads inShared
Local~/.claude.json, under the current project's pathThat project onlyNo
Project.mcp.json at the repository rootThat projectYes, through version control
User~/.claude.jsonEvery project on your machineNo

When one server is defined in several places, Claude Code connects once, using the highest source: local, then project, then user, then plugin servers, then claude.ai connectors. Fields are never merged, so a local entry with an old URL hides every teammate change to the same name in .mcp.json. Scopes match duplicates by name, while plugins and connectors match by endpoint, ignoring scheme and host case, a default port, and a trailing slash.

Five definitions of a GitHub server: the local entry connects whole, the project and user entries with the same name are skipped, a plugin server with a different endpoint also connects, and a claude.ai connector with the same URL is hiddenSource, highest firstServer entryWhat Claude Code does1 Local~/.claude.json, per projectgithubhttp, api.githubcopilot.com/mcp/, headersConnectswhole entry, nothing merged2 Project.mcp.json in the repogithubhttp, api.githubcopilot.com/mcp/, oauth.scopesNot loadedsame name as row 13 User~/.claude.json, all projectsgithubhttp, ghe.example.com/mcpNot loadedsame name; /mcp warns4 Pluginan enabled plugingh-toolsstdio, ./bin/gh-mcpConnects tooendpoint differs from row 15 Connectoradded at claude.aiGitHubhttp, api.githubcopilot.com/mcp/Hidden in /mcpsame endpoint as row 1Rows 1 to 3 count as duplicates by name. Rows 4 and 5 count as duplicates by URL or command.A server from the managedMcpServers setting ranks above row 1.
Fig. 1One GitHub server defined five ways. Local wins over project and user by name and is used whole. The plugin server points at a different endpoint, so it connects as a second server, and the connector with the same URL is hidden.

Use local scope for personal tokens and experiments, project scope for servers the whole repository needs, and user scope for tools you want everywhere, such as a docs search server. Since 2.1.259, a server an organization provides through the managedMcpServers setting ranks above all three.

An interactive session asks before it connects a .mcp.json server, and claude mcp list shows ⏸ Pending approval until you answer. Approvals committed in the repository's own .claude/settings.json are ignored until you trust the folder. claude -p runs and Agent SDK sessions load project servers without asking, so in CI start with --strict-mcp-config --mcp-config ./ci-mcp.json to load only the servers you pass, or reject one by name with disabledMcpjsonServers in settings.

#Pass environment variables and secrets

--env KEY=value writes the value into the server's entry, which is fine at local scope. In a shared .mcp.json, reference variables instead: Claude Code expands ${VAR} and ${VAR:-default} in command, args, env, url, and headers. Each person sets the variable in their own shell, and /mcp and claude mcp list show the reference by name, never the value.

.mcp.json
JSON
{
  "mcpServers": {
    "sentry": {
      "type": "http",
      "url": "https://mcp.sentry.dev/mcp"
    },
    "internal-api": {
      "type": "http",
      "url": "${INTERNAL_MCP_URL:-https://mcp.internal.example.com}/mcp",
      "headers": { "Authorization": "Bearer ${INTERNAL_MCP_TOKEN}" }
    },
    "db": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub", "--dsn", "${READONLY_DSN}"]
    }
  }
}

Expansion follows these rules:

  • An unset variable with no default loads as the literal text ${VAR}, and claude mcp list warns about it.
  • A variable set to an empty string counts as set, so the default never applies.
  • In a remote server's url and headers, credential variables such as ANTHROPIC_API_KEY, AWS_BEARER_TOKEN_BEDROCK, and NPM_TOKEN read as empty, so a cloned repository cannot send them to a server it names. Copy a value into a variable with your own name if a server needs it.
  • Claude Code sets CLAUDE_PROJECT_DIR only in a stdio server's environment, so a .mcp.json command that uses it needs a default, such as ${CLAUDE_PROJECT_DIR:-.}.

#Generate short-lived headers with headersHelper

A headersHelper is a command that prints the headers Claude Code sends when it connects, which suits tokens that expire within hours. The command must print one JSON object of string values within 10 seconds. Claude Code runs it at each connection and once more after a 401 or 403, and it uses an Authorization header from the helper instead of OAuth.

This one reads a token file and escapes it with jq:

get-mcp-headers.sh
Shell
#!/bin/sh
# headersHelper for Claude Code: print one JSON object of string headers.
# A separate SSO login tool refreshes the token file; this script only reads it.
set -eu
token_file="${ACME_MCP_FILE:-$HOME/.config/acme/mcp-token}"
token=$(cat "$token_file")
jq -cn --arg t "$token" '{Authorization: ("Bearer " + $t)}'

It ran on November 16, 2026 with macOS /bin/sh and jq 1.7.1, against a test token file, in 0.72 seconds of wall time:

Real output
Text
{"Authorization":"Bearer test-only-token.abc123"}

A token with a quote and a backslash came out escaped, and Node's JSON.parse accepted every output. With the file missing, the script printed nothing and exited with code 1; how Claude Code handles that was not tested.

Reference the helper by absolute path, because its working directory depends on the scope. A project or local helper runs only after you accept the folder's trust dialog. Helpers from a project .mcp.json or a plugin also run without environment variables whose names contain TOKEN, SECRET, PASSWORD, KEY, or AUTH. That is why this script reads a file, and why its override variable avoids those words.

.mcp.json
JSON
{
  "mcpServers": {
    "internal-docs": {
      "type": "http",
      "url": "https://mcp.internal.example.com/mcp",
      "headersHelper": "/usr/local/bin/get-mcp-headers.sh"
    }
  }
}

#Authenticate remote servers with OAuth

A remote server that answers 401 or 403 shows as needing authentication. Run /mcp in a session and finish the browser sign-in, or run claude mcp login <name> from your shell. Claude Code stores the tokens and refreshes them. Over SSH, claude mcp login prints the authorization URL instead of opening a browser, and --no-browser forces that behavior.

Not run here: sign-in and pre-registered clients
Shell
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp login sentry --no-browser
 
# Server without dynamic client registration: bring your own OAuth app
claude mcp add --transport http \
  --client-id your-client-id --client-secret --callback-port 8080 \
  my-server https://mcp.example.com/mcp
 
# Revoke at the server first, then delete the entry
claude mcp logout sentry
claude mcp remove sentry

Claude Code registers itself through Dynamic Client Registration or a Client ID Metadata Document when the server supports one. If the server supports neither, create an OAuth app in its developer portal with the redirect URI http://localhost:8080/callback, matching --callback-port. --client-secret prompts with masked input, or reads MCP_CLIENT_SECRET in CI, and works only when you add the server.

To limit a server to approved scopes, pin them. Claude Code requests exactly these, plus offline_access when the server advertises it:

.mcp.json
JSON
{
  "mcpServers": {
    "slack": {
      "type": "http",
      "url": "https://mcp.slack.com/mcp",
      "oauth": { "scopes": "channels:read chat:write search:read" }
    }
  }
}

A configured Authorization header, static or from a helper, replaces OAuth for that server, so a rejected header shows as a failed connection with no sign-in prompt.

#Set permissions for MCP tools

In the default permission mode, Claude Code asks before it runs an MCP tool unless a rule allows it. Rules use the tool's full name: mcp__github__* or mcp__github covers a whole server, and mcp__github__get_issue covers one tool. Characters such as dots in a server name become underscores in the rule.

Allow rules accept wildcards only after a literal mcp__<server>__ prefix, so mcp__github__get_* works and an allow rule of mcp__* is skipped. Deny and ask rules accept any wildcard, and a deny rule of mcp__* hides every MCP tool from the model. This block approves reads, asks before writes, and blocks merges and one server; copy real tool names from /mcp.

.claude/settings.json
JSON
{
  "permissions": {
    "allow": ["mcp__github__get_*", "mcp__github__list_*", "mcp__docs__*"],
    "ask": ["mcp__github__create_*"],
    "deny": ["mcp__github__merge_pull_request", "mcp__postgres__*"]
  }
}

To deny one argument value, such as a database name, pass the rule with --disallowedTools, because settings files skip mcp__ rules with parentheses. A tool its server marks anthropic/requiresUserInteraction prompts on every call, even in bypassPermissions mode. Administrators can go further with managed-mcp.json, managedMcpServers, and the allowedMcpServers and deniedMcpServers lists in the managed MCP docs.

Claude Code caps how much one tool result can put into the context window and how long a call can run. These defaults are from Anthropic's docs as of November 16, 2026; set them as environment variables or in the env block of your settings.

SettingDefaultWhat it controls
MCP_TIMEOUT30,000 msHow long one server may take to start and connect
MCP_TOOL_TIMEOUT100,000,000 ms, about 28 hoursWall clock limit per tool call
"timeout" in a server entryNot setOverrides MCP_TOOL_TIMEOUT for that server; values under 1,000 are ignored
CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT5 min remote, 30 min stdioEnds a call with no response or progress for that long
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS2 minMoves a slow call to a background task in /tasks
MAX_MCP_OUTPUT_TOKENS25,000 tokensLargest result kept in the conversation; a warning appears above 10,000
ENABLE_TOOL_SEARCHOnDefers tool definitions until a task needs them

Text results over 50,000 characters go to a file that Claude reads when needed, whatever MAX_MCP_OUTPUT_TOKENS says, unless the server raises the threshold with anthropic/maxResultSizeChars (up to 500,000). HTTP and SSE responses fail above 16 MiB.

On a log scale: server startup times out at 30 seconds, a main-conversation tool call moves to the background at 2 minutes, an HTTP call fails at 60 seconds without a first byte, idle limits are 5 minutes remote and 30 minutes stdio, and the wall clock limit is about 28 hoursServer startupMCP_TIMEOUT30 s defaultalwaysLoad wait 5 sHTTP or SSE callremote serverbackground at 2 minfirst byte 60 sidle 5 minwall clock 27.8 hStdio calllocal processbackground at 2 minidle 30 minwall clock 27.8 h1 s10 s1 min10 min1 h1 dayconnect windowblocks the sessionbackground tasklimit ends the call
Fig. 2Default limits on a log scale. A main-conversation call blocks the session for 2 minutes, then runs as a background task until the idle or wall clock limit. HTTP and SSE calls also need a first response byte within 60 seconds.

Set a per-server timeout for tools that run long by design, such as a build, instead of raising the global limit. Raise MAX_MCP_OUTPUT_TOKENS only when the model needs the whole result, because every extra token is read again on later turns; server-side pagination is cheaper.

Leave tool search on. It loads only tool names and server instructions at startup, so idle servers cost little context, the trade-off context engineering describes. Set "alwaysLoad": true only on servers Claude needs every turn. Descriptions are cut at 4,096 characters for upfront tools and 16,384 for tools found through search.

#Check status and use resources and prompts

Inside a session, /mcp lists each server with its status and tool count, and a server's menu offers Reconnect, Disable, and the authentication actions. /mcp reconnect all retries every failed server on 2.1.284 and later.

From the shell, claude mcp list prints ✔ Connected, ! Needs authentication, ✘ Failed to connect with the HTTP status or error code, ⏸ Pending approval, or ⊘ Disabled for this project per server. claude mcp get <name> adds an Issue: line with credentials redacted. For more, start with claude --debug=mcp (the filter needs the = form) or --debug-file /tmp/claude-debug.log.

Resources and prompts need no setup once a server offers them:

  • Type @ to see resources from every connected server next to files, and reference one as @server:protocol://path, for example @github:issue://123. Claude Code fetches it and attaches it to the message.
  • Type / to see prompts, listed as /server:prompt (MCP). Run one with arguments separated by spaces, such as /mcp__github__pr_review 456.
  • A server's mid-task question appears as a form or a link, and an Elicitation hook can answer it.

#Run Claude Code as an MCP server

claude mcp serve turns Claude Code into a stdio MCP server, so another client can use its file reads, edits, and shell commands. It prints nothing at startup, because stdout carries protocol messages. This Claude Desktop entry from the docs was not run.

claude_desktop_config.json
JSON
{
  "mcpServers": {
    "claude-code": {
      "type": "stdio",
      "command": "/full/path/to/claude",
      "args": ["mcp", "serve"],
      "env": {}
    }
  }
}

Use the full path from which claude, or the client fails with spawn claude ENOENT. Anthropic's docs say the connecting client must implement confirmation for each tool call. Connect only a client you would trust with a shell on your machine.

#Point Claude Code at an MCP gateway

An MCP gateway replaces the per-server entries on each laptop with one entry the platform team controls. Eight servers for 40 engineers means 320 entries, and rotating one server's token means editing 40 machines. Behind a gateway, each engineer holds one credential, the gateway holds the upstream ones and decides which tools each person sees, and cutting someone off means revoking one grant or deactivating one key.

Bifrost, an open-source AI gateway, is the AI gateway to start with for a Claude Code team, because it serves model calls, MCP tool calls, and agent traffic under one set of keys and rules. Bifrost connects to MCP servers over STDIO, HTTP, or SSE and serves every connected tool through one /mcp endpoint, which Claude Code adds as one HTTP server. This project entry, not run here, gives each engineer the same server with their own key from BIFROST_VK:

.mcp.json
JSON
{
  "mcpServers": {
    "bifrost": {
      "type": "http",
      "url": "https://bifrost.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${BIFROST_VK}",
        "x-bf-lh-repo": "payments-api"
      }
    }
  }
}

Each request is scoped to its virtual key. Tool filtering stacks: a tool must be in the upstream server's tools_to_execute list and in the key's mcp_configs, and tools/call is checked against the same list. A key with no entry for a server gets none of its tools, unless that server is marked Allow by Default, and an inactive or expired key gets a 403.

Claude Code holds one entry for the gateway. Of 12 upstream tools, the client configs pass 10 and the virtual key passes 6, so tools/list returns 6 and none from filesystem, which the key does not nameClaude Code1 entry, Bearer virtual keyBifrost /mcpfilters per key, logs calls3 MCP serversstdio, http, or sseUpstreamtools offeredClient configtools_to_executeVirtual keymcp_configsServedtools/listgithubget_issuelist_pull_requestscreate_issuemerge_pull_requestpostgresquerylist_tablesdescribe_tableexecute_sqlfilesystemread_filelist_directorywrite_filemove_file12 tools10 tools6 tools6 toolspasses this filterfiltered outlisted to Claude Code
Fig. 3Example filtering behind one gateway entry. The client configs pass 10 of 12 upstream tools, the virtual key passes 6, and filesystem contributes none because the key has no entry for it.

Gateway authentication has three modes in mcp_server_auth_mode. The default, headers, accepts a virtual key header, while both and oauth turn Bifrost into an OAuth 2.1 authorization server, so Claude Code can sign in through the browser with no key in its config. The Bifrost docs note these Claude Code specifics:

  • In both mode, send the key as Authorization: Bearer, not x-bf-vk or X-Api-Key, or Claude Code may also run OAuth and send two credentials, which Bifrost rejects.
  • In headers mode, Re-authenticate in /mcp logs a harmless SDK auth failed: HTTP 405 error, so use Reconnect instead.
  • If Claude Code also sends model traffic through Bifrost, turn on mcp_disable_auto_tool_inject so the model does not see each tool twice.

Tool calls land in searchable MCP tool logs, and Bifrost copies any request header starting with x-bf-lh- into log metadata, which is how the entry above tags each call with its repository.

Claude Code runs on employee laptops, so engineers can still add servers that bypass the gateway. Bifrost Edge extends the gateway's governance and security controls to the device: it reads the MCP configuration in apps including Claude Code, builds a fleet-wide inventory, and enforces allow and deny decisions on each machine, so policy also covers servers people add themselves.

#Troubleshooting Claude Code MCP errors

Start every fix with claude mcp get <name> for the failure detail, then /mcp for the live state. The rows below come from Anthropic's error reference and Claude Code MCP docs.

SymptomLikely causeFix
Server missing in another projectAdded at the default local scopeRe-add with --scope user or --scope project
⏸ Pending approval.mcp.json server not yet approvedRun claude in the folder, trust it, and approve; claude mcp reset-project-choices starts over
Teammates' .mcp.json change never appliesA local or user entry with the same name wins wholeclaude mcp remove <name> --scope local
Entry skipped: has a url but no typeJSON copied from another clientAdd "type": "http", "sse", or "ws"
✘ Failed to connect with a 401Bad token, or a credential variable that reads as emptyFix the token, or copy the value into a variable with your own name
spawn ... ENOENT or a stdio server that never startsCommand not on the PATH Claude Code seesUse an absolute path
OAuth callback port ... is already in useAnother process holds the fixed portFind it with lsof -ti:<port> -sTCP:LISTEN, or register another port
Tool listed in /mcp that Claude cannot callFull name over 128 characters, a rejected schema, or a deny ruleShorten the server name, check its log, or remove the rule
connection closed before the tool call was answeredHTTP connection dropped mid-callCheck whether the action happened before asking again
MCP server "<name>" was not savedOther Claude Code processes held ~/.claude.jsonRerun with CLAUDE_CODE_CONFIG_LOCK_WAIT_MS=60000

Stdio servers that exit are not restarted in an interactive session, so use Reconnect in /mcp. The MCP hub and the coding agents hub collect related guides.

What ran for this guide

On November 16, 2026, claude --version and the --help of every claude mcp subcommand ran on Claude Code 2.1.318, the headersHelper script ran against test token files, and Node.js 26.12.1 parsed every JSON block on this page. No command that writes Claude Code configuration ran, no MCP server connected, and no model session used MCP tools. Bifrost and Bifrost Edge were not deployed; the gateway details follow their docs as of that date.

#Questions

How do I add an MCP server to Claude Code?

Run claude mcp add with a name and either a URL or a launch command. A remote server takes --transport http and its URL. A local server takes the command after a double dash, as in claude mcp add airtable -- npx -y airtable-mcp-server. Then run /mcp inside a session or claude mcp get with the name to confirm the server connected, since adding it does not check credentials.

Where does Claude Code store MCP server configuration?

Local and user scope servers live in ~/.claude.json in your home directory. Local entries sit under the current project's path, and user entries load in every project. Project scope servers live in .mcp.json at the repository root, which you commit so the whole team gets them. Organizations can also deploy servers through managed settings or a managed-mcp.json file.

What is the difference between local, project, and user scope in Claude Code?

Local scope is the default and loads a server only for you in one project. Project scope writes the server to a shared .mcp.json file that teammates approve on first use. User scope loads a server for you in every project. When two scopes define the same name, local wins over project and project wins over user, and Claude Code uses the winning entry whole.

Is Claude Code an MCP client or an MCP server?

It is both. In normal use Claude Code is an MCP host that opens one MCP client connection per configured server and calls their tools. With claude mcp serve it also runs as a stdio MCP server that exposes its own tools, such as file reads, edits, and shell commands, to another client like Claude Desktop, which must then handle approvals itself.

Why is my MCP server not showing up in Claude Code?

Check the scope first: a server added at the default local scope appears only in the project where you added it. A .mcp.json server stays at Pending approval until you run claude interactively and approve it. A JSON entry with a url but no type is skipped. Run claude mcp list for each server's status and claude mcp get with its name for the failure detail.

How do I give an MCP server an API key without committing it?

Reference an environment variable in .mcp.json, such as Bearer ${MY_SERVICE_TOKEN} in a header, and set the variable in each person's shell. Claude Code expands it at load time and shows the reference by name in /mcp. Do not reference ANTHROPIC_API_KEY or cloud provider credentials, because Claude Code reads those as empty in remote URLs and headers.

Does Claude Code support remote MCP servers with OAuth?

Yes. Add the server with --transport http, then run /mcp in a session or claude mcp login with its name in your shell to finish the browser sign-in. Claude Code stores and refreshes the tokens. Servers without dynamic client registration need --client-id, --client-secret, and usually --callback-port to match a pre-registered redirect URI. WebSocket servers support headers only, not OAuth.