Telegram MCP server — dual-mode Bot API + MTProto, 6 composite tools.
mcp-name: io.github.n24q02m/better-telegram-mcp
MCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot integrations and MTProto (Telethon) for full user-account access.
<a href="https://glama.ai/mcp/servers/n24q02m/better-telegram-mcp"> </a>messages, chats, media, contacts, config, helpreadOnlyHint, destructiveHint, idempotentHint, openWorldHinttelegram://docs/* resourcesVia marketplace (includes skills: /setup-bot, /channel-post):
/plugin marketplace add n24q02m/claude-plugins
/plugin install better-telegram-mcp@claude-pluginsOr install this plugin only:
/plugin marketplace add n24q02m/better-telegram-mcp
/plugin install better-telegram-mcpSet credentials in ~/.claude/settings.local.json or shell profile. See Environment Variables.
Python 3.13 required -- Python 3.14+ is not supported.
/newbot, follow prompts to name your bot123456789:ABCdefGHI-JKLmnoPQRstUVwxyz)api_id (integer) and api_hash (32-char hex string){
"mcpServers": {
"telegram": {
"command": "uvx",
"args": ["--python", "3.13", "better-telegram-mcp"]
}
}
}// Cursor (~/.cursor/mcp.json), Windsurf, Cline, Amp, OpenCode
{
"mcpServers": {
"telegram": {
"command": "uvx",
"args": ["--python", "3.13", "better-telegram-mcp"]
}
}
}# Codex (~/.codex/config.toml)
[mcp_servers.telegram]
command = "uvx"
args = ["--python", "3.13", "better-telegram-mcp"]{
"mcpServers": {
"telegram": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TELEGRAM_BOT_TOKEN",
"-v", "telegram-data:/data",
"n24q02m/better-telegram-mcp"
]
}
}
}Configure credentials in ~/.claude/settings.local.json or your shell profile. See Environment Variables below.
For user mode in Docker, mount the session directory with
-v ~/.better-telegram-mcp:/dataso the session persists across container restarts.
| Tool | Actions | Description |
|---|---|---|
messages | send, edit, delete, forward, pin, react, search, history | Send, edit, delete, forward messages. Pin, react, search, browse history |
chats | list, info, create, join, leave, members, admin, settings, topics | List and manage chats, groups, channels. Members, admin, forum topics |
media | send_photo, send_file, send_voice, send_video, download | Send photos, files, voice notes, videos. Download media from messages |
contacts | list, search, add, block | List, search, add contacts. Block/unblock users (user mode only) |
config | status, set, cache_clear | Server status, update runtime settings, clear cache |
help | -- | Full documentation for any tool |
| Feature | Bot | User |
|---|---|---|
| Send/Edit/Delete/Forward messages | Y | Y |
| Pin messages, React | Y | Y |
| Search messages, Browse history | -- | Y |
| List chats, Create groups/channels | -- | Y |
| Get chat info, Manage members | Y | Y |
| Send media (photo/file/voice/video) | Y | Y |
| Download media | -- | Y |
| Contacts (list/search/add/block) | -- | Y |
| URI | Content |
|---|---|
telegram://docs/messages | Message operations reference |
telegram://docs/chats | Chat management reference |
telegram://docs/media | Media send/download reference |
telegram://docs/contacts | Contact management reference |
telegram://stats | All documentation combined |
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN | Bot mode | -- | Bot token from @BotFather |
TELEGRAM_API_ID | User mode | -- | API ID from my.telegram.org (integer) |
TELEGRAM_API_HASH | User mode | -- | API hash from my.telegram.org (32-char hex) |
TELEGRAM_PHONE | User mode | -- | Phone number with country code (e.g., +84912345678) |
TELEGRAM_AUTH_URL | No | https://better-telegram-mcp.n24q02m.com | Auth relay URL. Set local for localhost-only mode |
TELEGRAM_SESSION_NAME | No | default | Session file name (useful for multiple accounts) |
TELEGRAM_DATA_DIR | No | ~/.better-telegram-mcp | Data directory for session files |
Mode detection: If TELEGRAM_API_ID + TELEGRAM_API_HASH are set, user mode is used. Otherwise, TELEGRAM_BOT_TOKEN is used. No silent fallback -- if neither is set, the server exits with an error.
~/.better-telegram-mcp/<name>.session (600 permissions)| Auth Mode | TELEGRAM_AUTH_URL | Use case |
|---|---|---|
| Remote (default) | https://better-telegram-mcp.n24q02m.com | Headless, SSH, Docker |
| Self-hosted | https://your-domain.com | Custom relay deployment |
| Local | local | Desktop, offline |
Headless auth (Docker/SSH) -- use curl against the auth URL shown in logs:
curl -X POST http://127.0.0.1:PORT/send-code
curl -X POST http://127.0.0.1:PORT/verify -d '{"code":"12345"}'
curl -X POST http://127.0.0.1:PORT/verify -d '{"password":"your-2fa-password"}' # if 2FAgit clone https://github.com/n24q02m/better-telegram-mcp.git
cd better-telegram-mcp
uv sync
uv run better-telegram-mcp| Server | Description |
|---|---|
| wet-mcp | Web search, content extraction, and documentation indexing |
| mnemo-mcp | Persistent AI memory with hybrid search and cross-machine sync |
| better-notion-mcp | Markdown-first Notion API with 9 composite tools |
| better-email-mcp | Email (IMAP/SMTP) with multi-account and auto-discovery |
| better-godot-mcp | Godot Engine 4.x with 18 tools for scenes, scripts, and shaders |
| better-code-review-graph | Knowledge graph for token-efficient code reviews |
See CONTRIBUTING.md.
MIT -- See LICENSE.