Telegram channel & group reader MCP Server
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"tg-reader": {
"env": {
"TG_SESSION_PATH": "/ABSOLUTE/PATH/TO/tg_session.session"
},
"args": [
"/ABSOLUTE/PATH/TO/tg-reader-mcp/server.py"
],
"command": "/ABSOLUTE/PATH/TO/tg-reader-mcp/.venv/bin/python"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
中文: 只读 Telegram MCP:用你本机已登录的账号,让 AI 读频道、群、私聊与联系人卡片;不发消息、不改记录、不删内容(仅提供 mark_read 清未读)。 English: README.en.md
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in other
Pi Coding Agent extension (CLI-first) — routes bash/read/grep/find/ls through lean-ctx CLI for strong token savings. Optional MCP bridge can register advanced tools.
Autonomous spec-to-product coding-agent CLI with an MCP server exposing 34 tools over stdio.
97% token reduction for AI coding sessions — zero deps, 21 languages, MCP server
App framework, testing framework, and inspector for MCP Apps.
MCP Security Weekly
Get CVE alerts and security updates for Tg Reader Mcp and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
中文: 只读 Telegram MCP:用你本机已登录的账号,让 AI 读频道、群、私聊与联系人卡片;不发消息、不改记录、不删内容(仅提供 mark_read 清未读)。
English: README.en.md
git clone https://github.com/runesleo/tg-reader-mcp.git
cd tg-reader-mcp
uv venv && source .venv/bin/activate
uv pip install -e .
需要本机有一份已授权的 .session(userbot 登录,非 Bot Token)。最小示例:
# login.py(在任意目录运行一次即可)
from telethon import TelegramClient
client = TelegramClient('tg_session', 94575, 'a3406de8d171bb422bb6ddf3bbd800e2')
client.start()
print("OK: tg_session.session")
python login.py
默认 API_ID / API_HASH 与 Telegram Desktop 公开凭据一致。若要自建应用,在 my.telegram.org 申请并设置环境变量 TG_API_ID、TG_API_HASH。
claude_desktop_config.json)将下面 mcpServers 里的键值对 合并进你现有配置文件的 mcpServers 对象中(路径示例:macOS ~/Library/Application Support/Claude/claude_desktop_config.json)。把占位路径换成你的绝对路径。
{
"mcpServers": {
"tg-reader": {
"command": "/ABSOLUTE/PATH/TO/tg-reader-mcp/.venv/bin/python",
"args": ["/ABSOLUTE/PATH/TO/tg-reader-mcp/server.py"],
"env": {
"TG_SESSION_PATH": "/ABSOLUTE/PATH/TO/tg_session.session"
}
}
}
}
可选环境变量:TG_API_ID、TG_API_HASH(覆盖默认 Telegram Desktop 凭据)。
claude mcp add tg-reader -s user \
-e TG_SESSION_PATH=/absolute/path/to/tg_session.session \
-- /absolute/path/to/tg-reader-mcp/.venv/bin/python /absolute/path/to/tg-reader-mcp/server.py
以下名称与 server.py 中 @server.list_tools() 注册项一一对应。
list_dialogsfilter(可选):如 unread、unread_dm、unread_channel、channel、group、dm 等组合;否则按对话标题 / username 子串匹配。limit(可选,默认 50):最多返回条数。{ "filter": "unread_dm", "limit": 30 }
read_channelchannel(必填):username(如 durov)或可被 Telethon 解析的标题。limit(可选,默认 20,上限 100)。since(可选):ISO 8601 时间,仅返回严格晚于该时间的消息。offset_date(可选):ISO 时间,从该时刻向前翻页(配合返回的 next_offset_date)。{ "channel": "durov", "limit": 10, "since": "2026-04-20T00:00:00+08:00" }
search_channelchannel(必填)keyword(必填)limit(可选,默认 20){ "channel": "runesgangalpha", "keyword": "Polymarket", "limit": 15 }
mark_readchannel(必填):频道、群或私聊标识(username 或标题)。{ "channel": "某群名称或 username" }
get_contactlast_seen 等)。note 为你在官方客户端里写的仅自己可见的联系人备注(需对方已是联系人等条件才有电话/备注等字段)。username(必填):不带 @ 的 username 或数字 user id。{ "username": "durov" }
list_contacts_matchingfirst_name / last_name(可选 note)中包含子串的联系人,返回结构与 get_contact 一致。match_note=true 时会对每个扫描到的 DM 调用 FullUser,成本随对话数上升,请控制 limit 与 dialog_scan_limit。pattern(必填):非空子串,大小写不敏感。match_note(可选,默认 false)limit(可选,默认 30,上限 100)dialog_scan_limit(可选,默认 500):最多扫描多少条 DM。{ "pattern": "VIP", "match_note": true, "limit": 20, "dialog_scan_limit": 200 }
list_dialogs 过滤 unread_channel → 对每条调用 read_channel → 总结后 mark_read。since 只取新消息。search_channel 定位历史讨论。list_contacts_matching 批量拉出对应人群。get_contact 拉 bio、共同群数量等辅助判断账号背景。.session 等同于登录凭证:勿提交仓库、勿外泄。仓库 .gitignore 已忽略常见 session 文件。MIT — 见 LICENSE。