You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_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.
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
Ask Claude: "Run telegram-login" -- a QR code will appear. If the image is not visible, Claude will provide a browser link to view the QR code. 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.
Cursor / VS Code
Add the same JSON config above to your MCP settings (Cursor Settings > MCP, or VS Code MCP config).
Username (@group), link (t.me/group), or invite link (t.me/+xxx)
telegram-send-reaction
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username
messageId
number
yes
Message ID to react to
emoji
string
no
Reaction emoji (e.g. 👍❤️🔥😂🎉). Omit to remove reaction
telegram-send-scheduled
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username (use "me" or "self" for Saved Messages)
text
string
yes
Message text
scheduleDate
number
yes
Unix timestamp when to send (must be in the future)
replyTo
number
no
Message ID to reply to
parseMode
"md" / "html"
no
Message formatting mode
telegram-create-poll
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username
question
string
yes
Poll question
answers
string[]
yes
Answer options (2-10 items)
multipleChoice
boolean
no
Allow multiple answers (default: false)
quiz
boolean
no
Quiz mode with one correct answer (default: false)
correctAnswer
number
no
Index of correct answer, 0-based (required for quiz mode)
telegram-search-messages
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username
query
string
yes
Search text
limit
number
no
Max results (default: 20)
telegram-search-chats
Parameter
Type
Required
Description
query
string
yes
Search query (name or username)
limit
number
no
Max results (default: 10)
telegram-get-chat-members
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username
limit
number
no
Number of members (default: 50)
telegram-get-contacts
Parameter
Type
Required
Description
limit
number
no
Number of contacts (default: 50)
telegram-get-profile
Parameter
Type
Required
Description
userId
string
yes
User ID or @username
telegram-get-unread
Parameter
Type
Required
Description
limit
number
no
Number of unread chats (default: 20)
telegram-get-contact-requests
Parameter
Type
Required
Description
limit
number
no
Number of contact requests (default: 20)
telegram-add-contact
Parameter
Type
Required
Description
userId
string
yes
User ID or @username to add
firstName
string
yes
First name for the contact
lastName
string
no
Last name for the contact
phone
string
no
Phone number for the contact
telegram-block-user
Parameter
Type
Required
Description
userId
string
yes
User ID or @username to block
telegram-report-spam
Parameter
Type
Required
Description
chatId
string
yes
Chat ID or @username to report
Development
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
src/
index.ts -- MCP server entry point, tool definitions
telegram-client.ts -- TelegramService class (GramJS wrapper)
qr-login-cli.ts -- CLI utility for QR code login
Connect Telegram to Claude AI — messages, media, reactions, polls, scheduled messages & more. Hosted version: mcp-telegram.com (QR login, 30 sec setup). Built on GramJS/MTProto.