Telegram channel MCP server dies shortly after startup on Windows

Status Fixed / completed
Maintainer reply ✓ Yes — localden
Activity 7 comments · opened Mar 21, 2026 · closed May 23, 2026
💡 Likely answer: A maintainer (localden, collaborator) responded on this thread — see the highlighted reply below.

Telegram channel MCP server dies shortly after startup on Windows

Environment

  • Claude Code: v2.1.81
  • OS: Windows 11 Pro (10.0.26200)
  • Shell: Git Bash (MINGW64)
  • Bun: 1.3.11
  • Node: v24.14.0
  • Plugin: telegram@claude-plugins-official (v0.0.1, commit 61c0597779bd)
  • Auth: claude.ai (Pro/Max, not Team/Enterprise)

Description

The Telegram channel plugin's MCP server starts and processes initial messages, then silently dies. After the crash, the bot stops responding to Telegram messages entirely. Claude Code continues running normally — only the channel server process is gone.

Steps to reproduce

  1. Install the Telegram plugin: /plugin install telegram@claude-plugins-official
  2. Configure the token: /telegram:configure <token>
  3. Start with channels: claude --channels plugin:telegram@claude-plugins-official
  4. Startup banner confirms: Listening for channel messages from: plugin:telegram@claude-plugins-official
  5. DM the bot on Telegram — it responds with a pairing code (server is alive)
  6. Approve the pairing: /telegram:access pair <code>
  7. Wait ~2-3 minutes
  8. Send another message on Telegram — no response

Diagnosis

After the bot stops responding, calling the Telegram Bot API directly confirms no one is polling:

curl "https://api.telegram.org/bot<token>/getUpdates?limit=1&timeout=0"
# Returns pending updates (200 OK, result array non-empty)
# If the server were polling, this would return 409 Conflict or empty results

tasklist | grep bun shows no bun processes running — the server process has exited.

Manual run works fine

Running the server manually with stdin held open works correctly and maintains polling indefinitely:

cd ~/.claude/plugins/cache/claude-plugins-official/telegram/0.0.1
sleep 60 | bun server.ts 2>&1
# Output: "telegram channel: polling as @MothsLightbot"
# Server stays alive and responds to messages for the full 60 seconds

This suggests the issue is in how Claude Code manages the child process stdio pipes on Windows, not in the server itself.

Expected behavior

The channel MCP server should remain running for the lifetime of the Claude Code session, maintaining the Telegram long-polling connection.

Actual behavior

The server starts, processes a few initial messages (pairing codes), then exits silently. No error output visible in the terminal. The --channels startup banner remains, but the underlying bun process is gone.

Possible cause

The server uses StdioServerTransport from @modelcontextprotocol/sdk. On Windows, stdio pipe handling for child processes may differ from Unix — if the pipe buffer fills or a write fails, the transport closes and the server interprets it as a shutdown signal. The server's shutdown handler (telegram channel: shutting down) fires, and the async bot-polling IIFE is canceled.

Workaround

None found. The server cannot be run standalone because it requires the MCP stdio connection to Claude Code to deliver channel events.

View original on GitHub ↗

7 Comments

AhSnahp · 5 months ago

Update: Channel works, but only intermittently

After further debugging, the channel does work — but the server process appears to die and restart unpredictably. Key findings:

Root cause: zombie server processes

When multiple Claude Code sessions exist (even without --channels), each session spawns its own Telegram MCP server. Since Telegram's getUpdates API is single-consumer, only one process can poll at a time. The others get 409 Conflict and retry.

The critical issue: a session without --channels still spawns the plugin's MCP server (for tool access), which polls Telegram and consumes messages — but since --channels isn't enabled, it silently drops the inbound notifications. This creates a race condition where the wrong server wins polling and messages vanish.

Evidence

  • tasklist showed 2 Telegram plugin servers from 2 different Claude Code sessions
  • wmic process confirmed both had the same command: bun run --cwd .../telegram/0.0.1 --shell=bun --silent start
  • getUpdates returned 0 pending updates (someone was consuming), but no channel events arrived
  • After killing the zombie session, the channel started working

Suggested fix

The plugin's MCP server should only start Telegram polling when the session has --channels enabled for that plugin. Currently it appears to poll unconditionally, which means any session with the plugin installed will compete for getUpdates, even if channel message delivery is disabled.

Environment (unchanged)

  • Claude Code v2.1.81
  • Windows 11 Pro (10.0.26200)
  • Bun 1.3.11
  • Plugin: telegram@claude-plugins-official v0.0.1
alanfong93 · 5 months ago

Environment

