Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

MCP server that dies after connecting shows "connected" forever and is never reconnected

Closed Beginner friendly
#166 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start in src/main/tools/mcp.ts, especially McpHub.connectOne and the client state handling described in the issue. Check how the MCP SDK signals a closed connection, then add a stdio fixture that exits after listTools. Done when status() reports an error after the server exits and refresh() reconnects.

Written by the indexing model from the issue text.

Description

bug priority: medium severity: medium

Found in the 2026-10-07 code review (traced through MCP SDK 1.31.0).

Problem

McpHub.connectOne (src/main/tools/mcp.ts:100-141) never sets client.onclose. When a stdio server crashes or an HTTP session drops, the SDK clears its transport (protocol.js:268) and later calls throw Not connected. state.client stays set, though:

  • status() reports connected.
  • The tools are still offered to the model, and every call fails.
  • connectOne returns early for an unchanged config, so a refresh doesn't reconnect either.

Fix

client.onclose = () => {
  if (state.client !== client) return;
  state.client = null;
  state.tools = [];
  state.listed = [];
  state.error = 'The server closed the connection.';
  this.onToolsChanged();
};

Optionally reconnect on the next refresh. Test: a stdio fixture that exits after listTools → status() reports an error and refresh() reconnects.

Dominant language
TypeScript
Stars
2
Forks
2
Avg merge
5h 28m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PierrunoYT/patch

All issues in PierrunoYT/patch

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.