claude-code - 💡(How to fix) Fix Telegram plugin (and all stdio MCP plugins) disconnect after minutes of inactivity - makes messaging channels unusable [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46502Fetched 2026-04-11 06:18:36
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Root Cause

The Telegram channel plugin disconnects after roughly 5-10 minutes of conversation inactivity because Claude Code closes stdio MCP child processes when a session goes idle.

RAW_BUFFERClick to expand / collapse

The Telegram channel plugin disconnects after roughly 5-10 minutes of conversation inactivity because Claude Code closes stdio MCP child processes when a session goes idle.

This makes the plugin completely unusable for its intended purpose - being reachable via Telegram when away from the computer. The connection only stays alive while actively using the conversation, which defeats the point of a messaging bridge.

Key findings from investigating the code:

  • Claude Code's StdioClientTransport closes the pipe when the session ends
  • server.ts detects EOF/orphan state and shuts down (lines 635-664)
  • Stdio transports are explicitly excluded from automatic reconnection in cli.js - only SSE/HTTP transports get retry logic
  • There is no exposed config (settings.json, .mcp.json) to control session lifetime or enable persistence for stdio servers

Requested fix (any of these would solve it):

  1. Add a persistent: true flag in .mcp.json that keeps stdio servers alive across conversations
  2. Enable auto-reconnect for stdio transports (already works for SSE/HTTP)
  3. Add a configurable idle timeout so channel plugins aren't killed after minutes of inactivity
  4. Allow stdio plugins to opt into the LSP-style restartOnCrash / maxRestarts behaviour that already exists in the LSP server schema

Environment: macOS, Claude Code desktop app, Telegram plugin v0.0.5

extent analysis

TL;DR

To resolve the Telegram channel plugin disconnection issue, consider adding a persistent: true flag in .mcp.json or enabling auto-reconnect for stdio transports.

Guidance

  • Investigate modifying cli.js to include stdio transports in the automatic reconnection logic, similar to SSE/HTTP transports.
  • Review the server.ts code (lines 635-664) to understand how it handles EOF/orphan states and determine if adjustments can be made to prevent shutdown on idle.
  • Consider adding a configurable idle timeout to prevent channel plugins from being killed after minutes of inactivity.
  • Explore the possibility of opting stdio plugins into the existing LSP-style restartOnCrash/maxRestarts behavior.

Example

No explicit code example is provided due to the lack of specific code snippets in the issue description. However, the solution likely involves modifying the cli.js and server.ts files.

Notes

The exact implementation details may vary depending on the specific requirements and constraints of the Claude Code desktop app and the Telegram plugin.

Recommendation

Apply a workaround by modifying the cli.js file to enable auto-reconnect for stdio transports, as this seems to be a straightforward solution that aligns with existing functionality for SSE/HTTP transports.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Telegram plugin (and all stdio MCP plugins) disconnect after minutes of inactivity - makes messaging channels unusable [1 comments, 2 participants]