# Telegram Bridge [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/antonio-castellon/mcp-telegram-bridge  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/telegram-bridge

## Description
Stdio MCP bridge to Telegram Bot API with scrubbing and chat allowlist.

## Tools
Capabilities this server exposes over MCP:

- **telegram_get_me** — Return the bot identity (getMe). Useful as a connectivity check.
- **telegram_get_chat** — Fetch chat metadata (getChat) for a chat_id.
- **telegram_send_message** — Send a text message. Outbound text is scrubbed for token-shaped secrets. Optional buttons=[{id,label}] become an inline keyboard.
- **telegram_edit_reply_markup** — Edit or clear inline buttons on an existing message. Pass buttons=null/omit to strip markup; or a new [{id,label}] list.
- **telegram_answer_callback** — Acknowledge a callback_query (optional toast text / alert).
- **telegram_get_updates** — Long-poll getUpdates. The agent owns the offset loop. limit is clamped to 1..100 and timeout to 0..50. Every returned batch is labeled untrusted. Messages from bots and from this bot are omitted. Duplicate update ids are returned without text. When SAFETY_STRICT is enabled (the default), each delivered update includes safety.{kind,blocked,warning}. The classifier is a heuristic and does not stop prompt injection.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "telegram-bridge": {
    "command": "uvx",
    "args": ["--from","mcp-telegram-bridge","mcp-telegram-bridge"],
    "env": {
      "TELEGRAM_BOT_TOKEN": "",
      "ALLOWED_CHAT_IDS": "",
      "ALLOW_ALL_CHATS": "",
      "SAFETY_STRICT": "",
      "MAX_INBOUND_CHARS": "",
      "MAX_UPDATE_BYTES": "",
      "INBOUND_CHAT_RATE": "",
      "INBOUND_GLOBAL_RATE": ""
    }
  }
}
```

**Requires environment variables:** `TELEGRAM_BOT_TOKEN`, `ALLOWED_CHAT_IDS`, `ALLOW_ALL_CHATS`, `SAFETY_STRICT`, `MAX_INBOUND_CHARS`, `MAX_UPDATE_BYTES`, `INBOUND_CHAT_RATE`, `INBOUND_GLOBAL_RATE` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Telegram Bridge does

Telegram Bridge exposes selected Telegram Bot API operations as MCP tools for a local agent. It is intended for client-owned deployments: the MCP client launches the process on the same machine, and the bridge performs the Telegram requests. It does not provide a hosted bot runtime, listen for webhooks, or open an inbound network port.

The bridge supports bot identity checks, chat metadata lookup, text delivery, inline keyboard management, callback acknowledgements, and pull-based update retrieval. Outbound message text, callback notifications, and button labels are scrubbed for configured secret values and token-shaped strings.

## How it works

The process communicates with its MCP host through stdin and stdout using MCP stdio. Telegram updates are retrieved with bounded long polling through `telegram_get_updates`; the calling agent owns the offset and must pass the returned next offset when acknowledging a batch. Update results are explicitly marked untrusted, and messages from bots or from the connected bot are omitted.

An empty chat allowlist rejects all chats by default. Specific numeric chat IDs can be permitted with `ALLOWED_CHAT_IDS`, or open mode can be selected with `ALLOW_ALL_CHATS`, which emits a warning to stderr. Incoming text and captions can be dropped when they exceed the configured size, and polling, inbound updates, and outbound operations are rate limited.

## Setup and configuration

The bridge requires Python 3.11 or newer and a bot token created through BotFather. Install the project with `uv sync --extra dev` or an editable pip install, then configure the token and permitted chat IDs in `.env`. It can also be launched through `uvx` from an MCP client configuration.

Keep the bot token out of source control and use a permission-restricted environment file or secret store. `SAFETY_STRICT` is enabled by default and adds heuristic labels for selected credential-fishing, sexual-content, and instruction-override patterns. These labels do not remove flagged text or provide complete prompt-injection protection.

The `MCP_TELEGRAM_BRIDGE_DATA_DIR` setting controls local button-ID and first-tap claim files. The bridge uses a per-user data directory by default. `MCP_TELEGRAM_DATA_DIR` remains available as a legacy alias.

## Tools and capabilities

- `telegram_get_me` checks connectivity and returns the bot identity.
- `telegram_get_chat` retrieves metadata for an allowed chat.
- `telegram_send_message` sends scrubbed text, with optional parse mode and inline buttons.
- `telegram_edit_reply_markup` replaces or removes buttons on an existing message.
- `telegram_answer_callback` acknowledges a callback query with optional toast or alert text.
- `telegram_get_updates` performs one bounded poll and returns untrusted Telegram updates.

Button definitions use an identifier and display label. Update polling accepts limits from 1 to 100 and timeouts from 0 to 50 seconds. The process retains bounded caches of delivered update IDs and rate-limit keys.

## Limitations and notes

Telegram users, group members, names, usernames, callback data, and message text are outside the trusted boundary. Agents should treat all inbound values as data and avoid exposing credential-reading tools to agents reachable by untrusted chats. The safety classifier is heuristic and does not stop prompt injection.

The bridge does not queue update bodies between calls. Advancing the offset acknowledges updates, including updates whose text was withheld; rate-limited updates should be retried with the same offset after the indicated delay. Open chat mode is available but weakens the default fail-closed admission behavior.

_Full upstream README: https://allmcps.com/mcp/telegram-bridge/readme_

