Skip to main content
Glama
Telegram MCP Bridge

Telegram MCP Bridge

by MOEINv363

Telegram MCP Bridge πŸ€–

A self-hosted bridge that connects a Telegram bot to Claude Code over the Model Context Protocol (MCP), with an instant auto-reply layer so the bot answers users immediately β€” even when the Claude app is closed.

Features ✨

  • Instant auto-replies β€” any message to the bot gets an AI reply in ~2 seconds (OpenAI-compatible LLM)

  • Claude integration β€” messages containing a keyword (default: claude) are routed to Claude Code for full-powered answers

  • Emoji reactions β€” automatically reacts to every incoming message πŸ‘β€οΈπŸ”₯

  • Photo support + vision β€” when someone sends a photo, the bot reacts, analyzes the image content with a vision model, and replies with a description πŸ“·πŸ‘οΈ

  • User feedback buttons β€” every bot reply has πŸ‘ / πŸ‘Ž / 🚩 Report buttons; reports are sent to the admin πŸ‘πŸ‘ŽπŸš©

  • Per-chat context β€” each user only sees their own conversation history

  • History persistence β€” conversations survive restarts (saved to .history.json)

  • Allowlist support β€” optional: restrict usage to specific Telegram user IDs

  • SSE MCP server β€” Claude connects over http://127.0.0.1:8765/sse

  • Startup launcher β€” runs at login, always available

  • Cloudflare Worker fallback (optional) β€” always-on layer that answers via Gemini when your PC is off (see telegram-worker/) ☁️

Related MCP server: tsgram-mcp

Architecture πŸ—οΈ

Telegram bot ←→ bridge (node) ←→ LLM (auto-reply, instant)
                      β”‚
                      └── MCP over SSE ←→ Claude Code (smart mode)

(optional) Telegram webhook β†’ Cloudflare Worker β†’ local bridge (if online) or Gemini fallback

Setup πŸš€

Prerequisites

  • Node.js 18+

  • A Telegram bot token (from @BotFather)

  • An OpenAI-compatible LLM endpoint + API key

Install

npm install
cp config.env.example config.env
# edit config.env with your values

Run (manual)

node server.js

Run (auto-start at login, Windows)

Create a .bat in the Startup folder (shell:startup) that sets the env vars from config.env and runs node server.js.

Connect Claude Code

Add to ~/.claude.json:

{
  "mcpServers": {
    "telegram": {
      "type": "sse",
      "url": "http://127.0.0.1:8765/sse"
    }
  }
}

Configuration βš™οΈ

See config.env.example for all options: bot token, allowlist, SSE port, auto-reply model, fallback model, Claude keyword, vision model, admin ID.

For the optional Cloudflare Worker layer, see telegram-worker/README.md.

Security πŸ”’

  • Never commit config.env β€” it contains your bot token and API keys

  • Allowlist (ALLOWED_USER_IDS) restricts who can use the bot β€” recommended for private bots

  • The auto-reply uses your LLM API key β€” a public bot means anyone can consume your quota

License πŸ“„

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      MCP server that enables Claude Code to interact with a personal Telegram account via MTProto, providing over 120 tools for messaging, media, chat management, and more.
      100
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects Claude Code sessions to Telegram, enabling AI-powered code assistance and file management directly from Telegram chats.
      88
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants like Claude to read, search, and send messages through your personal Telegram account via MCP tools.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that sends and receives Telegram messages to a fixed contact, and triggers claude.ai routines for automatic replies.
      -