telegram-mcp-server
This server provides programmatic control over a Telegram user account (not a bot), enabling full access to chat history, media, and messaging via the MCP protocol.
Account check (
get_me): Retrieve the logged-in user's details (id, username, name, phone) and verify the session is valid.List chats (
list_chats): Browse groups, channels, and direct messages, with optional keyword filtering and configurable limits (up to 500).Read messages (
get_messages): Fetch recent messages from a specific chat, with pagination (before_id) and full-text filtering.Search messages (
search_messages): Search by text globally across all chats or within a specific chat; results includechat_idfor follow-up calls.Download specific media (
download_media): Download media from specific messages (by message ID) to a local directory.Download recent media (
get_recent_media): Bulk-download the most recent media from a chat, with optional type filtering (photo,video,document,other).Send text messages (
send_message): Send a text message to any chat (group, channel, or DM) as the logged-in user.Send files (
send_file): Upload and send a local file (image or document) to any chat, with an optional caption.
Provides tools for reading chats, messages, and media, and sending messages and files via Telegram using a user account.
Click on "Install 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-mcp-serverget last 5 messages in group 'Test Group'"
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-server
MCP-Server für Telegram über einen User-Account (MTProto/Telethon). Liest Chats/Nachrichten/Medien und sendet Nachrichten/Dateien. Läuft lokal über stdio.
Warum User-Account statt Bot?
Ein Bot kann keine Gruppen-Historie und keine vor seinem Beitritt geposteten
Medien lesen (und hat ein 20-MB-Download-Limit). Für „hol mir die Bilder aus der
Gruppe" braucht es einen User-Client. Session-Datei = voller Account-Zugriff →
lokal halten, chmod 600, nie committen.
Related MCP server: Telegram MCP Server
Setup
API-Credentials auf https://my.telegram.org (API development tools) erzeugen.
Repo installieren (venv + editierbar; Python ≥3.10):
python3 -m venv .venv .venv/bin/pip install -e .Environment setzen:
export TELEGRAM_API_ID=... export TELEGRAM_API_HASH=... export TELEGRAM_PHONE=+49... # nur für den Login nötig # optional: export TELEGRAM_SESSION="$HOME/.telegram-mcp/telegram.session" export TELEGRAM_DOWNLOAD_DIR="$HOME/Downloads/telegram-mcp"Einmalig einloggen (erzeugt die Session-Datei, fragt Code + ggf. 2FA):
.venv/bin/python -m telegram_mcp_server.login
In Claude Code registrieren
claude mcp add telegram \
-e TELEGRAM_API_ID=... \
-e TELEGRAM_API_HASH=... \
-e TELEGRAM_SESSION="$HOME/.telegram-mcp/telegram.session" \
-- /ABSOLUTER/PFAD/telegram-mcp-server/.venv/bin/telegram-mcp-serverDie -e-Flags sind nötig, weil ein von Claude Code gestarteter MCP-Server die
Shell-exports aus dem Setup NICHT erbt. Alternativ die env-Sektion in der
MCP-Konfiguration nutzen. TELEGRAM_DOWNLOAD_DIR optional per weiterem -e setzen.
Nach dem Registrieren eine neue Claude-Code-Session starten, damit der Server erscheint.
Tools
Tool | Zweck |
| Whoami / Session-Check |
| Chats auflisten (Gruppe/Kanal/DM) |
| Nachrichten eines Chats lesen |
| Nachrichten suchen (global oder im Chat) |
| Medien gezielter Nachrichten laden |
| Letzte N Medien eines Chats laden |
| Textnachricht senden |
| Datei/Bild senden |
chat akzeptiert Chat-id, @username oder (Teil-)Titel; bei mehrdeutigem Titel
kommt ein Fehler mit den Treffern statt einer Rate-Auflösung.
get_messages/search_messages liefern pro Nachricht auch chat_id mit —
Treffer aus der globalen Suche sind damit direkt in weiteren Tool-Aufrufen
(z.B. download_media) verwendbar.
Entwicklung / Tests
python3 -m venv .venv && .venv/bin/pip install -e ".[test]"
.venv/bin/python -m pytest tests/ -vTests laufen ohne Live-Account (Client wird gemockt).
Smoke-Test (einmalig nach Login, mit echtem Account)
.venv/bin/python -m telegram_mcp_server.login # 1) Session erzeugen
# 2) get_me / list_chats / get_messages / download_media manuell über den
# MCP-Client (Claude Code) prüfen:
# - get_me -> zeigt deinen Account
# - list_chats query="<gruppe>" -> findet eine deiner Gruppen
# - get_messages chat=<id> limit=5 -> liefert Nachrichten
# - search_messages query="..." -> globale Suche (übt _search_global live aus;
# Treffer müssen chat_id tragen)
# - get_recent_media chat=<id> kind="photo" -> lädt Fotos nach $TELEGRAM_DOWNLOAD_DIRErster echter Integrationstest = ein Medienabruf aus einer deiner Gruppen. Die globale search_messages
(ohne chat) ist der einzige Pfad, der _search_global/SearchGlobalRequest real ausführt —
im Smoke-Test nicht überspringen.
Maintainer
Schimmi — https://schimmilab.de Issues und Pull Requests willkommen.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables full access to your personal Telegram account via MCP, allowing reading, sending, and searching messages, managing chats, and retrieving user information through natural language commands.Last updated272MIT
- Alicense-qualityCmaintenanceEnables AI assistants to interact with Telegram accounts, chats, messages, media, and more via MCP, using Telethon.Last updatedApache 2.0
- Alicense-qualityCmaintenanceEnables AI agents to interact with a user's Telegram account: list chats, read history, search, and send messages through Telegram's MTProto API.Last updated1MIT
- Flicense-qualityBmaintenanceEnables AI agents to control a real Telegram user account via MTProto, allowing message sending, chat reading/searching, and message management through MCP tools.Last updated40
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
MemberPass MCP — manage projects, plans, members, payments, and analytics for Telegram creators.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Schimmilab/telegram-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server