
Tdl Mcp
io.github.rixile9999由 GitHub 帳號 rixile9999 發布v1.1.0更新於 Oct 24, 2026
Read-only Telegram MCP server wrapping the tdl CLI: list chats, read messages, download media.
概覽
以 tdl 命令列工具為底的唯讀 Telegram MCP 伺服器:列出對話、讀取訊息、下載媒體,皆針對你自己的帳號。
- 可以做什麼
- 檢查本機 tdl 工作階段是否已登入,以及可見的對話數量
- 依名稱、使用者名稱或 ID 的子字串篩選並列出對話
- 讀取某個對話的近期訊息,可限定筆數、起始訊息 ID 與是否包含文字
- 從對話下載媒體檔案,可依副檔名篩選並指定儲存資料夾
- 依指定的 Telegram 訊息連結下載其中的媒體
- 適用情境
- 適合讓助理搜尋你自己的 Telegram 對話、彙整或擷取頻道近期訊息,或把頻道張貼的 PDF、試算表等檔案歸檔到本機資料夾,同時不賦予它傳送或刪除訊息的能力。
- 執行需求
- 以 stdio 方式在本機執行,需要 Node.js 22 以上版本;須先安裝 tdl 命令列工具,並由使用者在終端機完成一次 QR 掃碼登入,工作階段存放於 ~/.tdl。可選環境變數 TDL_BIN(tdl 執行檔路徑)與 TDL_NS(用來區分不同帳號的命名空間)。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Tdl Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
tdl-mcp
Read-only Telegram access for Claude and other MCP hosts, powered by the
tdl CLI.
List your chats, read recent messages, and download media — from your own Telegram account — with five simple tools. It never sends messages, never modifies anything, and never touches your login.
🇰🇷 한국어 문서는 여기 있습니다 → README.ko.md
Why tdl-mcp?
Most Telegram MCP servers embed an MTProto library (Telethon, gramjs, …),
ask you to create your own Telegram application at my.telegram.org to get an
api_id/api_hash, and many of them can send messages on your behalf.
tdl-mcp takes a different, deliberately boring approach:
- Read-only by design. The server can list chats, export messages and download files. That's all. There is no code path that sends, edits, deletes, or logs in.
- No
api_id/api_hashsetup. Login is handled once, by you, in your terminal withtdl login -T qr— scan a QR code with your phone and you're done. No Telegram app registration needed. - Built on a battle-tested downloader.
tdl(7.5k+ ⭐) does the heavy lifting: fast parallel downloads, resume,--skip-samededuplication. - Tiny and auditable. One plain-JavaScript file, two dependencies
(
@modelcontextprotocol/sdk,zod), no build step. You can read the whole server in five minutes.
Quick start
1. Install tdl
Any version from the one pinned in .tdl-version upward
should work — CI continuously tests against that pin (see
Compatibility).
2. Log in to Telegram (once)
Scan the QR code with the Telegram mobile app
(Settings → Devices → Link Desktop Device). The session is stored in
~/.tdl on your machine and shared by every MCP host — you log in exactly
once. tdl-mcp itself never performs or refreshes logins.
3. Add the server to your MCP host
You need Node.js ≥ 22.
Claude Code:
Claude Desktop / any other MCP host (generic mcpServers JSON):
4. Try it
Ask your assistant things like:
"What Telegram chats do I have? Find the one about quant trading."
"Show me the last 20 messages in @some_channel."
"Download every PDF posted in that channel since message 1500 to ~/Papers."
If a tool reports that you are not logged in, run tdl login -T qr in a
terminal and retry — that's the only manual step there is.
Tools
chat accepts either a numeric id or an @username/domain, exactly as shown
by tg_chats.
Environment variables
Set them in your host's server config, e.g.:
Compatibility & staying up to date
tdl-mcp shells out to the tdl CLI, so its real dependency is tdl's
command-line surface. That surface is guarded automatically:
.tdl-versionpins the tdl release this package is tested against.scripts/contract.mjsverifies — without logging in — that every flag the server uses (chat ls -o json,chat export -c/-T/-i/-o/--with-content,dl -f/-u/-i/-d/--skip-same, global-n) still exists in that tdl binary. CI runs it on every push and PR.- A scheduled workflow watches tdl releases. When a new version appears it runs the contract test against the new binary and scans the release notes for breaking-change markers. Routine updates become a simple version-bump PR; anything suspicious is escalated to an AI-assisted upgrade PR that adapts the wrapper code.
So if you're on a newer tdl than the pin, chances are excellent everything just works — and if it ever wouldn't, this repo finds out before you do.
Development
npm run smokespawns the server over stdio and checks the tool catalog,tg_statusshape, and input validation — passes whether or not you are logged in.npm run contractchecks the installed tdl binary against the CLI surface the server uses.scripts/install-tdl.sh [vX.Y.Z]installs a specific (checksum-verified) tdl release if you want to test against another version.
PRs welcome. Please keep the server read-only — tools that send, edit or delete are out of scope for this project.
Security notes
- The tdl session in
~/.tdlis a full user-account credential — anyone who can read it can act as your Telegram account. Protect it like an SSH key: don't copy it into repos, shared backups, or other machines. tdl-mcpnever reads or transmits the session itself; it only runs thetdlbinary locally. Nothing leaves your machine except tdl's own Telegram traffic.- Downloads go to a directory you choose (
dest), defaulting to~/Downloads/telegram.
Telegram terms-of-service note
tdl drives a regular user session (MTProto), not a bot. Quiet, read-only,
personal-use automation of your own account is generally tolerated, but
aggressive crawling can get an account limited: keep ranges modest
(last_n, since_id), avoid large parallel pulls, and let --skip-same do
its job instead of re-downloading.
License
MIT for everything in this repository.
tdl itself is a separate project licensed under
AGPL-3.0. tdl-mcp does
not bundle, link, or modify tdl — it invokes the binary you installed as a
separate process, so the AGPL applies to tdl, not to this wrapper. You install
tdl yourself through official channels (step 1 above).
來源:README.md,提交 73115bf
工具
0版本歷史
1- v1.1.0最新Oct 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分