tg-reader-mcp
中文: Telegram MCP:复用你本机已登录的账号读取频道、群、私聊与联系人卡片,并提供受保护的 send_message / join_chat 写操作。发送默认做精确文本去重;不提供编辑或删除消息。
English: README.en.md
接入你的智能体
從發布者安裝。不是 PlugMCP 端點。
遠端 URL 還是本機指令? 兩種安裝方式的差異
來自發布者
中文: Telegram MCP:复用你本机已登录的账号读取频道、群、私聊与联系人卡片,并提供受保护的 send_message / join_chat 写操作。发送默认做精确文本去重;不提供编辑或删除消息。
English: README.en.md
Telegram channel and group reader MCP Server
git clone https://github.com/runesleo/tg-reader-mcp.git
cd tg-reader-mcp
uv venv && source .venv/bin/activate
uv pip install -e .
tg-reader-init
首次运行会自动:
~/.tg-reader-mcp/tg_session.session,并收紧本地文件权限。默认 API_ID / API_HASH 与 Telegram Desktop 公开凭据一致。若要使用自己的应用凭据,可先在 my.telegram.org 申请,然后运行:
TG_API_ID=your_id TG_API_HASH=your_hash tg-reader-init
如果直连 Telegram 失败,可用 TG_PROXY_URL(支持 http://、socks5://、socks4://):
TG_PROXY_URL=http://127.0.0.1:7897 tg-reader-init
初始化时显式设置的 TG_API_ID、TG_API_HASH、TG_PROXY_URL 会自动带进生成的 MCP 配置,避免首次登录与后续运行使用不同参数。
tg-reader-init 输出的 tg-reader 条目合并到现有 mcpServers 对象,然后重启 Claude Desktop。tg-reader-init 输出的 claude mcp add ... 命令。以下名称与 server.py 中 @server.list_tools() 注册项一一对应。
download_mediachannel(必填)、message_id(必填)、out_dir(可选,默认 ~/.cache/tg-media)。{ "channel": "durov", "message_id": 12345 }
list_dialogsfilter(可选):如 unread、unread_dm、unread_channel、channel、group、dm 等组合;否则按对话标题 / username 子串匹配。limit(可选,默认 50):最多返回条数。{ "filter": "unread_dm", "limit": 30 }
read_channelfrom_me、sender_id、sender,媒体消息额外带 media / media_hint。channel(必填):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 }
send_messagededupe_window_seconds 调整,最大 24 小时。channel(必填)、text(必填)、reply_to(可选)、dedupe_window_seconds(可选,默认 600)。{ "channel": "username", "text": "hello", "dedupe_window_seconds": 86400 }
join_chattarget(必填):如 https://t.me/+... 或公开 username / t.me/... 链接。{ "target": "https://t.me/+invite_hash" }
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、共同群数量等辅助判断账号背景。MIT — 见 LICENSE。
Telegram channel and group reader MCP Server
工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Tg Reader 透過 stdio 在本機執行。
上次檢查時間:2026-10-28。 Telegram channel and group reader MCP Server