2026, Jan 11 11:00

MCP Inspector STDIO vs SSE: Resolve 'SSE connection not established' for Python SDK Servers

Seeing 'SSE connection not established' in MCP Inspector while using STDIO with a Python SDK server? Learn fixes: VS Code Simple Browser or npx launch.

When you run an MCP server from the Python SDK and connect through MCP Inspector, you might see a confusing mix of signals: the Inspector UI is configured for STDIO transport, but the logs show “New SSE connection,” and a subsequent click on Connect throws “Error in /message route: Error: SSE connection not established.” If this sounds familiar, the good news is that you don’t need to change your server code. The issue can be worked around by how you open or launch the Inspector.

Minimal server that triggers the issue

The following example uses the Python SDK and mirrors the common quickstart. It exposes a tool and a dynamic resource. The identifiers are arbitrary; the behavior matches the typical sample.

# server.py
from mcp.server.fastmcp import FastMCP

app_core = FastMCP("Demo")


@app_core.tool()
def sum_two(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


@app_core.resource("greeting://{label}")
def build_salute(label: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {label}!"

What actually goes wrong

You start the dev server with mcp dev src/server.py and the console reports that the proxy is listening and the MCP Inspector is reachable at a local URL. In the Inspector UI, STDIO is already selected and the command line shows uv run --with mcp mcp run src/server.py. On the first Connect, the logs mention that an SSE connection was created even though the transportType is stdio, the stdio transport is spawned, and the proxy is set up. Clicking Connect again surfaces “Connection Error, is your MCP server running?” in the UI, and the console logs “Error in /message route: Error: SSE connection not established,” followed by “Cannot set headers after they are sent to the client.”

Server-side changes don’t change this behavior. Even explicitly running with a main guard and forcing STDIO doesn’t affect the outcome.

if __name__ == "__main__":
    app_core.run(transport="stdio")

The same happens after trying alternate transports, running an SSE server elsewhere and connecting from the local Inspector, clearing cache, using Incognito, or stopping other processes that might have touched the ports. Chrome and Edge behave the same way in this setup.

What resolves it

A reliable workaround is to open the MCP Inspector URL inside VS Code’s Simple Browser. Use Ctrl + Shift + P, choose “Simple Browser: Show,” and paste the Inspector URL (for example, http://127.0.0.1:6274). In this environment the Inspector connects cleanly and the STDIO transport is respected without further changes to your Python server. Users have also reported success by handling the token explicitly: opening the URL without a token and pasting the token from the VS Code terminal into the Inspector configuration, or copying the full URL with the token and using that so the STDIO setting is applied correctly.

There is another route that works without opening the Inspector page first. Launch the Inspector with the server command in one go using npx:

npx @modelcontextprotocol/inspector uv run src/server.py

This approach has been confirmed to connect correctly for cases where the browser-based flow failed.

Why this matters

Local development with the Model Context Protocol depends on tight coordination between the Inspector UI, the proxy, and your server transport. If your browser session and the Inspector backend get out of sync on how to establish the channel, you can end up with an SSE error even while you intend to use STDIO. Using the Simple Browser in VS Code or launching the Inspector via npx keeps that handshake aligned, so you can focus on iterating on your MCP tools and resources instead of debugging the transport.

Takeaways

You don’t need to modify your Python MCP server to resolve this specific connection error. If you encounter “SSE connection not established” when using STDIO in Chrome or Edge, open the Inspector inside VS Code’s Simple Browser, or start it directly with npx @modelcontextprotocol/inspector uv run src/server.py. If your Inspector flow involves a token, make sure you either paste it from the VS Code terminal into the Inspector window or use the full URL that already contains the token so the transport selection is honored.