When adding a remote MCP server to Claude Code, how do you choose between the http, sse and ws transports?
answer
- one recommended, one deprecated, one hidden
- a CLI flag that accepts only some
- automatic fallback from the recommended one
- a url with no type is misread
- WebSocket lives only in JSON
basics
~20 sUse http, the recommended transport. SSE is deprecated; since 2.1.265 an http add falls back to SSE automatically. WebSocket (ws) is configured only through .mcp.json or claude mcp add-json, authenticates with headers only, and never with OAuth.
solid answer
~40 s`http` (Streamable HTTP) is the recommended transport for remote servers: `claude mcp add --transport http tracker https://tracker.example.com/mcp`. In JSON, `type` also accepts `streamable-http` as an alias. `sse` is deprecated; since Claude Code 2.1.265, `--transport http` tries HTTP first and switches to SSE when the server doesn't accept it, so `--transport sse` is only for older versions or to force SSE. `ws` suits servers that push events unprompted, but `--transport` doesn't accept it: write a `"type": "ws"` entry in `.mcp.json` or pass it to `claude mcp add-json`, and authenticate with `headers` or `headersHelper`, since WebSocket supports no OAuth. One JSON trap: an entry with a `url` but no `type` is read as stdio and skipped with an error telling you to add a `type`.
code
bash · 10 lines# Recommended: Streamable HTTP (falls back to SSE on 2.1.265+)
claude mcp add --transport http tracker https://tracker.example.com/mcp
# Force the deprecated SSE transport
claude mcp add --transport sse legacy-tracker https://legacy.example.com/sse
# WebSocket: JSON only, header authentication only
claude mcp add-json events \
'{"type":"ws","url":"wss://events.example.com/socket","headers":{"Authorization":"Bearer YOUR_TOKEN"}}'
claude mcp get eventsgo deeper
Remember that http is the recommended remote transport and that sse is deprecated.
Explain the automatic SSE fallback from 2.1.265, why ws needs add-json or .mcp.json, and that an entry with a url but no type is read as stdio.
Choose by what the server does and how it authenticates: OAuth needs http or sse, push-heavy servers may justify ws with header or helper auth, and verify with get or /mcp.
Decide which transports a team allows in shared configuration, weighing OAuth support and observability in claude mcp list against a server's need to push events.
## Remote versus local A **remote** MCP server is a service Claude Code reaches over the network by URL, as opposed to a **stdio** server it starts as a local process. For remote servers there are three transports to choose from, and the choice decides which commands you can use and how the server authenticates. The wire rules of each transport belong to the MCP protocol material; this answer is about choosing and configuring one in Claude Code. ## The three remote transports | Transport | Status | How you add it | Authentication | |---|---|---|---| | `http` | Recommended | `claude mcp add --transport http <name> <url>`, `.mcp.json`, `claude mcp add-json` | OAuth through `/mcp`, static `--header`, or `headersHelper` | | `sse` | Deprecated | `--transport sse`, or automatic fallback from `http` | OAuth, `--header`, or `headersHelper` | | `ws` | Supported | Only `.mcp.json` or `claude mcp add-json` | `headers` or `headersHelper` only | ### `http` **HTTP** is the most widely supported transport for cloud services and the default choice. When you configure it in JSON (`.mcp.json`, `~/.claude.json`, or `claude mcp add-json`), the `type` field accepts `streamable-http` as an alias for `http`, so configuration copied from a server's documentation, which uses the specification's name, works unchanged. ### `sse` **SSE** (Server-Sent Events) is deprecated. Some services still expose only an SSE endpoint. Since Claude Code **2.1.265**, `claude mcp add --transport http` tries HTTP first and switches to SSE when the server doesn't accept HTTP, so the same command covers both. On an earlier version, or to connect over SSE directly, pass `--transport sse`. ### `ws` **WebSocket** holds a persistent bidirectional connection, which suits servers that push events to Claude without being asked. Its limits: - The `--transport` flag does not accept `ws`; configure it in `.mcp.json` or with `claude mcp add-json`. - It supports no OAuth: pass a static token in `headers` or mint one at connect time with `headersHelper`. - A `ws` entry accepts the same `url`, `headers`, `headersHelper`, `timeout` and `alwaysLoad` fields as `http`. - WebSocket servers don't appear in `claude mcp list`; check them with `claude mcp get <name>` or `/mcp`. If your server only responds to requests, prefer `http`: it gets OAuth and the CLI flag. ## Turning other clients' instructions into a command Server documentation is often written for another MCP client. Read it for the shape it gives you: 1. An `https://` URL — add it with `--transport http` (or `sse` if the instructions say the endpoint is SSE). 2. A `wss://` URL — use a `ws` entry through `claude mcp add-json`. 3. An `mcpServers` JSON block — pass the object inside the wrapper to `claude mcp add-json`, after adding a `type` to any entry that has only a `url`. ## The missing-`type` trap Claude Code reads a JSON entry with **no `type`** as a stdio server. So an entry with a `url` but no `type` is a configuration error: Claude Code skips that server and reports that it has a `url` but no `type`, telling you to add `"type": "http"` (or `sse` / `ws`). Before 2.1.202 the same mistake surfaced as a confusing `command: expected string, received undefined`. Entries copied from other clients' configs often omit `type`, so this is the first thing to check when a pasted server never loads. ## Checking the result - `claude mcp list` shows a health status such as `✔ Connected`, `! Needs authentication` or `✘ Failed to connect`, with the HTTP status and server error text appended to a failure. - An HTTP `404` usually means the URL's path is not the server's MCP endpoint path. - `/mcp` inside a session shows status, tool counts and sign-in actions. ## Common mistakes - Reaching for `--transport sse` by habit when `http` is recommended and falls back on its own. - Typing `--transport ws`, which the CLI rejects. - Expecting `/mcp` OAuth sign-in to work for a WebSocket server. - Pasting a `url`-only entry from another client's config.
- A server's docs give a JSON block with `"url"` and no `type`. What happens if you paste it into `.mcp.json` as is?Claude Code reads an entry without `type` as stdio, so it skips the server and reports that the entry has a `url` but no `type`. Add `"type": "http"` (or `sse` or `ws`, matching the endpoint) and it loads.
- Your WebSocket server is missing from `claude mcp list`. Is it broken?Not necessarily: WebSocket servers don't appear in `claude mcp list` output at all. Check it with `claude mcp get <name>` or in the `/mcp` panel, which show its status.
- SSE is the safest choice for any remote server
- claude mcp add --transport ws adds a WebSocket server
- A WebSocket server can sign in through /mcp OAuth
- A JSON entry with a url is treated as http by default
- An SSE-only server always needs --transport sse on current versions
Assumes Claude Code 2.1.286; the automatic HTTP-to-SSE fallback needs 2.1.265 or later, and the clear missing-type error 2.1.202 or later.