Connect a remote MCP server to Claude Code and the API

Day 2, 25 minutes · advanced

Goal of this lessonAdd Romy's remote MCP server to Claude Code with one command, use its tool, and plan what the Claude API MCP connector needs to reach it.

Why it matters

A remote server is only useful when an AI application connects to it. For a stdio server, the host needs the command that starts it. For a remote server, it only needs the address. That makes adding one much simpler, and it is how hosted services such as company tools are usually connected.

Today Romy's HTTP server from lesson 1 meets two clients. First Claude Code, which connects to it with one command and calls its tools. Then the Claude API's MCP connector, which lets your own code use remote MCP tools without writing an MCP client. You will see why the connector cannot reach Romy's server yet. At the end Claude Code has answered a stock question from your remote server, and you have a plan for what the connector needs.

The words you need today

  • claude mcp add --transport http: the Claude Code command for a remote server. You give it a name and the address of the MCP endpoint.
  • MCP connector: a feature of the Claude API that connects to remote MCP servers for you, inside a normal Messages API request.
  • Beta header: an extra request header that switches on a feature that is still in beta. The connector needs one.
  • authorization_token: the field where your code passes an OAuth access token to the connector. Lesson 3 explains tokens.

Remote servers in Claude Code

The Claude Code MCP page calls HTTP servers "the recommended option for connecting to remote MCP servers". The shape is claude mcp add --transport http <name> <url>. No -- and no start command: the server already runs, Claude Code only connects. The scopes from the beginners course still apply. The default is local, so the server only shows up in this folder.

A few things from the same page are worth knowing:

  • In a JSON config, such as .mcp.json, a remote server needs "type": "http". The type streamable-http is accepted as another name for it. An entry with a url but no type is an error, because Claude Code then reads it as a stdio server.
  • claude mcp list shows ✔ Connected, ! Needs authentication or ✘ Failed to connect. A failure means Claude Code could not reach the server, not that the list command failed.
  • Claude Code has two client runtimes and picks one itself. The newer one asks servers whether they support protocol version 2026-07-28 and uses it with those that do.
  • A server that answers 401 Unauthorized is marked as needing authentication, and you sign in from /mcp or with claude mcp login <name>. Lesson 3 builds such a server.

Remote servers from the Claude API

When you write your own program with the Claude API, the MCP connector can call remote MCP tools for you. You add two things to a normal Messages API request, as the connector page shows:

  1. An mcp_servers list. Each entry has type (always url), the url of the server, a unique name, and optionally an authorization_token.
  2. A tools entry of type mcp_toolset with the same server name. It can turn all tools on, or only some, with default_config and configs.

The request also needs the beta header anthropic-beta: mcp-client-2025-11-20 (or the newer mcp-client-2026-09-15). This fragment shows the shape. It is not something to run today: Romy has no public server and you need an API key for it.

{
  "mcp_servers": [
    {
      "type": "url",
      "url": "https://example-server.modelcontextprotocol.io/sse",
      "name": "example-mcp",
      "authorization_token": "YOUR_TOKEN"
    }
  ],
  "tools": [
    { "type": "mcp_toolset", "mcp_server_name": "example-mcp" }
  ]
}

Why the connector cannot reach Romy yet

The connector page lists three limits that matter here:

  • Only tool calls are supported, not resources or prompts.
  • The server must be publicly exposed through HTTP, and the url must start with https://. The server has to be reachable from the internet, so http://localhost:8000/mcp, which only exists on your own computer, cannot work.
  • For a server that needs OAuth, your own code gets and refreshes the access token and passes it in authorization_token.

So the path to the connector runs through a real host name with HTTPS and an authorization server, which is exactly what lessons 3 and 6 prepare. Do not open your laptop to the internet to try it: lesson 6 shows what can go wrong.

The steps

  1. Check that Romy's HTTP server is running.
  2. Add it to Claude Code with one command.
  3. Check the status with claude mcp list.
  4. Ask a stock question and watch the requests arrive at the server.
  5. Remove the server again, so it does not fail in later sessions.
  6. Write down what the connector would need.

Follow the steps below.

Today's actions

Ticks are not saved without an account

Do it in Claude API

Claude API

  1. Make sure quillfeather_remote.py from lesson 1 is running in its own terminal. If not, start it again.
    uv run quillfeather_remote.py
  2. In a second terminal in the quillfeather folder, add the server. It prints Added HTTP MCP server quillfeather-remote and the file it changed. The scope is local: only you, only this folder.
    claude mcp add --transport http quillfeather-remote http://localhost:8000/mcp
  3. Check the status. You should see quillfeather-remote: http://localhost:8000/mcp (HTTP) - ✔ Connected. If you see Failed to connect, check that the server terminal still runs.
    claude mcp list
  4. Ask a stock question that only Romy's server can answer. This one-shot command allows only the stock tool. Watch the POST /mcp lines appear in the server terminal.
    claude -p "Use the quillfeather-remote server to check whether Moby Dick is in stock. Answer in one sentence." --allowedTools "mcp__quillfeather-remote__check_stock"
  5. You can ask the same question in a normal session too: start claude, ask it, and approve the tool call when Claude Code asks.
  6. Remove the server when you are done, so it does not fail to connect in later sessions when the server is off.
    claude mcp remove quillfeather-remote
  7. In mcp-notes.txt, write what the Claude API MCP connector would need for Romy's server: a public https:// address, a name, a token if the server asks for one, and which tools to enable.

Note: Run claude mcp add in your normal terminal, not inside a Claude Code session. If the answer does not mention the server, check claude mcp list first.

Paid planClaude Code needs a Pro, Max, Ultra, Team or Enterprise plan or a Console account. The free claude.ai plan is not on that list.

Checked on 4 December 2026 · Source: Claude Code docs: Connect Claude Code to tools via MCP (opens in a new tab)

Create a free account to save your progress. Sign in or sign up