Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng Phù hợp với người mới
#166 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong src/main/tools/mcp.ts, đặc biệt là McpHub.connectOne và phần xử lý trạng thái client được mô tả trong issue. Kiểm tra cách MCP SDK báo hiệu kết nối đã đóng, sau đó thêm một stdio fixture thoát sau listTools. Hoàn tất khi status() báo lỗi sau khi server thoát và refresh() kết nối lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
2
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PierrunoYT/patch

Tất cả issue của PierrunoYT/patch

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.