telegram-mcp-bot
Provides Telegram bot integration: send text messages and photos, read incoming messages with cursor-based updates, list known chats, and manage multi-session routing and commands through Telegram.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
telegram-mcp-bot
A Model Context Protocol (MCP) server that connects Claude Code to Telegram via a bot.
Setup
Create a bot via @BotFather and copy the token
Add the MCP server:
claude mcp add telegram -s user -e TELEGRAM_BOT_TOKEN=your-token -- npx -y telegram-mcp-bot@latestMessage the bot — it replies with your Telegram user ID and refuses everything else (see Security)
Re-add the server with that ID allowlisted and restart Claude Code:
claude mcp remove telegram -s user
claude mcp add telegram -s user \
-e TELEGRAM_BOT_TOKEN=your-token \
-e TELEGRAM_ALLOWED_USERS=123456789 \
-- npx -y telegram-mcp-bot@latestMessage the bot again — it remembers your chat from then on
That's it. Claude can now send and receive messages through the bot.
Other agents
Any MCP client works. For JSON-configured agents (Cursor, Windsurf, Copilot, …):
{
"mcpServers": {
"telegram": {
"command": "npx",
"args": ["-y", "telegram-mcp-bot@latest"],
"env": {
"TELEGRAM_BOT_TOKEN": "your-token",
"TELEGRAM_ALLOWED_USERS": "123456789"
}
}
}
}Agent skill
skills/telegram-mcp/SKILL.md teaches the agent when and how to use the tools: notifying you, asking questions and waiting for answers, the polling loop, and multi-session routing. Copy the folder into your agent's skills directory (e.g. ~/.claude/skills/).
Related MCP server: telegram-bot
Security
Everything an allowed user sends goes into your agent's context, and that agent can usually run commands on your machine. So the server is locked down by default:
Allowlist by default — only Telegram user IDs in
TELEGRAM_ALLOWED_USERSget through. If it isn't set, every message is rejected. Unknown users are told their ID once (in private chats) and otherwise ignored. Usernames aren't accepted because they can be changed and re-registered by someone else.TELEGRAM_ALLOWED_USERS=*opens the bot to everyone — don't, unless you understand the risk.Known chats only — send tools refuse chats that no allowed user has messaged, so an injected instruction can't redirect output to an attacker's chat. Saved chats from users who are no longer allowed are dropped at startup.
Images only from disk —
send_photoonly reads local files with image extensions.Network — the server only talks to the Telegram Bot API (
api.telegram.org).
Upgrading from 1.x: 2.0 rejects all messages until
TELEGRAM_ALLOWED_USERSis set. Message the bot to get your ID, then add it.
How It Works
The bot persists known chats to ~/.telegram-mcp/chats.json. After a user messages the bot once, their chat is remembered across restarts. Send tools default to the most recent chat, so chat_id is usually not needed.
Tools
Tool | Description |
| Send a text message |
| Send a photo (URL, file ID, or local path) |
| Read incoming messages (cursor-based, session-filtered) |
| List all known chats |
| Set a name/emoji prefix and register a Telegram command for this session |
All send tools default chat_id to the most recent known chat.
Multi-Session Support
Multiple Claude Code sessions can share the same bot. Each session registers itself with a name and emoji:
claude mcp add telegram -s user \
-e TELEGRAM_BOT_TOKEN=your-token \
-e TELEGRAM_ALLOWED_USERS=123456789 \
-e SESSION_NAME=debug-api \
-e SESSION_EMOJI=🟢 \
-- npx -y telegram-mcp-bot@latestThe bot automatically registers Telegram commands per session. In Telegram, tap /debug_api to direct your messages to that session. Use /setup to see all active sessions and your current target.
Messages are routed: each session only receives messages targeted at it (or untargeted messages if no session is selected).
Telegram Commands
Command | Description |
| Show chat ID, active sessions, and current target |
| Switch message target to that session |
Commands are registered dynamically when sessions connect/disconnect.
Environment Variables
Variable | Description |
| Comma-separated Telegram user IDs allowed to use the bot (required in practice — unset rejects everyone; |
| Session name — registers a Telegram command and prefixes outgoing messages |
| Emoji prefix (e.g. |
| Override data directory (default: |
MCP Resources
Resource URI | Description |
| Messages from a specific chat |
| Recent messages across all chats |
Development
git clone git@github.com:hatip5656/telegram-mcp.git
cd telegram-mcp
npm install
npm run build
TELEGRAM_BOT_TOKEN=your-token TELEGRAM_ALLOWED_USERS=your-id npm run dev
npm test
npm run skill:zip # packages skills/telegram-mcp into a zip for skill marketplacesLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Hosted Telegram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Unofficial Telegram MCP server — read, search, reply and react in your own Telegram account.
WhatsApp and Telegram for AI agents, behind a policy gateway. OAuth or access key.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables sending and reading Telegram messages through MCP, using either a bot or a personal user account.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to read allowlisted Telegram chats and send messages as a bot, with access control, local secrets, and duplicate send protection.1MIT
- AlicenseAqualityBmaintenanceControlled Telegram Bot API bridge for any MCP host (stdio). Deny-by-default chat allowlist, outbound scrubbing, token redaction in logs, rate limits and untrusted-input labeling. Also usable as a plain Python library (TelegramBridge). The agent owns the logic; the bridge handles Telegram I/O.649 PyPIMIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients such as Claude to send messages, photos, and files to a single Telegram chat through the caller's own bot token and to read the replies, pinning each connection to one chat while storing no tokens, messages, or files.MIT