telegram-mcp-connector
Reads and searches your own Telegram account over MTProto, providing tools to list chats, fetch message history and context, run full-text search across one or all chats, view unread messages, and get chat info. Optionally, with write access enabled, can send messages and mark chats as read.
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-mcp-connector what did I miss in Telegram today?"
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-connector
An MCP server that lets Claude (Claude Code, Claude Desktop) read and search your own Telegram account, and, if you turn it on, send messages from it.
It logs in as you over MTProto (via Telethon), not as a bot, so Claude sees the same chats you do.
Security. The session file gives full access to your Telegram account. It stays on your machine, in
.data/inside this folder, with mode0600, and is never committed. Write access is off by default.
Tools
Tool | What it does |
| Which account is connected |
| Chats with unread counts and a last-message preview; can filter by type or unread, or list the Archive |
| A chat's history, filterable by date range or sender, with pagination |
| A message plus its neighbours (handy after a search hit) |
| Server-side full-text search in one chat or in all chats |
| Unread messages grouped by chat (does not mark them read) |
| Bio/description, member count, etc. |
| Send text as you. Only to chats on the allowlist |
| Mark a chat as read |
✋ These tools only exist when TG_ALLOW_WRITE=true.
A chat argument accepts a numeric id, @username, a t.me link, me
(Saved Messages) or a chat title.
Related MCP server: Telegram MCP Server
Install
Everything installs inside this folder: the virtualenv in .venv/, the uv
cache in .uv-cache/ (see uv.toml), and the session and config in .data/.
Deleting the folder removes all of it. Requires uv
and Python ≥ 3.11.
git clone https://github.com/nitatsuu/telegram-mcp-connector.git
cd telegram-mcp-connector
uv sync1. Get API credentials
Go to https://my.telegram.org, open API development tools, and create an
app (any name). You get an api_id and an api_hash.
2. Log in (once)
uv run telegram-mcp-connector loginIt asks for api_id/api_hash (saved to .data/.env), then your phone number,
the code Telegram sends you, and your 2FA password if you use one. The device
shows up as telegram-mcp-connector under Telegram → Settings → Devices.
Check the result:
uv run telegram-mcp-connector status3. Connect to Claude
Claude Code:
claude mcp add telegram -s user -- uv run --directory "$(pwd)" telegram-mcp-connectorClaude Desktop: add this to claude_desktop_config.json, using absolute paths:
{
"mcpServers": {
"telegram": {
"command": "/opt/homebrew/bin/uv",
"args": ["run", "--directory", "/path/to/telegram-mcp-connector", "telegram-mcp-connector"]
}
}
}Then ask Claude something like "what did I miss in Telegram today?" or "find where Alex sent the contract".
Enabling writes
Edit .data/.env:
TG_ALLOW_WRITE=true
# ids and/or @usernames, comma-separated. "me" = Saved Messages, "*" = any chat.
TG_SEND_ALLOWLIST=me, @alice, -1001234567890Restart Claude (or the MCP server) for the change to take effect. Get chat ids
from list_chats.
Why the allowlist: messages Claude reads are written by other people. A message could contain instructions aimed at an AI. The server tells Claude to ignore such instructions, Claude asks before calling write tools, and the allowlist adds a hard limit on top of both.
Configuration
Values are read from environment variables, then from <data dir>/.env.
Environment variables take priority.
Variable | Default | |
| — | From my.telegram.org |
|
| Expose |
| empty | Where |
|
| Session and config location |
Uninstall
uv run telegram-mcp-connector logout # revokes the session on Telegram's side
claude mcp remove telegram -s user # if added to Claude Code
cd .. && rm -rf telegram-mcp-connectorYou can also revoke the session from Telegram → Settings → Devices.
Notes
Only one process can use the session at a time (it is an SQLite file). If
loginorstatusreports database is locked, close Claude first.Telegram rate limits: short flood waits are slept through automatically. This tool is meant for personal use, not bulk messaging.
Development
uv run pytestLicense
MIT
Available Tools
7 toolsget_chat_infoGet Chat InfoCRead-only
Details about a chat or person: bio/description, member count, etc.
Inputs: chat (required). Returns: object
get_message_contextGet Message ContextARead-only
Show a message together with the messages around it (e.g. after a search hit).
Inputs: chat (required), message_id (required), radius. Returns: object
get_messagesGet MessagesARead-only
Read the latest messages of a chat, returned oldest to newest.
If older_messages_before_id is present, pass it as before_id to page back.
Inputs: chat (required), limit, since, until, +2 more. Returns: object
get_unreadGet UnreadARead-only
Unread messages grouped by chat (main list, not Archive). Does not mark anything as read.
Inputs: per_chat, max_chats, include_muted. Returns: result
list_chatsList ChatsBRead-only
List chats in the order Telegram shows them (most recent first), with unread counts and a preview of the last message.
Inputs: kind, limit, archived, unread_only. Returns: result
search_messagesSearch MessagesBRead-only
Full-text search (Telegram server-side search), newest first.
Inputs: query (required), chat, limit. Returns: object
whoamiWhoamiARead-only
Show which Telegram account is connected.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools target clearly distinct needs (account identity, chat listing, message listing, search, unread aggregation, chat metadata). The closest overlap is get_messages vs get_message_context vs get_unread, but descriptions clarify that one pages through a chat, one shows a window around a message, and one aggregates unread across chats.
Six of seven tools follow a predictable verb_noun pattern (list_chats, get_messages, get_message_context, search_messages, get_unread, get_chat_info). The lone 'whoami' is a conventional but inconsistent exception that breaks the pattern slightly.
Seven tools is a reasonable, well-scoped surface for a read-oriented Telegram connector, with no obviously redundant entries. It sits comfortably in the typical 3-15 range and each tool maps to a distinct read operation.
The surface is entirely read-only: there is no send_message, reply, or mark-as-read operation, which are core Telegram actions an agent would expect from a connector. Reading is well covered (list, page, search, context, unread, metadata), but the missing write side is a significant gap that will cause agent failures for common tasks.
Maintenance
Related MCP Connectors
Your Telegram, WhatsApp, Instagram, mail and calendar in Claude or ChatGPT. Never sends messages.
Your own WhatsApp in Claude and ChatGPT: read chats, draft replies, send messages you approve.
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Let Claude or ChatGPT search, read and send your WhatsApp messages over MCP. OAuth sign-in.
Related MCP Servers
- AlicenseAqualityBmaintenanceRead-only Telegram access for Claude and other MCP hosts. Provides tools to list chats, read recent messages, and download media from your own Telegram account without needing an api_id/api_hash.566 npmMIT
- FlicenseNot gradedqualityFmaintenanceEnables Claude to interact with your Telegram account, including reading messages, searching conversations, and sending messages.-
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with Telegram, including listing chats, reading messages, sending messages, searching, and managing contacts.1-
- AlicenseNot gradedqualityDmaintenanceConnect Claude to your personal Telegram account via MTProto to read messages, search chats, send replies, forward files, and more using your real account.6 npm3MIT