Skip to content

Inspector should disconnect when server shuts down and/or refuses connections #601

Closed

Description

@odrobnik

After a connection has been established, I shut down the server. The UI doesn't recognize the disconnection.

You still see the Reconnect and Disconnect buttons.

In the console you see tons of messages like this:

Error from MCP server: SseError: SSE error: TypeError: fetch failed: connect ECONNREFUSED ::1:8080, connect ECONNREFUSED 127.0.0.1:8080, connect EHOSTUNREACH fe80::1:8080 - Local (:::55056), connect ECONNREFUSED 192.168.1.142:8080, connect EHOSTUNREACH fe80::479:f5e1:f09e:ee06:8080 - Local (:::55059), connect EHOSTUNREACH fe80::16:546c:57d:64cb:8080 - Local (:::55061), connect EHOSTUNREACH fe80::5cff:b3ff:fe65:8cdf:8080 - Local (:::55062), connect ECONNREFUSED fda0:15a6:9edc:444e:10da:5b53:d2a6:2bac:8080
    at _eventSource.onerror (file:///Users/oliver/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:85:31)
    at EventSource.scheduleReconnect_fn (file:///Users/oliver/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:248:53)
    at file:///Users/oliver/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:98:174
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: undefined,
  event: {
    type: 'error',
    message: 'TypeError: fetch failed: connect ECONNREFUSED ::1:8080, connect ECONNREFUSED 127.0.0.1:8080, connect EHOSTUNREACH fe80::1:8080 - Local (:::55056), connect ECONNREFUSED 192.168.1.142:8080, connect EHOSTUNREACH fe80::479:f5e1:f09e:ee06:8080 - Local (:::55059), connect EHOSTUNREACH fe80::16:546c:57d:64cb:8080 - Local (:::55061), connect EHOSTUNREACH fe80::5cff:b3ff:fe65:8cdf:8080 - Local (:::55062), connect ECONNREFUSED fda0:15a6:9edc:444e:10da:5b53:d2a6:2bac:8080',
    code: undefined,
    defaultPrevented: false,
    cancelable: false,
    timeStamp: 502389.422084
  }
}

I would expect for the UI to show the connection has having been disconnected.

When the server comes back up again, then the connection gets reestablished, but the problem with this is that since this is a new session, there is no information about client capabilities from the initialized notification. So I don't know on the server if the client has sampling, roots or elicitation support.

Activity

  1. added
    bug
    on Jul 10, 2025
  2. odrobnik commented on Jul 10, 2025

    @odrobnik
    Author

    An alternative would be that upon reconnection to re-send the initialize request. Right now I only see

    GET /mcp HTTP/1.1
    host: mac-studio.local:8080
    connection: keep-alive
    Accept: text/event-stream
    accept-language: *
    sec-fetch-mode: cors
    user-agent: node
    pragma: no-cache
    cache-control: no-cache
    accept-encoding: gzip, deflate
    

    So the inspector establishes a new SSE stream but doesn't initialize it (by exchanging the capabilities)

  3. npolshakova commented on Sep 26, 2025

    @npolshakova

    Would #765 fix this by having the UI show the connection was disconnected?

  4. odrobnik commented on Oct 1, 2025

    @odrobnik
    Author

    @npolshakova I guess so, does that stop the automatic reconnection?

  5. added
    v2
    on Nov 11, 2025
  6. cliffhall commented on Aug 1, 2026

    @cliffhall
    Member

    Triage: Priority = Medium

    Scored 8/16 with the priority rubric added to AGENTS.md in #1891, as part of the backlog triage in #1872. Added to project board #28 with Status Incoming — meaning filed and scored but not yet approved for work. A maintainer decides whether it moves to Todo.

    Axis Score Reasoning
    Severity / impact 3/5 The UI keeps asserting a live connection after the server is gone and floods the console, so you debug a phantom session. Real, but you can see it's wrong and reconnect.
    Urgency / staleness 3/5 Open since July 2025, last active November — stale.
    Signal bonuses +2 bug label (+1), high engagement (3 comments) (+1)
    Total 8 Lands in the Medium band (6-8).

    Related issues. One connected issue:

    Scores are a starting point, not a verdict — the rubric is meant to be overruled when it's plainly wrong, provided the reason is written down.

  7. odrobnik commented on Aug 2, 2026

    @odrobnik
    Author

    I think that this is probably no longer current

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions