telegram-briefing-mcp
A read-only Telegram MCP server that retrieves messages from your DMs, groups, and channels, enabling Claude to generate executive briefings from Telegram conversations.
README
telegram-briefing-mcp
A read-only Telegram connector exposed as an MCP server. It pulls the messages you care about — last day, last week, today, unread, or a custom range — across your DMs, groups, and (optionally) channels, and hands them to Claude grouped by conversation, ready to fold into an executive briefing.
There's no native Telegram connector for Claude, so this fills the gap the same way the official Telegram apps do: it connects through Telegram's MTProto user API (via Telethon). That means it reads your real conversations — not just bot chats, which is all the Telegram Bot API can ever see.
Read-only by design. There is no tool that sends, edits, deletes, marks-read, joins, or leaves anything. This connector observes; it never acts on your account.
How it connects (and why not a bot)
| Approach | Can read your DMs/groups? | Notes |
|---|---|---|
| Bot API | ❌ | A bot only sees chats it's explicitly added to. Useless for "summarize my messages." |
| MTProto user API (this project) | ✅ | Authenticates as you — the same protocol Telegram Desktop / Web speak. Sees everything you see. |
You authorize once with your phone number; Telegram sends a login code to your existing app, exactly like signing in on a new device.
Setup
1. Get your Telegram API credentials (one time, ~2 min)
- Sign in at https://my.telegram.org with your phone number.
- Open API development tools and create an app (any name; platform Desktop).
- Copy the
api_idandapi_hashit shows you.
These identify the client app to Telegram (like the keys the official apps ship with). They are not your login.
2. Install
Requires Python ≥ 3.11.
cd telegram-briefing-mcp
python3 -m venv .venv
.venv/bin/python -m pip install -e .
3. Configure
cp .env.example .env
# edit .env and set TELEGRAM_API_ID and TELEGRAM_API_HASH
(Or export TELEGRAM_API_ID / TELEGRAM_API_HASH in your environment / the MCP env block — see below.)
4. Log in (one time, interactive)
.venv/bin/telegram-auth login
You'll enter your phone number, the login code Telegram sends to your app, and — if you use two-step verification — your 2FA password. On success the session is stored encrypted in your OS keyring (with a Fernet-encrypted file fallback) and is never printed.
.venv/bin/telegram-auth status # who am I logged in as?
.venv/bin/telegram-auth logout # revoke + clear the local session
5. Register the MCP server
Add it to your .mcp.json (project-level) or your Claude client's MCP config:
{
"mcpServers": {
"telegram-briefing": {
"command": "/absolute/path/to/telegram-briefing-mcp/.venv/bin/telegram-briefing-mcp",
"args": [],
"env": {
"TELEGRAM_API_ID": "1234567",
"TELEGRAM_API_HASH": "your_api_hash_here"
}
}
}
}
Restart your client and the tools below appear.
Tools
All tools are read-only and share the same time-window vocabulary.
| Tool | What it does |
|---|---|
telegram_auth_status |
Whether a session is stored & still authorized, and which account. Never triggers a login. |
list_chats |
Your conversations with metadata only (name, kind, unread count, last activity) — no message bodies. The map before you fetch. |
get_briefing |
The centerpiece. Pulls in-window messages across all relevant chats, grouped by conversation, sorted most-relevant-first. |
fetch_messages |
In-window messages from one chat (by @username, id, link, or title). |
search_messages |
Full-text search globally or within one chat. |
The window vocabulary
Every read tool accepts these (precedence: since/until → hours/days → window):
window:"day"(last 24h, default),"today"(since local midnight),"yesterday","week","month","unread"(only unread messages),"all", or a duration like"36h","3d","2w".hours/days: a custom rolling window, e.g.days=3.since/until: explicit ISO bounds, e.g.since="2026-06-01".
Scope defaults (for get_briefing)
By default a briefing includes your DMs and groups — the people and groups talking to you. Broadcast channels and bot chats are excluded as noise; enable them with include_channels=True / include_bots=True. Archived chats are excluded unless include_archived=True.
The telegram-brief CLI
The same briefing, one shot, from any shell — no MCP client required:
.venv/bin/telegram-brief # last 24h, text digest
.venv/bin/telegram-brief week # last 7 days
.venv/bin/telegram-brief unread # only unread messages
.venv/bin/telegram-brief 2d --json # last 2 days, raw JSON
Flags: --chats N, --per-chat N, --channels, --bots, --archived.
Using it for an executive briefing
Once registered, just ask Claude in natural language:
"Give me my Telegram briefing for the last day." "What's unread on Telegram right now? Group it by person and flag anything that needs a reply." "Summarize the last week of my work groups on Telegram, then add it to my morning brief." "Search my Telegram for anything about the Q3 launch this week."
Claude calls get_briefing (or search_messages), gets the structured messages, and writes the summary. Pair it with a scheduled task to get the brief refreshed every morning.
Security & privacy
- Your messages stay between you, Telegram, and your MCP client. This server makes no third-party network calls — only to Telegram's own servers.
- The session is a credential. A Telethon session string can act as your account until revoked. It's stored in your OS keyring (macOS Keychain / libsecret / Windows Credential Locker); if no keyring is available it falls back to a Fernet-encrypted file (
session.enc) with the key itself kept in the keyring where possible. It is never printed or logged..gitignoreexcludes all session/secret artifacts. - Revoke any time with
telegram-auth logout, or from Telegram → Settings → Devices. - Least privilege: the tool surface is read-only on purpose. There is intentionally no send/delete/mark-read capability.
Limitations
- Month windows approximate a month as 30 days (fine for briefing windows).
- Very large/active chats are bounded by
max_messages_per_chatand a per-calllimitso a single call can't pull unbounded history. - Media is summarized as a tag (
[photo],[file: report.pdf],[voice message], …); the connector does not download media. - A briefing scans up to
max_dialogs_scanned(200) of your most recent conversations.
Development
.venv/bin/python -m pip install -e ".[dev]"
.venv/bin/python -m pytest # window-logic unit tests (no network/auth)
See CONTRIBUTING.md. MIT licensed.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。