Skip to content

Blogclaude-code

Claude Code MCP servers: add one and check it first

How to add Claude Code MCP servers over HTTP, SSE, stdio or WebSocket, which scope to store them in, and what to check before you trust one.

3hship6 min read

Share

A small block joined by three cables to three plug modules, one enclosed in a glass dome and glowing violet.
Contents

Claude Code MCP servers are added with one command, claude mcp add, and HTTP is the recommended transport for remote servers. Before you connect any of them, check that you trust it, because servers that fetch external content can expose you to prompt injection risk.

This guide covers the four ways to add a server, how to convert setup instructions written for another client, the scope a server lives in, the limits that apply, and a short trust check. The reference for every flag is the Claude Code MCP page.

1. Decide if you need a server at all

When should you connect one? When you find yourself copying data into chat from another tool, like an issue tracker or a monitoring dashboard. Once connected, Claude can read and act on that system directly instead of working from what you paste.

If you only paste something once, a server is more setup than it saves. If you paste the same kind of data every day, connect it.

2. Pick the transport

The transport is how Claude Code talks to the server. The source describes four.

Transport Where the server runs Use it when
HTTP Remote The default choice for cloud services
SSE Remote The service exposes only an SSE endpoint; it is deprecated
stdio Your machine The tool needs direct system access or custom scripts
WebSocket Remote The server pushes events to Claude unprompted

Two limits matter. The SSE transport is deprecated, so prefer HTTP where the service offers it. And HTTP supports OAuth and the add command’s transport flag, while WebSocket supports neither, so use WebSocket only when you need pushed events.

3. Add the server

Run the command that matches the transport. These come from the reference, with a placeholder token and key.

Terminal window
# Remote HTTP server (Notion example from the docs)
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Remote HTTP server that needs a bearer token
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer your-token"
# Local stdio server; everything after the double dash runs the server
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-server

For stdio, the double dash separates Claude’s own options from the command and arguments that run the server. Without it, Claude Code would parse the server’s flags as its own. Also, place at least one other option, such as the transport flag, between the env flag and the server name, or the CLI reads the name as another key-value pair and rejects it.

For SSE, the same HTTP command usually works: Claude Code tries the HTTP transport first and switches to SSE when the server doesn’t accept it. The automatic switch requires Claude Code v2.1.265 or later. On an earlier version, pass the SSE transport flag directly.

WebSocket has no flag. The add command’s transport flag doesn’t accept ws, so configure it with claude mcp add-json:

Terminal window
claude mcp add-json events-server \
'{"type":"ws","url":"wss://mcp.example.com/socket","headers":{"Authorization":"Bearer YOUR_TOKEN"}}'

4. Convert setup instructions written for another client

Many servers document setup for Claude Desktop or Cursor and give no Claude Code command. Look for one of three things in those instructions:

You find The server is Do this
A URL Remote Add it with the HTTP transport, or the WebSocket route for a wss:// address
A launch command such as npx -y @example/mcp-server On your machine Put the whole command after the double dash
A JSON block under mcpServers Either Pass claude mcp add-json the object inside it, not the wrapper

For the launch-command case, add-json takes the same command and arguments as an object:

Terminal window
claude mcp add-json example '{"command":"npx","args":["-y","@example/mcp-server"]}'

Two JSON entries need a repair first. A url with no type fails, because Claude Code reads an entry with no type as a stdio server, so add the type that matches the endpoint. And a key with characters other than letters, numbers, hyphens, and underscores needs a different server name.

5. Choose the scope

The scope decides who gets the server. Each add command writes to local scope unless you add the project or user scope flag.

Scope Loads in Shared with team Stored in
Local Current project only No ~/.claude.json
Project Current project only Yes, through version control .mcp.json in the project root
User All your projects No ~/.claude.json

To share a server with your team, add the project scope flag, or add the entry under the servers key in the project-root .mcp.json and commit it. A committed file is the right place for shared servers, and a personal token is not. Reference the token by name instead, with ${VAR} or ${VAR:-default} in the url, headers, env, command or args value:

{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
}
}
}

When the same server is defined in more than one place, Claude Code connects once and uses the whole entry from the highest source. Fields are not merged across scopes.

Precedence Source
1 (highest) Local scope
2 Project scope
3 User scope
4 Plugin-provided servers
5 (lowest) claude.ai connectors

Project-file servers also pass through an approval step. The reference covers how Claude Code loads and approves that file, so read it before committing one for a team.

6. Check that it connected

A successful add prints an Added ... line, but that only means the configuration was written. Confirm the connection itself.

Terminal window
# List every configured server with its health status
claude mcp list
# Details for one server
claude mcp get notion
# Remove a server
claude mcp remove notion

Inside a session, /mcp shows server status. The list shows a health status next to each server, such as Connected or Needs authentication. A server that needs authentication is not broken. It is waiting for you to sign in.

Removing is clean for remote servers: Claude Code also deletes the OAuth tokens and client registration it stored for that server.

7. Know the limits

Output size and timing are where a working server still surprises people. These are the figures the reference gives.

Limit Value
Tool output warning Over 10,000 tokens
Tool output cap 25,000 tokens by default
Text result saved to a file Over 50,000 characters
Startup timeout Set with MCP_TIMEOUT; MCP_TIMEOUT=10000 is 10 seconds
Per-server timeout field Milliseconds; values below 1000 are ignored
Idle window 5 minutes for HTTP, SSE and WebSocket, 30 minutes for stdio
Reconnects after a drop Up to 5, starting at a 1-second delay and doubling
First-connection retries Up to 3 for HTTP and SSE

The warning threshold is fixed, so a server that returns large results needs a narrower query, not a setting. Big tool results spend quota quickly; Claude Code usage limits covers what burns it.

8. Vet the server before you trust it

A connected server can feed content straight into your session, so run through this list first.

Check What to look at
Source Reviewed connectors are listed in the Anthropic Directory, and any remote server there can be added with claude mcp add. A server outside it has had no such review.
External content If the server fetches web pages, messages or tickets, that content can carry instructions. This is the prompt injection risk the docs name.
Credentials A stdio server gets whatever you pass with --env, and a remote one gets your header. Give each only the key it needs.
Pushed events An MCP server can also act as a channel that pushes messages into your session, so Claude reacts while you’re away. Connect those only when you trust every sender.

If you keep skills next to your servers, sharing one skills repo between Claude Code and Codex shows how to avoid copies.

9. Repeat it for each server

For every new server: pick the transport, add it with the matching command, choose local, user or project scope, confirm the status with claude mcp list, then run the trust list. Remove it with claude mcp remove when you stop using it.

Verdict

Add remote services over HTTP, keep personal tokens in local or user scope, and commit only shared servers to the project file. Treat a successful Added line as a written config, not a working server, and check the status before relying on it. Trust a server only after you know where it comes from and what content it pulls in.

Read the full reference: Claude Code MCP documentation

Sources:Claude Code docs: Connect Claude Code to tools via MCP.

Responses

Sign in to write a response

Keep reading