| Field | Value |
|-------|-------|
| OS | Windows (with Avast Antivirus) |
| Claude Code (last known working) | 2.1.85 (unconfirmed if downgrade fixes issue) |
| Claude Code (current) | 2.1.88 |
| Plugin | telegram@claude-plugins-official v0.0.4 |
| Bun | Installed via WinGet (Oven-sh.Bun) |

Error

Failed to link which: EPERM
MCP error -32000: Connection closed

What Happened

  • Plugin was working fine on Claude Code v2.1.85 with Bun installed via npm
  • At approximately 2026-03-31 08:05 GMT+8, Avast quarantined bun.exe from C:\Users\pc\AppData\Roaming\npm\node_modules\bun\bin\
  • Plugin stopped working after Avast removal
  • Plugin also appears to have auto-updated to v0.0.4 around the same time
  • Updated Claude Code to v2.1.88 — issue persists
  • Unclear whether root cause is the Avast quarantine, the v0.0.4 plugin update, or both

Fixes Attempted

  • Reinstalled Bun via WinGet (Oven-sh.Bun)
  • Added Avast exclusions for Bun and .claude plugin folders
  • Ran PowerShell as Administrator
  • Enabled Windows Developer Mode
  • Cleared plugin cache and reinstalled plugin at user scope

None of the above resolved the issue.

alanfong93 · 5 months ago
## Environment Field Value OS Windows (with Avast Antivirus) Claude Code (last known working) 2.1.85 (unconfirmed if downgrade fixes issue) Claude Code (current) 2.1.88 Plugin telegram@claude-plugins-official v0.0.4 Bun Installed via WinGet (Oven-sh.Bun) ## Error `` Failed to link which: EPERM MCP error -32000: Connection closed ` ## What Happened * Plugin was working fine on Claude Code v2.1.85 with Bun installed via npm * At approximately 2026-03-31 08:05 GMT+8, Avast quarantined bun.exe from C:\Users\pc\AppData\Roaming\npm\node_modules\bun\bin\ * Plugin stopped working after Avast removal * Plugin also appears to have auto-updated to v0.0.4 around the same time * Updated Claude Code to v2.1.88 — issue persists * Unclear whether root cause is the Avast quarantine, the v0.0.4 plugin update, or both ## Fixes Attempted * Reinstalled Bun via WinGet (Oven-sh.Bun) * Added Avast exclusions for Bun and .claude` plugin folders Ran PowerShell as Administrator Enabled Windows Developer Mode * Cleared plugin cache and reinstalled plugin at user scope None of the above resolved the issue.

Posting this for anyone who runs into the same issue. I had telegram@claude-plugins-official failing to connect as an MCP server on Windows. Here's what fixed it:

Root Cause

Stale project-level settings files (.claude/settings.json and .claude/settings.local.json) were conflicting with the user-scoped plugin installation, and leftover plugin cache files were blocking the reinstall.

Steps

1. Delete conflicting project-level settings (if they exist in your project directory)

  • .claude/settings.json
  • .claude/settings.local.json

2. Uninstall the plugin

Launch Claude Code from your user config directory:

cd C:\Users\<YourUser>\.claude
claude

Then run:

/plugin uninstall telegram@claude-plugins-official

Exit Claude Code.

3. Confirm the MCP is gone

claude mcp list

4. Clear and recreate the plugin cache

Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\plugins\cache"
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\plugins\cache"

5. Reinstall the plugin

Launch Claude Code again from C:\Users\<YourUser>\.claude:

/plugin install telegram@claude-plugins-official

Choose "Install for you (user scope)".

⚠️ You may see an EPERM: operation not permitted, rename error — this can be ignored. Despite the error, the plugin installs correctly.

6. Verify and test

claude mcp list

Telegram should show as connected. To test:

claude --channels plugin:telegram@claude-plugins-official --dangerously-skip-permissions

---

Environment: Windows 10/11, Claude Code, user-scoped plugin install

GustavoVzla · 4 months ago

Confirming the v0.0.1 zombie/race-condition diagnosis applies to v0.0.6 too — and a clean re-setup makes it stable

Adding data points from a fresh test today (2026-04-29) on Windows 11 Pro:

TL;DR

After a clean re-setup with a dedicated bot and killing all stale plugin/Bun processes, the plugin works reliably. bun.exe PID stayed alive >36 min through 4 spaced pings (one with a 15-min idle gap). No silent death at the 2-3 min mark that I previously observed earlier the same day.

The "silent death at 2-3 min" turned out to be the zombie/409 race

Earlier today I was seeing the exact symptom @AhSnahp described in the v0.0.1 update: the channel stops delivering messages even though the process is alive. Diagnosis matches:

  • A previous claude --channels plugin:telegram@claude-plugins-official session left an orphaned bun.exe polling Telegram after I closed the terminal.
  • A second Python script doing my own getUpdates (long-polling stdlib workaround) immediately failed with 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running.
  • The orphan Bun was happily consuming updates and silently dropping them because the parent Claude process had exited.
  • Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'claude-plugins.*telegram|bun.exe.*0\.0\.6' } showed the orphan PIDs from a Claude session that had been closed hours earlier.

