telegram-mcp
Built by Shreyas ยท Shipped by Globalion
Bidirectional Telegram โ agent bridge. No LLM in our stack.
Your agent (Claude Desktop, Cursor, a custom script) is the brain. Our
platform is the pipe: we take messages you send on Telegram, store them,
and hand them to your agent when it polls. When your agent has something
to say back, it pushes through us to your Telegram.
- Bring your own agent. Any MCP client works.
- No inference in the middle. We don't call an LLM. No vendor lock-in.
- Bidirectional.
get_new_messages pulls inbound, send_telegram_message pushes outbound.
- Platform slash-commands.
/help, /clear, /recent, /window, /usage all work even if your agent is offline.
Hosted at telegram.regiq.in or self-host with the Docker Compose below.
Use it (hosted)
-
Visit https://telegram.regiq.in, sign in with Google.
-
DM @BotFather โ /newbot. Paste the token in your dashboard.
-
On the dashboard: Generate MCP API key, copy it.
-
Add to Claude Desktop's claude_desktop_config.json (or Cursor / any MCP client):
{
"mcpServers": {
"telegram": {
"url": "https://telegram.regiq.in/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY_HERE"
}
}
}
}
-
Send /start to your bot on Telegram.
Now your agent can call get_new_messages to see what you sent it, and send_telegram_message to reply.
| Tool | Direction | Notes |
|---|
get_new_messages() | user โ agent | Returns inbound messages since the last pull. Read-once. |
send_telegram_message(text) | agent โ user | Delivers text to the user's Telegram bot. |
list_recent_messages(max=20) | read | Last N stored messages, both directions. No cursor advance. |
clear_history() | action | Wipes stored history for the user. |
Handled by the platform directly โ your agent isn't involved. So /help works even when nothing is polling.
| Command | Effect |
|---|
/start | Registers this Telegram chat with your account. |
/help | Lists commands. |
/recent [N] | Shows the last N stored messages. |
/clear | Wipes history. |
/window N | Sets the history window (default 20). |
/usage | Stored message count. |
Self-host
You'll need:
- Docker + Compose
- A Google OAuth client โ Cloud Console. Scopes:
openid, email, profile. Redirect: <PUBLIC_BASE_URL>/api/auth/callback/google
- A public HTTPS domain for Telegram webhooks (Cloudflare Tunnel or
ngrok http 3012 locally)
No LLM key required. Your agent brings its own model.
git clone https://github.com/globalion/telegram-mcp
cd telegram-mcp
cp .env.example .env
docker compose up -d
Architecture
Telegram app Your MCP agent
โฒ โ โฒ โ
โ โ text poll โ โ push
โ โผ โ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Our platform (Hetzner) โ
โ - /api/telegram/webhook/<per-user-secret> โ
โ ยท slash-commands answered here โ
โ ยท plain text stored, no reply โ
โ - /api/mcp Bearer-auth JSON-RPC โ
โ ยท get_new_messages, send_telegram_message โ
โ ยท list_recent_messages, clear_history โ
โ - Postgres: User, ApiKey, TelegramLink, Message โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Per-user webhook URL segment is a random secret so a leaked bot token can't
be pointed at someone else's account. Google sign-in is identity + ban
anchor only โ per-message identity comes from the MCP API key + chatId.
License
MIT. See LICENSE.