inspector icon indicating copy to clipboard operation
inspector copied to clipboard

Couldn't connect to MCP Proxy Server TypeError: Failed to fetch

Open chaithuchowdhary opened this issue 3 months ago • 8 comments

Inspector Version 0.16.7

When running the MCP Inspector using either of the following commands:

npx @modelcontextprotocol/inspector

or

mcp dev main.py

The terminal output only shows:

Starting MCP Inspector...

The Inspector web UI launches successfully in the browser. However, when attempting to connect to the MCP server from the Inspector UI, the connection consistently fails.

This issue occurs on Ubuntu 24.04.3 LTS.

Console log from the browser

GET http://localhost:6277/config net::ERR_CONNECTION_REFUSED                           index-Dg7mXHRE.js:38902

(anonymous)	@	index-Dg7mXHRE.js:38902
Qj	@	index-Dg7mXHRE.js:5056
Hk	@	index-Dg7mXHRE.js:6291
Ek	@	index-Dg7mXHRE.js:5855
jg	@	index-Dg7mXHRE.js:2769
Wk	@	index-Dg7mXHRE.js:6195
Pk	@	index-Dg7mXHRE.js:6138
Gk	@	index-Dg7mXHRE.js:5794
J2	@	index-Dg7mXHRE.js:475
R	@	index-Dg7mXHRE.js:503

Error fetching default environment: TypeError: Failed to fetch
    at index-Dg7mXHRE.js:38902:5
    at Qj (index-Dg7mXHRE.js:5056:23)
    at Hk (index-Dg7mXHRE.js:6291:21)
    at Ek (index-Dg7mXHRE.js:5855:5)
    at jg (index-Dg7mXHRE.js:2769:17)
    at Wk (index-Dg7mXHRE.js:6195:5)
    at Pk (index-Dg7mXHRE.js:6138:36)
    at Gk (index-Dg7mXHRE.js:5794:13)
    at J2 (index-Dg7mXHRE.js:475:21)
    at MessagePort.R (index-Dg7mXHRE.js:503:15)

To Reproduce

  1. run npx @modelcontextprotocol/inspector or mcp dev your_mcp_server.py

Expected behavior

Screenshots

Image Image

Environment:

  • OS: Ubuntu 24.04.3 LTS
  • Browser: Brave, Firefox, Chrome

chaithuchowdhary avatar Sep 15 '25 21:09 chaithuchowdhary

It looks like the proxy server might not be running. What happens if you just try to start the proxy server using npm run start-server?

olaservo avatar Sep 16 '25 04:09 olaservo

It looks like the proxy server might not be running. What happens if you just try to start the proxy server using npm run start-server?

I am not sure about that. If the proxy server is not running how does it open up the inspector in the browser. Also I ran the command npx @modelcontextprotocol/inspector. I don't know about npm run start-server

chaithuchowdhary avatar Sep 17 '25 16:09 chaithuchowdhary

If you're still having this issue, could you double check that this still happens with the latest version? eg using npx @modelcontextprotocol/inspector@latest

olaservo avatar Sep 29 '25 15:09 olaservo

I have the same issue • OS: Ubuntu 24.04.2 LTS (Noble) • Kernel: Linux 6.11.0-29-generic • Architecture: x86_64 • Hardware: Dell G15-5530

npm view @modelcontextprotocol/inspector version
0.16.8
npx @modelcontextprotocol/inspector@latest   
Starting MCP inspector...
uv run /home/.../server.py
...
Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
# server.py

"""
FastMCP Echo Server
"""

from fastmcp import FastMCP

# Create server
app = FastMCP("Echo Server")


@app.tool
def echo(text: str) -> str:
    """Echo the input text"""
    return text


if __name__ == "__main__":
    app.run(transport="http", host="127.0.0.1", port=8000)


__all__ = [
    "app",
]

