Better Telegram MCP — Claude Code MCP server for Telegram
Hooks your agent up to Telegram: messages, chats, media and contacts. Works either as a bot or as a regular account.
claude mcp add --env TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> --env TELEGRAM_API_ID=<TELEGRAM_API_ID> --env TELEGRAM_API_HASH=<TELEGRAM_API_HASH> --transport stdio better-telegram-mcp -- uvx better-telegram-mcpWhat Better Telegram MCP does
Two modes share one server. A bot token routes calls through the Bot API over httpx. Swap in account API credentials and it switches to MTProto via Telethon, which opens up a normal user account instead of a bot identity.
Seven tools dispatch by action: message, chat, media, contact, config, help and config__open_relay. Some carry read-only annotations, others are flagged destructive, so the agent has something to reason about before it acts. Docs also arrive as MCP resources under telegram://docs/*.
Signing in as a user goes through the browser. The HTTP relay form takes the phone number, the OTP and the 2FA password; on a single machine the auth CLI does the same job, and login sticks around as a deprecated alias. Skip both a bot token and the API ID/hash pair and the server has no identity to act under. Run locally, the executable starts on stdio by default; HTTP needs --http, MCP_TRANSPORT=http or TRANSPORT_MODE=http.
What it helps with
- Send a chat message without leaving the agent session
- Pull media out of a thread and hand it to the project
- Look up a contact and open the conversation
- Turn incoming messages into tasks
- Drive a bot and a personal account from one interface
Example prompts for the agent
- Post to the
dev-teamchat that the build failed - Find Ivan in contacts and show our latest messages
- Grab the newest photo from the
releasechat
How to install Better Telegram MCP
Platform CLI
claude mcp add --env TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> --env TELEGRAM_API_ID=<TELEGRAM_API_ID> --env TELEGRAM_API_HASH=<TELEGRAM_API_HASH> --transport stdio better-telegram-mcp -- uvx better-telegram-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from better-telegram-mcp <command>
Platform CLI
codex mcp add better-telegram-mcp --env TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> --env TELEGRAM_API_ID=<TELEGRAM_API_ID> --env TELEGRAM_API_HASH=<TELEGRAM_API_HASH> -- uvx better-telegram-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from better-telegram-mcp <command>
Config file
{
"mcpServers": {
"better-telegram-mcp": {
"command": "uvx",
"args": [
"better-telegram-mcp"
],
"env": {
"TELEGRAM_BOT_TOKEN": "<TELEGRAM_BOT_TOKEN>",
"TELEGRAM_API_ID": "<TELEGRAM_API_ID>",
"TELEGRAM_API_HASH": "<TELEGRAM_API_HASH>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from better-telegram-mcp <command>
Config file
{
"servers": {
"better-telegram-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"better-telegram-mcp"
],
"env": {
"TELEGRAM_BOT_TOKEN": "<TELEGRAM_BOT_TOKEN>",
"TELEGRAM_API_ID": "<TELEGRAM_API_ID>",
"TELEGRAM_API_HASH": "<TELEGRAM_API_HASH>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from better-telegram-mcp <command>
Platform CLI
gemini mcp add -e TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> -e TELEGRAM_API_ID=<TELEGRAM_API_ID> -e TELEGRAM_API_HASH=<TELEGRAM_API_HASH> better-telegram-mcp uvx better-telegram-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from better-telegram-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Better Telegram MCP
How do I install Better Telegram MCP in Claude Code?
Run claude mcp add better-telegram-mcp -e TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT_TOKEN> -e TELEGRAM_API_HASH=<TELEGRAM_API_HASH> -- uvx better-telegram-mcp. The user-account variant adds TELEGRAM_API_ID and --transport stdio.
What does Better Telegram MCP do?
It gives the agent Telegram: sending messages, reading chats, media and contacts. Which mode runs depends on whether you supply a bot token or account credentials.
What do I need for user-account mode?
TELEGRAM_API_ID, TELEGRAM_API_HASH and a phone login. In HTTP mode the confirmation code and 2FA password go into a browser form.