Repository navigation
Description
Title: [BUG] TypeError: Controller is already closed when connecting to fastmcp Streamable HTTP transport
Inspector Version
v0.17.2
Describe the bug
When attempting to connect the MCP Inspector (using npx @modelcontextprotocol/inspector) to a Streamable HTTP service implemented with the Python library fastmcp, the Node.js proxy immediately crashes with a TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed.
The connection works fine when the fastmcp service is running in Legacy SSE mode.
To Reproduce
This assumes a project set up with fastmcp similar to the user code provided (using mcp.run_http_async for Streamable HTTP mode).
-
Start the Server in Streamable HTTP Mode:
# Assuming the server is running on port 8001 and mounted at /mcp python -m src.mcp_server.src.main shttp # (Server starts and is accessible at [http://127.0.0.1:8001/mcp](http://127.0.0.1:8001/mcp))
-
Run the MCP Inspector:
npx @modelcontextprotocol/inspector [http://127.0.0.1:8001/mcp](http://127.0.0.1:8001/mcp)
-
Observe the Crash: The command line output for the inspector will show the crash after initializing the StreamableHttp client transport.
Full Traceback Observed:
New StreamableHttp connection request
Query parameters: {"url":"[http://127.0.0.1:8001/mcp](http://127.0.0.1:8001/mcp)","transportType":"streamable-http"}
Created StreamableHttp client transport
Client <-> Proxy sessionId: ...
Proxy <-> Server sessionId: ...
Received POST message for sessionId ...
Received GET message for sessionId ...
node:internal/webstreams/readablestream:1068
throw new ERR_INVALID_STATE.TypeError('Controller is already closed');
^
TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed
at ReadableStreamDefaultController.close (node:internal/webstreams/readablestream:1068:13)
at PassThrough.<anonymous> (file:///E:/packages/npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:196:28)
at PassThrough.emit (node:events:524:28)
at endReadableNT (node:internal/streams/readable:1698:12)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: 'ERR_INVALID_STATE'
}
Expected behavior
The MCP Inspector should successfully connect to the Streamable HTTP endpoint, start the proxy, and open the browser interface without crashing, allowing the user to interact with the service tools.
Screenshots
Environment (please complete the following information):
- OS: Windows 10/11
- Node.js Version: v22.13.0
- Backend Framework: fastmcp (Python)
Additional context
- The same
fastmcpservice running in Legacy SSE mode (python -m src.mcp_server.src.main sseconnected viahttp://127.0.0.1:8001/sse) works without issue, confirming the backend logic is sound. - The issue seems to be isolated to the handling of the Streamable HTTP transport type within the inspector's Node.js proxy/client logic, specifically related to the
ReadableStreamDefaultController.close()method being called multiple times. - The service was successfully tested with Cherry Studio, which suggests the service implementation adheres to the MCP spec correctly.
Activity
snemuri commentedon Dec 3, 2025
Running into the same issue.
demian-licht-hs commentedon Dec 3, 2025
Likewise, is there any known workaround?
gpierrick commentedon Dec 3, 2025
Same here. I tried to go to another version but same issue
rperezll commentedon Dec 3, 2025
For me downgrading to 0.16.6 worked
mathieu-benoit commentedon Dec 3, 2025
Same here, downgrading to
v0.16.7to workaround this issue:v1-azhar commentedon Dec 3, 2025
For me too, versions below
v0.16.8don't have this issue. Althoughv0.16.8was working perfectly fine for me yesterday.FelixBaum commentedon Dec 4, 2025
Same for me, version
v0.17.2was working fine until yesterday. Now onlyv0.16.7works.nexigo-nm commentedon Dec 4, 2025
same problem with spring-ai streamable http server
cliffhall commentedon Dec 4, 2025
This will be fixed in the next release by #940
rperezll commentedon Dec 4, 2025
For me the new version
v0.17.5works and fixes the problems. Thanks a lot team!!wouterds commentedon Dec 4, 2025
Confirmed as fixed in
0.17.5, thanks!mathieu-benoit commentedon Dec 4, 2025
Same here, fixed with
0.17.5, thanks!cliffhall commentedon Dec 4, 2025
Closing as fixed