In the inspector (running on http://localhost:6274/):

Image

Lawrence-Godfrey avatar Oct 01 '25 06:10 Lawrence-Godfrey

GET http://localhost:6277/health net::ERR_CONNECTION_REFUSED
checkProxyHealth @ index-3LzLs-Yz.js:25194
connect @ index-3LzLs-Yz.js:25253
Nb @ index-3LzLs-Yz.js:1324
Tb @ index-3LzLs-Yz.js:1336
Ub @ index-3LzLs-Yz.js:1339
nf @ index-3LzLs-Yz.js:2276
se @ index-3LzLs-Yz.js:2299
(anonymous) @ index-3LzLs-Yz.js:2571
Qk @ index-3LzLs-Yz.js:5875
Jb @ index-3LzLs-Yz.js:1277
hd @ index-3LzLs-Yz.js:2372
fd @ index-3LzLs-Yz.js:1770
ed @ index-3LzLs-Yz.js:1753Understand this error
index-3LzLs-Yz.js:25200 Couldn't connect to MCP Proxy Server TypeError: Failed to fetch
    at checkProxyHealth (index-3LzLs-Yz.js:25194:41)
    at connect (index-3LzLs-Yz.js:25253:13)
    at Object.Nb (index-3LzLs-Yz.js:1324:9)
    at Tb (index-3LzLs-Yz.js:1336:8)
    at Ub (index-3LzLs-Yz.js:1339:8)
    at nf (index-3LzLs-Yz.js:2276:5)
    at se (index-3LzLs-Yz.js:2299:11)
    at index-3LzLs-Yz.js:2571:7
    at Qk (index-3LzLs-Yz.js:5875:14)
    at Jb (index-3LzLs-Yz.js:1277:14)

There's nothing running on port 6277

Lawrence-Godfrey avatar Oct 01 '25 06:10 Lawrence-Godfrey

any progress here? still having the same issue.

MB-MuratBayraktar avatar Oct 05 '25 14:10 MB-MuratBayraktar

any progress here? still having the same issue.

Still same issue. Not able to start the proxy server. I tried clearing cache. But still same issue

chaithuchowdhary avatar Oct 05 '25 15:10 chaithuchowdhary

I have a similar issue

➜  ~ npx @modelcontextprotocol/inspector@latest
Need to install the following packages:
@modelcontextprotocol/[email protected]
Ok to proceed? (y)

npm warn deprecated [email protected]: Use your platform's native DOMException instead
Starting MCP inspector...
⚙️ Proxy server listening on localhost:6277
🔑 Session token: 6fc0da25d35c27137217483bc6a1988dcb11d80df08c4a281cb1752e5403b948
   Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth

🚀 MCP Inspector is up and running at:
   http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=6fc0da25d35c27137217483bc6a1988dcb11d80df08c4a281cb1752e5403b948

🌐 Opening browser...
New StreamableHttp connection request
Query parameters: {"url":"https://iago.iadvize.net/iago/mcp","transportType":"streamable-http"}
Created StreamableHttp client transport
Client <-> Proxy  sessionId: fc2b3804-7ad2-4e4d-a0f1-0047a7baf685
file:///Users/yannrolland/.npm/_npx/9eac9498388ae25e/node_modules/node-fetch/src/index.js:216
						if (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {
						                                                             ^

TypeError: Cannot read properties of undefined (reading 'body')
    at ClientRequest.<anonymous> (file:///Users/yannrolland/.npm/_npx/9eac9498388ae25e/node_modules/node-fetch/src/index.js:216:68)
    at ClientRequest.emit (node:events:530:35)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:716:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
    at Socket.socketOnData (node:_http_client:558:22)
    at Socket.emit (node:events:530:35)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

Node.js v22.15.0

with Streamable HTTP + Proxy, happening on click on "Connect"

the proxy is crashing and the port 6277 is released (proxy process exits)

lsof -nP -iTCP:6277 -sTCP:LISTEN || echo "nothing on :6277"

TidyMaze avatar Nov 07 '25 09:11 TidyMaze

I have a similar issue

➜  ~ npx @modelcontextprotocol/inspector@latest
Need to install the following packages:
@modelcontextprotocol/[email protected]
Ok to proceed? (y)

npm warn deprecated [email protected]: Use your platform's native DOMException instead
Starting MCP inspector...
⚙️ Proxy server listening on localhost:6277
🔑 Session token: 6fc0da25d35c27137217483bc6a1988dcb11d80df08c4a281cb1752e5403b948
   Use this token to authenticate requests or set DANGEROUSLY_OMIT_AUTH=true to disable auth

🚀 MCP Inspector is up and running at:
   http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=6fc0da25d35c27137217483bc6a1988dcb11d80df08c4a281cb1752e5403b948

🌐 Opening browser...
New StreamableHttp connection request
Query parameters: {"url":"https://iago.iadvize.net/iago/mcp","transportType":"streamable-http"}
Created StreamableHttp client transport
Client <-> Proxy  sessionId: fc2b3804-7ad2-4e4d-a0f1-0047a7baf685
file:///Users/yannrolland/.npm/_npx/9eac9498388ae25e/node_modules/node-fetch/src/index.js:216
						if (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {
						                                                             ^

TypeError: Cannot read properties of undefined (reading 'body')
    at ClientRequest.<anonymous> (file:///Users/yannrolland/.npm/_npx/9eac9498388ae25e/node_modules/node-fetch/src/index.js:216:68)
    at ClientRequest.emit (node:events:530:35)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:716:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
    at Socket.socketOnData (node:_http_client:558:22)
    at Socket.emit (node:events:530:35)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

Node.js v22.15.0

with Streamable HTTP + Proxy, happening on click on "Connect"

the proxy is crashing and the port 6277 is released (proxy process exits)

lsof -nP -iTCP:6277 -sTCP:LISTEN || echo "nothing on :6277"

i have the same issue, i notice when i add a "/" at the end of the mcp url, click inspector connect button then it work,

sll521 avatar Dec 05 '25 09:12 sll521