Connect AI assistants like Claude to Telegram via the MTProto protocol
MCP Telegram
Hosted version available! Don't want to self-host? Use mcp-telegram.com -- connect Telegram to Claude.ai or ChatGPT in 30 seconds with QR code. No API keys needed.
An MCP (Model Context Protocol) server that connects AI assistants like Claude 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
- 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, media, contacts, and more
- Forum Topics -- list topics, read per-topic messages, send to specific topics, per-topic unread counts
- 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_IDandAPI_HASHfrom my.telegram.org
Quick Start
1. Get Telegram API credentials
- Go to my.telegram.org and log in with your phone number.
- Navigate to API development tools.
- Create a new application (any name and platform).
- Copy the App api_id and App api_hash.
2. Login
TELEGRAM_API_ID=YOUR_ID TELEGRAM_API_HASH=YOUR_HASH npx @overpod/mcp-telegram login
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/sessionto store the session file elsewhere.
3. Add to Claude
claude mcp add telegram -s user \
-e TELEGRAM_API_ID=YOUR_ID \
-e TELEGRAM_API_HASH=YOUR_HASH \
-- npx @overpod/mcp-telegram
That's it! Ask Claude to run telegram-status to verify.
Multiple Accounts
Use TELEGRAM_SESSION_PATH to run separate Telegram accounts side by side:
# Login each account with a unique session path
TELEGRAM_API_ID=ID1 TELEGRAM_API_HASH=HASH1 TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-work npx @overpod/mcp-telegram login
TELEGRAM_API_ID=ID2 TELEGRAM_API_HASH=HASH2 TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-personal npx @overpod/mcp-telegram login
Then add each as a separate MCP server:
claude mcp add telegram-work -s user \
-e TELEGRAM_API_ID=ID1 \
-e TELEGRAM_API_HASH=HASH1 \
-e TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-work \
-- npx @overpod/mcp-telegram
claude mcp add telegram-personal -s user \
-e TELEGRAM_API_ID=ID2 \
-e TELEGRAM_API_HASH=HASH2 \
-e TELEGRAM_SESSION_PATH=~/.mcp-telegram/session-personal \
-- npx @overpod/mcp-telegram
Each account gets its own session file — no conflicts.
Installation Options
npx (recommended, zero install)
No need to clone or install anything. Just use npx @overpod/mcp-telegram.
Global install
npm install -g @overpod/mcp-telegram
mcp-telegram # run server
mcp-telegram login # QR login
From source
git clone https://github.com/overpod/mcp-telegram.git
cd mcp-telegram
npm install && npm run build
Usage with MCP Clients
Claude Code (CLI)
claude mcp add telegram -s user \
-e TELEGRAM_API_ID=YOUR_ID \
-e TELEGRAM_API_HASH=YOUR_HASH \
-- npx @overpod/mcp-telegram
Claude Desktop
Open your config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
Add the
Tools (1)
telegram-statusVerify the connection status of the Telegram MCP server.Environment Variables
TELEGRAM_API_IDrequiredApp api_id from my.telegram.orgTELEGRAM_API_HASHrequiredApp api_hash from my.telegram.orgTELEGRAM_SESSION_PATHCustom path to store the session fileConfiguration
{"mcpServers": {"telegram": {"command": "npx", "args": ["-y", "@overpod/mcp-telegram"], "env": {"TELEGRAM_API_ID": "YOUR_ID", "TELEGRAM_API_HASH": "YOUR_HASH"}}}}