telegram-mcp
Operates a personal Telegram account (via Telethon), giving full access to any chat, bot, group, or channel. Provides tools for listing dialogs and members, reading message history, comments, stories, and profiles; sending and editing text or files (including albums), forwarding, deleting, marking read, joining chats, and setting typing/other statuses. Can press any inline or reply-keyboard button (callbacks, links, phone/location requests), start bots with deep-link payloads, run inline bot queries, wait for new messages and edits, download media, and, when explicitly enabled, call any raw Telegram API method. Supports multiple accounts with per-account prompts, a default account, and account switching per session.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@telegram-mcpsend 'running 10 min late' to the team chat"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
telegram-mcp
An MCP server for Telegram on Telethon: works from your own account with any chat, bot, group or channel — read, write, press any button, wait for replies and edits, download media, use inline bots and, if you enable it, any raw Telegram API method.
Works as a regular stdio MCP server: in Claude Code, in Claude Desktop and in any MCP client.
Install — one command
curl -fsSL https://raw.githubusercontent.com/AlexB00M/telegram-mcp/main/install.sh | bashInstalls the server with uv and registers it in Claude Code and
Claude Desktop. Options: --name (server name, default telegram), --with PATH (an extra
package, e.g. jarvis-mcp for voice commands), --login (sign in right away in the terminal).
From a clone: ./install.sh. Needs Python ≥ 3.10.
Related MCP server: telegram-mcp
Accounts — several, managed on a page
Ask Claude: "log in to Telegram" or "open Telegram accounts". A local page opens in your browser (127.0.0.1, random port, one-time token), styled like Telegram:
the list of accounts with avatar, @username, masked phone and status;
add an account — api_id / api_hash, phone, the code Telegram sends and the two-step password if you have one; the page shows step by step where to get api_id / api_hash (https://my.telegram.org → API development tools → Create application);
make default — the account tools use unless a session picked another;
sign out and delete — ends the session on Telegram's side and deletes the account's session file and its api_id / api_hash from the computer.
Codes, passwords and api_hash go from the browser straight to the server — never through Claude,
and the page never shows an api_hash back. From a terminal: telegram-mcp-login adds an account.
Each account is its own folder ~/.telegram-mcp/accounts/<name>/ (0700): session.session —
this is access to the account — and account.json with its api_id / api_hash. Common settings
(aliases, default chat, proxy) are in ~/.telegram-mcp/config.json. A single session from older
versions moves into an account by itself.
Account prompts. Each account can have a prompt — what the account is, when to use it and what
to do in it ("Work: shop clients and orders. Formal tone, no emoji"). Edit it on the page or ask
Claude (tg_account_prompt). Claude gets the accounts and their prompts in the server
instructions at session start and in tg_accounts, and picks the account that fits the request.
Which account. The default one is used unless a session picked another; change it on the page
or by command (tg_set_default_account) — it applies at once, nothing restarts.
tg_use_account("work") makes only this MCP session act as another account;
TG_MCP_ACCOUNT=work pins an MCP server entry to one account.
One daemon per machine
A Telegram session is one SQLite file. If every MCP process (each Claude Code session, Claude
Desktop, a voice assistant) opened it itself, they would fail with "database is locked" while
another one holds a write. So only a daemon holds the session, and each telegram-mcp is a thin
front: tool calls go to the daemon over ~/.telegram-mcp/daemon.sock.
The daemon starts by itself on the first call and exits after TG_MCP_IDLE_S seconds
without calls (default 600): when nobody uses Telegram there is no process, no connection, no
CPU. Log: ~/.telegram-mcp/daemon.log. TG_MCP_NO_DAEMON=1 runs everything in-process (tests,
debugging).
Connect by hand
claude mcp add -s user telegram telegram-mcp{ "mcpServers": { "telegram": { "command": "telegram-mcp" } } }Tools
Service
tool | what it does |
| authorization, account, aliases, proxy, paths — call it first when something fails |
| add an account / sign in again: the accounts page on its sign-in form |
| the accounts page: list, add, make default, sign out and delete |
| accounts: name, @username, prompt, default, which one this session uses |
| act as another account in this session (empty — back to the default) |
| make an account the default for everyone, at once |
| set an account's prompt: what it is, when to use it, what to do in it |
| reconnect (session dropped, proxy changed) |
| chats with id, @username, type, unread; filter, bots only |
| info about a chat or bot: description, the bot's commands |
| group members: search by name/username, "is @user in this chat" |
| short names for chats and the default chat |
Reading
tool | what it does |
| messages: limit, search, ids, from whom, media filter, paging, download |
| what can be pressed right now: the reply keyboard + inline buttons with indexes |
| the thread under a channel post |
| a channel's discussion group |
| wait for new messages and edits, optionally until a regex matches |
| download media by ids or the last N |
| a user's / group's / channel's avatar (history with |
| active stories (gone in 24 h), archive, by id; with download |
| stories saved to a profile; with download |
Actions
tool | what it does |
| send text (reply, md/html, no preview, silent) and wait for the answer |
| send a file / photo / video / voice; several — as an album |
| press any button by text / regex / index / row+col |
|
|
| a bot's inline mode ( |
| edit / delete / forward |
| mark as read; "typing…" and other statuses |
| join a channel or group by @username or t.me/+hash |
| any Telegram API method (off by default) |
Most actions take wait (seconds to wait for an answer, 0 — don't) and download (fetch media
from the answer). The answer comes in reply; edited messages carry "event": "edited".
Buttons
tg_buttons lists everything that can be pressed; then tg_click with button: "like"
(substring), button: "^Open" (regex), button: "1" (index) or row/col:
callback— really pressed;bot_answer(the popup text) and the message's edits come back;text/ reply keyboard — sent as the button's text;url/webview— the link is returned, no browser opens;switch_inline— usetg_inline_query;request_phone/request_location/request_peergive the bot your phone, location or a contact, so they need an explicitallow_sensitive: true.
A reply keyboard arrives only in the message that set it, so the server remembers it in
~/.telegram-mcp/keyboards.json — one entry per chat, only button rows and the message id, never
message texts; at most 200 chats (TG_MCP_KB_MAX_PEERS).
Where downloads go
type | folder |
photos, avatars |
|
video, round videos, gif |
|
voice, music |
|
documents, stickers, other |
|
Inside — a subfolder per source: users/<who>, chats/<chat>, channels/<channel>,
bots/<bot>. tg_status always shows the current paths.
Environment
variable | default | |
| the default account | the account this MCP server entry uses |
| — | the chat when |
| — |
|
|
| enable |
|
| config, session, media |
|
| the daemon exits after this many seconds without calls |
|
|
|
|
| the media subfolder name |
|
| media roots |
|
| files per call |
|
| seconds |
|
| logs go to stderr |
Worth knowing
This is a self-bot on your own account. Telegram treats bursts of automated actions as spam — keep pauses, especially for mass clicks and messages.
session.sessionis full access to the account. Never commit or share it. Revoke: delete the account on the accounts page, or Telegram → Settings → Devices → end thetelegram-mcpsession.tg_rawcan do literally anything, including irreversible things, so it is off by default.
Voice commands (optional)
With jarvis-mcp — the SDK of the Jarvis voice assistant — installed next to the server
(./install.sh --with path/to/jarvis-mcp), the server also publishes fast voice commands in
Russian («непрочитанные», «прочитай сообщения от мамы», «напиши маме в телеграм …» — the last one
with confirmation). Without it this is a plain MCP server.
Development
uv sync && uv run pytestMIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Hosted Telegram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables reading chats, messages, and media and sending messages/files via a Telegram user account (MTProto/Telethon), supporting group history and media that bots cannot access.81MIT
- FlicenseBqualityBmaintenanceProvides full access to a personal Telegram account via MTProto, enabling MCP clients to read chats, send messages, manage media, and more.70-
- FlicenseNot gradedqualityCmaintenanceEnables users to interact with their own Telegram account through MTProto, supporting chat listing, message reading and searching, sending messages, and fetching contacts via MCP tools.-
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to drive a real Telegram account, exposing chats, messages, media, secret chats, admin rights, invite links, Mini Apps, and multi-account routing as callable tools.8GPL 3.0