Run a remote MCP server over Streamable HTTP

Day 1, 25 minutes · advanced

Goal of this lessonMove Romy's MCP server from stdio to Streamable HTTP on localhost and call its tools over HTTP with the MCP Inspector CLI.

Why it matters

Romy's server from the beginners course runs over stdio. The host starts it as a program on the same computer, so only that one computer can use it. That is fine for Romy at her own desk. But her shop assistant on another laptop cannot reach it, and neither can a web app or the Claude API. For that, a server has to speak HTTP: the same language web pages use.

The good news is that the tools do not change. In this lesson you move Romy's server to the Streamable HTTP transport by changing one line, run it on your own computer, and call its tools over HTTP with the MCP Inspector. At the end you have quillfeather_remote.py running on a local web address and you know what changed on the wire.

Before you start

This course continues MCP for beginners. You need the quillfeather folder from that course with quillfeather.py, uv and Node.js. Everything in this course runs on your own computer. You need no API key and no credits. Claude Code comes back in lesson 2 and needs its own plan.

The words you need today

  • Remote server: an MCP server that clients reach over the network instead of starting it themselves.
  • Streamable HTTP: the MCP transport for remote servers. The older HTTP+SSE transport is deprecated; do not build on it.
  • MCP endpoint: the one web address of the server, by default ending in /mcp.
  • Localhost (127.0.0.1): the address that means "this computer". Nothing outside your computer can reach it.
  • Port: a number that picks one program on a computer. Romy's server listens on port 8000.
  • SSE (Server-Sent Events): a way for a server to send several messages back on one HTTP response.

How Streamable HTTP works

The Streamable HTTP page of the MCP specification describes it in a few rules:

  • The server has a single MCP endpoint that accepts POST, such as https://example.com/mcp.
  • The client sends every JSON-RPC request as its own HTTP POST, with an Accept header that lists both application/json and text/event-stream.
  • The server answers each request with one JSON object, or with an SSE stream that carries notifications first and the final response last.
  • In the current version, 2026-07-28, every POST also carries headers that copy parts of the body, such as MCP-Protocol-Version, Mcp-Method and Mcp-Name. The server must reject a request when a header and the body disagree.

The Python SDK does all of this for you. Its "Running your server" page says one call to mcp.run() with the transport streamable-http builds a small web app and serves it. The defaults are host 127.0.0.1, port 8000 and path /mcp.

Two protocol eras

The 2026-07-28 version of MCP changed how a connection starts. Older versions open with an initialize handshake and can keep a session. The 2026-07-28 version drops both: a client can start with one server/discover call, and every request carries its own version and capabilities. The Python SDK serves both eras from the same code.

Era How a connection starts Inspector setting
Legacy (2025-11-25 and older) initialize handshake legacy, the default
Modern (2026-07-28) server/discover call, no handshake --protocol-era modern

The Inspector page explains why legacy is its default: a debugging tool should not probe on its own. So you will see both versions today, from the same server.

Why only localhost

The specification asks local HTTP servers to bind only to 127.0.0.1, not to all network interfaces (0.0.0.0), and to check the Origin header. Without that, a web page you visit could use DNS rebinding to talk to a server on your computer. DNS rebinding means a web address that first points to the internet and then suddenly points to your own machine. That is why every exercise in this course stays on localhost. Lesson 6 tests the check.

One more change from stdio: the MCP build guide says printing to standard output is fine for HTTP servers, because it no longer shares a channel with the protocol messages. Romy's logging keeps working as before.

The steps

  1. Copy the server file, so the stdio version keeps working.
  2. Change the last line to start the server on Streamable HTTP, on 127.0.0.1 port 8000.
  3. Start the server in its own terminal and leave it running.
  4. List and call the tools over HTTP from a second terminal.
  5. Compare the two protocol eras and note what the server reports.

Follow the steps below.

Today's actions

Ticks are not saved without an account

Do it in Claude API

Claude API

  1. Open a terminal in your quillfeather folder from the beginners course. Copy the server file, so the stdio version keeps working. The command works in PowerShell, macOS and Linux.
    cp quillfeather.py quillfeather_remote.py
  2. Open quillfeather_remote.py and replace the last line, mcp.run(transport="stdio"), with this line. Keep the four spaces in front.
        mcp.run(transport="streamable-http", host="127.0.0.1", port=8000)
  3. Start the server and leave this terminal open. You should see Uvicorn running on http://127.0.0.1:8000. Stop it later with Ctrl+C.
    uv run quillfeather_remote.py
  4. Open a second terminal in the same folder and list the tools over HTTP. You should see check_stock and add_to_wishlist, as in the beginners course.
    npx @modelcontextprotocol/inspector --cli http://localhost:8000/mcp --transport http --method tools/list
  5. Call a tool. The result says Jane Eyre has 2 copies. In the server terminal, every request shows up as a POST /mcp line.
    npx @modelcontextprotocol/inspector --cli http://localhost:8000/mcp --transport http --method tools/call --tool-name check_stock --tool-arg "title=Jane Eyre"
  6. Ask the server how it connected, first in the default legacy era, then in the modern era. Compare protocolVersion in the two answers.
    npx @modelcontextprotocol/inspector --cli http://localhost:8000/mcp --transport http --method initialize
    npx @modelcontextprotocol/inspector --cli http://localhost:8000/mcp --transport http --protocol-era modern --method initialize
  7. Write both protocol versions in mcp-notes.txt, under a new heading Advanced MCP. Leave the server running if you go on to lesson 2.

Note: On Windows the Inspector can print an Assertion failed line from Node.js after it finishes. The result above it is still correct. If port 8000 is taken on your computer, pick another port in the server line and in every address.

Checked on 4 December 2026 · Source: MCP Python SDK: Running your server (opens in a new tab)

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