So the "muere silenciosamente a los 2-3 min" symptom may often be misdiagnosed — what's really happening is that another orphaned plugin process is winning the getUpdates race, and the new session never sees its messages.

Reproduction of the working state

  1. Stop-Process -Name bun -Force (or otherwise kill all stale bun.exe from prior sessions)
  2. Created a brand-new dedicated bot in @BotFather (separate from any other bot I had used with the plugin previously, to dodge 409 from the V1 bot still being polled by a zombie elsewhere)
  3. ~/.claude/channels/telegram/.env updated with the new token
  4. claude --channels plugin:telegram@claude-plugins-official
  5. /telegram:configure — token loaded
  6. /telegram:access pair <code> then /telegram:access policy allowlist — chat closed
  7. Paired chat sent a message → arrived to Claude as user-prompt → Claude responded back via Telegram

Stability log

| Ping | Madrid time | bun.exe PID | Uptime | Result |
|---|---|---|---|---|
| 1 | ~12:55 | 2572 | ~5 min | OK |
| 2 | 13:04 | 2572 | 15.1 min | OK |
| 3 | 13:13 | 2572 | ~24 min | OK |
| 4 (after 15-min idle gap) | 13:25 | 2572 | 36.6 min | OK |

Same PID throughout. No restarts. Same process handled the 15-min idle window without dying.

Suggested next steps for this issue

This may be ready to close as resolved-via-process-fix, but two things would help users hit by this in the wild:

  1. Surface the zombie risk in the plugin docs / /telegram:configure output. Something like: "If you've previously run the plugin in another session, run Stop-Process -Name bun -Force (Windows) or pkill bun (macOS/Linux) before starting --channels. Otherwise an orphaned poller will silently consume your messages."
  2. Consider @AhSnahp's fix: only spawn the Telegram polling subprocess when the parent session has --channels enabled for that plugin, not just when the plugin is installed. That would eliminate the silent-orphan class of bug entirely.

Environment

  • Windows 11 Pro (10.0.26200)
  • Claude Code latest
  • telegram@claude-plugins-official v0.0.6
  • Bun (winget install)
  • Plugin cache at ~/.claude/plugins/cache/claude-plugins-official/telegram/0.0.6/

Happy to dig further if useful.

GustavoVzla · 4 months ago

Update — overnight stability test passed (18+ hours uptime, no restarts)

Following up on my previous comment with the long-form data. The bot I configured at 12:49 Madrid time on 29-Apr-2026 with a clean setup is still running on the same PID at 07:02 Madrid on 30-Apr-2026 — that's 18.2 continuous hours without the Bun process dying or restarting.

Evidence

PID    Started              UptimeHours
2572   2026-04-29 12:49:55  18.2

Activity during that window

I sent 6+ messages spaced across the period, including:

  • 4 pings in the first hour (validation)
  • 1 message at ~22:00 Madrid
  • 1 morning message at ~07:00 Madrid (15+ hour gap)

All received and responded by Claude via Telegram. No 409 conflicts, no silent message loss, no zombie issues during this run (the zombie issue from my previous comment was caused by orphan processes from a prior session that I'd killed before this test).

Implication for this issue

In my Windows 11 Pro setup, Issue #36964's "muere a los 2-3 minutos" symptom is no longer reproducible with v0.0.6 + clean setup. The plugin is functionally stable for long-running interactive sessions.

I'm moving it to ADOPTAR internally and using it as the primary input channel for some Claude Code sessions. Long-polling Python (the workaround I'd been using) stays in production for scripted monitors that don't want the --channels flag, but for interactive sessions the plugin is now my preferred path.

Happy for the maintainers to close this issue if my data point is sufficient. If others on Windows want to verify before closing, the clean-setup steps that made it work for me are documented in alanfong93's earlier comment in this thread.

Environment (unchanged from previous comment)

  • Windows 11 Pro
  • Claude Code latest
  • telegram@claude-plugins-official v0.0.6
  • Bun (winget install)
  • Plugin cache at ~/.claude/plugins/cache/claude-plugins-official/telegram/0.0.6/
localden collaborator · 3 months ago

Thanks for the report. This is fixed and will ship in an upcoming release. The Windows process cleanup path now uses a process-tree-aware kill so the stdio MCP server is no longer terminated unexpectedly during session lifecycle transitions.

If you still see the server exit early after updating, please open a new issue with the version number and the contents of ~/.claude/logs/mcp-*.log and we will take another look.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.