Bun is a JavaScript and TypeScript runtime, in the same family as Node.js. One bun program runs code, installs packages and reads TypeScript directly, with no build step. The Telegram channel plugin for Claude Code, which lets you message a running session from your phone, is a small TypeScript server that Bun runs. If the bun command cannot be found, the plugin never starts.

I set this up at work to reach a Claude Code session from my phone. Then I traced why the plugin needs a Bun I installed myself, when Claude Code already contains one.

Two copies of Bun

Claude Code’s own program is built with Bun and carries a copy of it inside. That copy is sealed into the executable, so plugins cannot call it. The plugin’s settings tell Claude Code to start its server by running the command bun. Whatever bun the system finds first on PATH is what runs, so the plugin needs a separately installed Bun.

What happens when a session starts

Claude Codeyour sessionBUN PROCESS (YOUR INSTALLED BUN)bun installfills node_modules from the lockfilebun server.tsTelegram bot and MCP servernpm registrygrammY, MCP SDKTelegramBot API1. starts bun2. then runsfetches if missing3. MCP messagesover stdin, stdoutgetUpdatesnew messages

Claude Code never runs the plugin’s code itself. It starts a separate Bun process and talks to it through that process’s input and output streams, using MCP, the protocol Claude Code uses for all its tool servers. Everything inside the zone is Bun’s job: installing the two libraries the plugin depends on, then running a TypeScript file directly.

One message, there and back

You (phone)Telegram APIserver.ts (Bun)Claude session1. you send a message2. returned by getUpdates3. sender on theallowlist?no: dropped4. channel notification5. calls the reply tool6. sendMessage7. reply appears

Steps 2 to 6 happen inside the Bun process. The server keeps asking Telegram for new messages, a method called long polling, so your laptop needs no open port. The allowlist check at step 3 is why a stranger who finds your bot gets nothing back. Anything Claude wants you to see must go through the reply tool, because what it prints in the terminal never reaches your chat.

Pairing a new phone uses the same process. The plugin’s access command drops a file in an “approved” folder, and the server checks that folder every five seconds and sends you a confirmation.

Only one program may poll a bot

Telegram lets exactly one program poll a bot’s messages at a time. A second one gets a conflict error instead of messages. A crashed session can leave its server running in the background, still holding that slot. So the server writes its process ID to a file when it starts. On the next start it reads that file and stops the old server before it begins polling.

If bun isn’t on PATH

Claude Code starts plugin servers with its own environment. If the folder holding bun isn’t on that PATH, the very first step fails with “command not found”. There is then no process, no pairing and no reply tools, and the session lists the Telegram server as failed to connect. The Bun built into Claude Code can’t stand in for it.

Why Bun rather than Node

Node.js could run this kind of server. One tool doing the whole start-up job is why Bun fits.

ReasonWhat it means here
Runs TypeScript as it isThe server ships as source code. Bun runs it directly, so there is no compile step and no dist/ folder.
Installs its own packagesbun install reads the lockfile and fills node_modules with the exact library versions the author tested.
Starts fastEvery new session runs the install check and starts the server, so a quick start keeps the wait short.

A second session takes the bot from the first

The start-up step that stops an old server can’t tell a crashed session from a live one. If you open a second Claude Code session with the plugin, its server stops the first one’s. From then on only the newest session receives your Telegram messages.

Related: tracked-vs-local-shell-config