tdl-mcp
Provides read-only access to a personal Telegram account, enabling listing chats, reading recent messages, and downloading media files, without sending or modifying any data.
Click on "Install 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., "@tdl-mcpShow the last 10 messages from @technews"
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.
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.
Claude / MCP host βstdioβ tdl-mcp (Node) βsubprocessβ tdl CLI βMTProtoβ TelegramRelated MCP server: Telegram MCP Server
Quick start
1. Install tdl
# macOS
brew install telegram-downloader
# Linux / WSL
curl -sSL https://docs.iyear.me/tdl/install.sh | sudo bash
# Windows (PowerShell)
iwr -useb https://docs.iyear.me/tdl/install.ps1 | iexAny 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)
tdl login -T qrScan 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 β₯ 18.
Claude Code:
claude mcp add --scope user telegram -- npx -y tdl-mcpClaude Desktop / any other MCP host (generic mcpServers JSON):
{
"mcpServers": {
"telegram": {
"command": "npx",
"args": ["-y", "tdl-mcp"]
}
}
}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
Tool | Arguments | What it does |
| β | Checks whether the tdl session is logged in. Never errors: returns |
|
| Lists dialogs as |
|
| Exports recent media messages from a chat as compact |
|
| Downloads media from a chat with |
|
| Downloads the media of specific messages by link. Validates every url starts with |
chat accepts either a numeric id or an @username/domain, exactly as shown
by tg_chats.
Environment variables
Variable | Effect |
| Path to the tdl binary. Default: |
| tdl namespace, passed as |
Set them in your host's server config, e.g.:
{
"mcpServers": {
"telegram": {
"command": "npx",
"args": ["-y", "tdl-mcp"],
"env": { "TDL_NS": "work" }
}
}
}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
git clone https://github.com/rixile9999/tdl-mcp.git
cd tdl-mcp
npm install
npm test # smoke (MCP protocol, login-free) + contract (tdl CLI surface)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).
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA read-only Telegram MCP server that retrieves messages from your DMs, groups, and channels, enabling Claude to generate executive briefings from Telegram conversations.MIT
- AlicenseNot gradedqualityBmaintenanceA Telegram integration for Claude, Cursor, and other MCP-compatible clients. It exposes Telegram account, chat, message, contact, media, folder, and admin operations through the Model Context Protocol using Telethon.Apache 2.0
- AlicenseNot gradedqualityAmaintenanceDrives a personal Telegram account from the terminal or via MCP, enabling AI assistants to list chats, send/edit messages, fetch history, manage groups, and more with tiered read/write/destructive permissions.1MIT
- AlicenseNot gradedqualityCmaintenanceA Telegram integration for Claude, Cursor, and other MCP-compatible clients. It exposes over 80 tools for account, chat, message, contact, media, folder, and admin operations through the Model Context Protocol.Apache 2.0
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Multi-tenant Telegram gateway for AI agents β HTTP+stdio, 8 tools, MTProto User API
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rixile9999/tdl-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server