Telegram
chigwell/telegram-mcp · 1.1k stars · Python · Apache-2.0
MCP server Telegram MCP server powered by Telethon to let MCP clients read chats, manage groups, and send/modify messages, media, contacts, and settings.
Install
uv run telegram-mcp-migrate-sessionThese repos do not share one command. When an entry shows a command, it was copied as published. Check the repo's README before you run it.
Files
A Telegram integration for Claude, Cursor, and other MCP-compatible clients. It exposes Telegram account, chat, message, contact, media, folder, and admin operations through the Model Context Protocol using Telethon.
🤖 MCP in Action
Basic Telegram MCP usage in Claude:
Asking Claude to analyze chat history and send a response:
Message sent successfully:
Contents
- Skills & Practical Workflows
- What It Can Do
- Requirements
- Quick Start
- MCP Client Configuration
- Multi-Account Setup
- Device Identity
- Expected Account Check
- Proxy Support
- File Path Security
- Chat Access Privacy (Allowlist)
- Docker
- Development
- Security Notes
- Troubleshooting
- License
Skills & Workflows
Looking for ready-to-use workflows, prompt examples, or integration recipes? Explore the Skills Documentation for step-by-step guides on:
- Summarizing unread messages safely
- Drafting replies without sending
- Triaging action items & urgent requests
- Searching chat history and expanding context
What It Can Do
The server currently includes 80+ MCP tools grouped into these areas:
- Accounts: list configured accounts and route tool calls by account label.
- Chats and groups: list chats, inspect metadata, create groups/channels, join or leave chats, invite or remove users, manage admins, bans, default permissions, slow mode, topics, invite links, common chats, read receipts, and message links.
- Messages: send, schedule, edit, delete, forward, pin, unpin, mark read, reply, search, inspect context, create polls, manage reactions, inspect inline buttons, and press inline callbacks.
send_message,reply_to_message, andedit_messagesupport classic formatting (parse_mode='md'/'html') and server-side rich formatting (parse_mode='rich'/'rich_markdown'/'rich_html'— full Markdown/HTML with tables, headings, formulas, and collapsible sections). Rich modes require Telegram Premium on the account; Premium is re-checked on every call, and without it nothing is sent — the tool returns a structuredtelegram_premium_requiredresult so the agent can reformat with classic modes and retry.send_message,reply_to_message, andedit_messagealso acceptformat_dateto render a date as a tappable chip.
get_message_reactions returns an empty list for a message with no reactions. To reuse a custom reaction, pass the returned custom:<document_id> value to send_reaction.
- Contacts: list, search, add, delete, block, unblock, import, export, inspect direct chats, find recent contact interactions, and remember contacts by the names you actually use (see below).
Remembered contacts
set_contact_alias teaches the server what you call someone, and every tool that takes a chat_id understands it from then on — send_message("андрей бекендер", ...) just works. A contact can carry any number of aliases, which is how tags work: save both андрей бекендер and бекендер for the same person and either resolves.
Only an exact saved wording ever sends. Similar wording (Андрею бекендеру for a saved андрей бекендер) is matched too, but only to suggest: the tool sends nothing and asks you to confirm the contact by name. This is deliberate — Лена/Леня and Иван/Иванов differ exactly as much as a case ending does, so a matcher confident enough to handle declensions is also confident enough to message the wrong person whenever the one you meant is not saved yet. Confirming saves that wording as its own alias, so each new phrasing costs one yes/no the first time and nothing ever again. Set TELEGRAM_CONTACT_FUZZY=0 to drop the suggestions too.
When a reference is unknown, resembles one contact, matches several, or points at a contact that no longer resolves, tools send nothing and return a structured instruction telling the agent exactly what to ask you, to save the answer with set_contact_alias, and to retry once. list_contact_aliases shows one row per person with all their aliases (use it to spot a wrong memory), delete_contact_alias forgets one, and repointing an alias at someone else requires replace=True. The save path itself refuses a target it would have to guess at: contacts are saved by @username, phone, numeric ID, or an alias already confirmed for them.
Aliases live in ${XDG_STATE_HOME:-~/.local/state}/telegram-mcp/aliases.json (owner-only, written atomically); TELEGRAM_ALIASES_FILE overrides the path, and a pre-existing aliases.json next to the code is still read as a fallback.
- Media: send files, download media, upload files, send voice notes, stickers, GIFs, inspect message media, and transcribe voice messages/video notes (see below).
Voice transcription
transcribe_voice(chat_id, message_id, engine=None) turns a voice message or video note into text. Four engines are available:
groq(default): uploads the recording to Groq's hostedwhisper-large-v3-turbo. Leaves the server and costs a download+upload per call, but doesn't drop the recording's last few words the way native transcription does. RequiresGROQ_API_KEY. Groq caps the size of a single upload, so a recording aboveTELEGRAM_TRANSCRIBE_GROQ_MAX_MB(default 25, the free-tier limit) is refused locally with atoo_largeerror naming its size instead of being downloaded and rejected by the API. Raise the limit if your Groq tier allows bigger files, or transcribe that message withengine='telegram', which has no such cap.telegram: native Telegram Premium transcription (messages.TranscribeAudioRequest). Free and never leaves Telegram, but empirically drops the last speech segment in roughly 2 of 3 recordings and requires Telegram Premium on the account. Long recordings come backpendingand are polled automatically.openai: any OpenAI-compatible/audio/transcriptionsendpoint — OpenAI itself, a self-hosted Parakeet or speaches server, LocalAI, a vLLM Whisper deployment, and so on. SetTELEGRAM_TRANSCRIBE_OPENAI_URLto the API base URL (e.g.https://api.openai.com/v1; a full.../audio/transcriptionsURL also works),TELEGRAM_TRANSCRIBE_OPENAI_API_KEYfor the bearer token (optional for keyless local servers), andTELEGRAM_TRANSCRIBE_OPENAI_MODEL(defaultwhisper-1). Size cap:TELEGRAM_TRANSCRIBE_OPENAI_MAX_MB(default 25). For Parakeet useTELEGRAM_TRANSCRIBE_OPENAI_URL=http://localhost:5092/v1, the API key only if the server setsPARAKEET_API_KEY, and setTELEGRAM_TRANSCRIBE_LANGUAGEfor anything that isn't English — Parakeet assumesenwhen no language is sent.whisper: a local faster-whisper model loaded inside the MCP server process. The audio never leaves the machine. Install the extra withpip install 'telegram-mcp[whisper]'(oruv sync --extra whisper).TELEGRAM_TRANSCRIBE_WHISPER_MODELpicks the model (defaultsmall; e.g.large-v3-turbofor better quality),TELEGRAM_TRANSCRIBE_WHISPER_DEVICE(auto/cpu/cuda),TELEGRAM_TRANSCRIBE_WHISPER_COMPUTE_TYPE(e.g.int8on CPU) andTELEGRAM_TRANSCRIBE_WHISPER_MODEL_DIR(where models are downloaded) tune it. The model is loaded once on first use and recordings are transcribed one at a time. Not available in the Alpine Docker image; useopenaiagainst a Parakeet or other OpenAI-compatible server next to the container instead.
TELEGRAM_TRANSCRIBE_LANGUAGE (ISO-639-1, e.g. nl) is passed as a language hint to every engine except telegram; unset, the engines auto-detect. TELEGRAM_TRANSCRIBE_TIMEOUT (default 120 seconds) bounds a single request to the HTTP engines (groq, openai).
Facts
- Kind
- MCP server
- Repo
- chigwell/telegram-mcp
- Group
- Uncategorized
- Stars
- 1.1k
- License
- Apache-2.0
- Language
- Python
- Last push
- 2026-10-09
- Forks
- 461
- Topics
- admin, api, chat-management, contacts, groups, mcp, media, messaging, search, telegram, telegram-api, telegram-client, telethon
- 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
- 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
- 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
- 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
- 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k