Unofficial Telegram MCP server — read, search, reply and react in your own Telegram account.
Unofficial Telegram MCP server for the Model Context Protocol. It supports reading, searching, replying, and reacting in your own Telegram account. The project is positioned as a TypeScript-based MCP server using mtproto/gramjs-related tooling, aligned with MCP and userbot-style operation.
🛠️ Key Features
Read, search, reply, and react in a Telegram account
MCP server implementation for Telegram
Topics include model-context-protocol, telegram, and mtproto
🚀 Use Cases
Retrieve and search Telegram content via MCP
Generate responses by replying to Telegram messages
React to Telegram messages through MCP actions
⚡ Developer Benefits
Built with Node.js 18+ and TypeScript
Uses an MCP SDK (referenced as MCP SDK 1.29)
⚠️ Limitations
Unofficial: explicitly described as “Unofficial Telegram MCP server”
Operates in “your own Telegram account” (implies user-specific account access)
📖 Documentation · ☁️ Cloud version — connect Telegram to Claude.ai or ChatGPT in 30 seconds with QR code, no API keys needed.
Telegram MCP Server — a Model Context Protocol server that connects AI assistants like Claude and ChatGPT to Telegram via the MTProto protocol. Unlike bots, this runs as a userbot -- it operates under your personal Telegram account using GramJS, giving full access to your chats, contacts, and message history.
Features
Comprehensive tool coverage -- the most full-featured Telegram MCP server available
MTProto protocol -- direct Telegram API access, not the limited Bot API
Userbot -- operates as your personal account, not a bot
Full-featured -- messaging, reactions, polls, scheduled messages, stickers, media, contacts, and more
Forum Topics -- list topics, read per-topic messages, send to specific topics, per-topic unread counts
Stickers -- search sticker sets, browse installed/recent stickers, send stickers to any chat
Stats -- channel and supergroup analytics (GetBroadcastStats / GetMegagroupStats)
Boosts & Business -- boost status, boosters list, Telegram Business chat links CRUD, work hours, location, greeting/away/intro messages
Star gifts -- browse available and saved gifts, save/convert gifts, manage Stars balance and subscriptions (opt-in via MCP_TELEGRAM_ENABLE_STARS=1, v1.34.0)
Shared daemon -- one background process serves multiple MCP clients over a single Telegram session; see the shared-daemon guide (v1.38.0)
QR code login -- authenticate by scanning a QR code in the Telegram app
Session persistence -- login once, stay connected across restarts
Human-readable output -- sender names are resolved, not just numeric IDs
Works with any MCP client -- Claude Code, Claude Desktop, ChatGPT, Cursor, VS Code, Mastra, etc.
Prerequisites
Node.js 18 or later
Telegram API credentials -- API_ID and API_HASH from my.telegram.org
A QR code will appear in the terminal. Open Telegram on your phone, go to Settings > Devices > Link Desktop Device, and scan the code. The session is saved to ~/.mcp-telegram/session and reused automatically.
Custom session path: set TELEGRAM_SESSION_PATH=/path/to/session to store the session file elsewhere.
Two-step verification (2FA): if your account has a cloud password enabled, scanning the QR code is not enough — Telegram also requires the password. Provide it via TELEGRAM_2FA_PASSWORD so the login can complete:
The opposite of multiple accounts: one account driven by many clients at once — several Claude Code windows, parallel sub-agents, or multiple IDEs. Normally each process opens the same session and they evict one another with AUTH_KEY_DUPLICATED. Serve mode fixes this.
Run a single persistent daemon that owns the one Telegram connection. Every other process auto-detects the daemon (via a PID lock) and becomes a thin client that proxies tool calls to it over a local Unix socket:
bash
# On the host, once: start the daemon (owns the connection, no stdio)
TELEGRAM_API_ID=YOUR_ID TELEGRAM_API_HASH=YOUR_HASH mcp-telegram serve
# (or set MCP_TELEGRAM_DAEMON=1 instead of the `serve` argument)
Then point each MCP client at the same install with the same TELEGRAM_SESSION_PATH — no serve argument. They connect to the daemon automatically; closing any client never drops the shared connection. Credentials are only required by the daemon (the owner), so client commands can omit TELEGRAM_API_ID/TELEGRAM_API_HASH and keep them where the daemon runs.
If your VPS or hosting IP is reachable on outbound port 443 but not the default MTProto port 80 (some cloud providers ban port 80 on Telegram DC IP ranges as anti-abuse policy), set:
bash
TELEGRAM_USE_WSS=true npx @overpod/mcp-telegram
Variable
Description
TELEGRAM_USE_WSS
When true, gramJS uses port 443 instead of 80 for the MTProto TCPFull transport. Default: false. Cannot be combined with TELEGRAM_PROXY_* (gramJS limitation) — if both are set, useWSS is ignored and the proxy takes precedence (a warning is logged).
Installation Options
npx (recommended, zero install)
No need to clone or install anything. Just use npx @overpod/mcp-telegram.
Global install
bash
npm install -g @overpod/mcp-telegram
mcp-telegram # run server
mcp-telegram login # QR login
Pre-built binary (no runtime needed)
Download from Releases — standalone single-file binaries, zero dependencies:
Platform
Server
Login CLI
Linux x64
mcp-telegram-linux-x64
mcp-telegram-login-linux-x64
Linux ARM64
mcp-telegram-linux-arm64
mcp-telegram-login-linux-arm64
macOS x64
mcp-telegram-darwin-x64
mcp-telegram-login-darwin-x64
macOS ARM64
mcp-telegram-darwin-arm64
mcp-telegram-login-darwin-arm64
Windows x64
mcp-telegram-windows-x64.exe
mcp-telegram-login-windows-x64.exe
bash
# Download (example for Linux x64)
curl -L -o mcp-telegram https://github.com/mcp-telegram/mcp-telegram/releases/latest/download/mcp-telegram-linux-x64
curl -L -o mcp-telegram-login https://github.com/mcp-telegram/mcp-telegram/releases/latest/download/mcp-telegram-login-linux-x64
chmod +x mcp-telegram mcp-telegram-login
# Login
TELEGRAM_API_ID=YOUR_ID TELEGRAM_API_HASH=YOUR_HASH ./mcp-telegram-login
# Run
./mcp-telegram
From source
bash
git clone https://github.com/mcp-telegram/mcp-telegram.git
cd mcp-telegram
npm install && npm run build
Ask Claude: "Run telegram-login" -- a QR code will appear. If the image is not visible, it's also saved to ~/.mcp-telegram/qr-login.png. Scan it in Telegram (Settings > Devices > Link Desktop Device).
Ask Claude: "Run telegram-status" to verify the connection.
Note: No terminal required! Login works entirely through Claude Desktop.
Claude Desktop (Binary)
Same setup, but using the pre-built binary instead of npx:
Add these to your .env file or MCP client config to enable them.
Development
bash
npm run dev # Start with file watching (tsx)
npm start # Start the MCP server
npm run login # QR code login in terminal
npm run build # Compile TypeScript
npm run lint # Check code with Biome
npm run lint:fix # Auto-fix lint issues
npm run format # Format code with Biome
Project Structure
code
src/
index.ts -- MCP server entry point
telegram-client.ts -- TelegramService class (GramJS wrapper)
qr-login-cli.ts -- CLI utility for QR code login
tools/ -- Modular tool definitions
auth.ts -- Connection & login
messages.ts -- Send, read, search, edit, delete, forward; inline bots; real-time polling
chats.ts -- Chat listing, group management, admin toggles, stats
contacts.ts -- Contacts, profiles, moderation
media.ts -- Files, photos, downloads
reactions.ts -- Reactions, set-chat-reactions
extras.ts -- Pin, schedule, polls, topics
stickers.ts -- Sticker sets, send, search, browse
account.ts -- Sessions, privacy, auto-delete, profile, emoji status, birthday, chat mute/folders, invite links
business.ts -- Telegram Business: chat links CRUD, work hours, location, greeting/away/intro
boosts.ts -- Boost status, my boosts, boosters list
stories.ts -- Stories: list all, peer, by-id, view stats
group-calls.ts -- Group call info and participants (opt-in: MCP_TELEGRAM_ENABLE_GROUP_CALLS)
stars.ts -- Stars wallet status and transactions (opt-in: MCP_TELEGRAM_ENABLE_STARS)
quick-replies.ts -- Quick replies and messages (opt-in: MCP_TELEGRAM_ENABLE_QUICK_REPLIES)
shared.ts -- Shared utilities
A Telegram session can only be used by one process at a time. If you get AUTH_KEY_DUPLICATED, it means another process is already using the same session file.
Solution: Create separate sessions for each environment:
bash
# Local development
TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-local npx @overpod/mcp-telegram login
# Production server
TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-prod npx @overpod/mcp-telegram login
Then set TELEGRAM_SESSION_PATH in each environment's MCP config accordingly.
Security
API credentials are stored in .env (gitignored)
Session is stored in ~/.mcp-telegram/session with 0600 permissions (owner-only access)
Session directory is created with 0700 permissions
Phone number is not required -- QR-only authentication
No data is sent to third-party services -- all communication goes directly to Telegram servers via MTProto
QR login codes are generated locally and never leave your machine
One session per process -- using the same session in multiple processes simultaneously causes AUTH_KEY_DUPLICATED errors (see Troubleshooting)