tlgrm
Provides tools to interact with Telegram via MTProto, allowing sending messages, managing chats, reading history, downloading media, creating polls, and more using a personal Telegram account.
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., "@tlgrmsend a message to my saved messages"
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.
tlgrm
An unofficial, feature-rich command-line client, MCP server, and webhook daemon for Telegram, built on Telethon.
Drive your personal Telegram account from the terminal — list chats, send and edit messages, pull history, download media, react, pin, schedule, run polls — and bridge incoming messages to an HTTP webhook in real time. Also ships as an MCP server so AI assistants like Claude can drive Telegram on your behalf.
Unofficial app notice: tlgrm is an independent, unofficial client built on the Telegram API (via Telethon). It is not affiliated with, endorsed by, or sponsored by Telegram.
Table of Contents
Related MCP server: mcp-telegram
Features
🔐 Personal account access — acts as you (user account, MTProto), not a bot, so it can read history and list members.
💬 Messaging — send text, files, media, and voice notes; reply, edit, forward, react, pin, mute, save to Saved Messages.
📜 History & members — fetch recent messages or participant lists from any chat.
📁 Chats — list your recent dialogs with unread counts and types.
🛠️ Group management — create groups/channels, add/remove members, leave chats.
📅 Scheduled messages & polls — schedule a text message at a future time, or send a poll/quiz.
🤖 MCP server — expose ~24 Telegram tools to any MCP-compatible AI assistant (Claude Desktop, Claude Code, etc.) with tiered read/write/destructive permissions.
🔔 Real-time webhooks — forward every incoming message to an HTTP endpoint as JSON, with automatic media download. Self-destructing (TTL) media is skipped; the webhook payload includes
media.self_destruct: true.⚙️ Background daemon — run the listener as a managed
systemduser service.🗣️ Optional speech-to-text — auto-transcribe incoming voice notes locally with Whisper.
🖥️ ~30 commands — every command prints structured JSON to stdout, making tlgrm easy to pipe into
jqor other tools.
How it works
tlgrm uses the Telegram client API (MTProto) through Telethon, authenticating as your personal account with a login code (and 2FA if enabled). Your authenticated session is stored locally and reused, so you only log in once.
Because it acts as your user account, tlgrm can do things the Bot API cannot (read arbitrary history, list group members, send as yourself). This is also why it requires your own
api_id/api_hash— see below.
Installation
Requirements: Python ≥ 3.10. FFmpeg is only needed for optional speech-to-text.
From PyPI
# CLI only
pip install tlgrm
# CLI + MCP server
pip install "tlgrm[mcp]"
# CLI + Whisper speech-to-text
pip install "tlgrm[stt]"
# Everything
pip install "tlgrm[all]"With uv (recommended)
# CLI only
uv tool install tlgrm
# CLI + MCP server
uv tool install "tlgrm[mcp]"From source (development)
git clone https://github.com/ali-commits/tlgrm.git
cd tlgrm
pip install -e .To enable optional voice-note transcription, install the stt extra (see Speech-to-text):
pip install "tlgrm[stt]" # or: uv tool install "tlgrm[stt]"Telegram API credentials
tlgrm does not ship with Telegram API credentials — you must supply your own. This protects you from a single shared api_id being rate-limited for everyone.
Go to my.telegram.org → API development tools.
Create an application (Platform: Desktop). We suggest a name like
tlgrm— the title must not contain the word "Telegram".Copy the
api_id(a number) andapi_hash(a hex string).Export them before running tlgrm:
export TG_API_ID=1234567
export TG_API_HASH=your_api_hash_hereAdd these to your
~/.bashrc/~/.zshrcto persist them across sessions. See docs/configuration.md for all options.
Quick start
# 1. Authenticate once (interactive: phone → code → 2FA)
tlgrm login
# 2. List your recent chats
tlgrm chats --limit 10
# 3. Send a message (target = @username, numeric chat ID, or phone)
tlgrm send --target @username --text "Hello from the terminal!"
# 4. Read the last 5 messages of a chat
tlgrm history --target @username --limit 5Commands
--targetaccepts a@username, a numeric chat ID, or a phone number. A purely numeric value is treated as a chat ID.
Read
Command | Description |
| Interactively authenticate your Telegram account |
| Show the logged-in account |
| List recent chats/dialogs (default 20) |
| Fetch message history (default 10) |
| Search messages globally or within a chat |
| List members/participants of a group or channel |
| Show profile info for a user |
| Show info about a chat/channel |
| Download media from a message |
Write
Command | Description |
| Send a message, file, media, or voice note |
| Reply to a specific message |
| Edit a sent message |
| Mark a chat (or up to a message ID) as read |
| Forward one or more messages between chats |
| React to a message with an emoji |
| Pin a message in a chat |
| Unpin a message (or all if |
| Mute a chat (default: forever) |
| Unmute a chat |
| Send a message to your Saved Messages |
Tier 3 — Group management & advanced
Command | Description |
| Create a group or broadcast channel |
| Add members to a group/channel |
| Remove members from a group/channel |
| Leave a group or channel |
| Schedule a text message |
| Send a poll or quiz |
Daemon & listener
Command | Description |
| Listen for new messages (foreground) |
| Manage the background |
| Delete one or more messages |
📖 Full reference with every flag, examples, and output shapes: docs/commands.md.
MCP server
tlgrm ships a stdio MCP server (tlgrm-mcp) that exposes Telegram operations as tools to any MCP-compatible AI assistant.
Installation
pip install "tlgrm[mcp]"The MCP server requires a prior tlgrm login — it reuses the same session file as the CLI.
Claude Desktop configuration
Add this to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"tlgrm": {
"command": "uvx",
"args": ["--from", "tlgrm[mcp]", "tlgrm-mcp"],
"env": {
"TG_API_ID": "...",
"TG_API_HASH": "..."
}
}
}
}Permission tiers
The MCP server is read-only by default. Write and destructive operations must be explicitly enabled at startup:
Tier | Flag | Tools exposed |
Read-only (default) | (none) |
|
Write |
| Adds: |
Destructive |
| Adds: |
To enable write access in Claude Desktop, pass the flags via args:
"args": ["--from", "tlgrm[mcp]", "tlgrm-mcp", "--allow-write"]Safety note: The read-only default ensures an AI assistant can never send or delete messages unless you have explicitly opted in. Always review what permissions you grant.
Claude Code skill
A Claude Code skill lives at skills/tlgrm/ in this repository. It teaches Claude Code how to drive tlgrm — both via the CLI and the MCP server — and includes a capability map, safety rules, and workflow recipes.
Installation
cp -r skills/tlgrm ~/.claude/skills/Once installed, Claude Code will automatically use it when you ask things like "check my Telegram", "send a message to @someone", or "summarize my unread chats".
Configuration
All configuration is via environment variables. None are required except the API credentials.
Variable | Required | Default | Purpose |
| ✅ | — | Your Telegram |
| ✅ | — | Your Telegram |
| ❌ |
| Where the login session is stored |
| ❌ |
| Where incoming media is downloaded |
| ❌ |
| STT backend ( |
| ❌ | (backend default) | Model name/size for the selected STT backend |
See docs/configuration.md for the full reference including all STT backend options.
Webhooks & background daemon
tlgrm can forward every incoming message to an HTTP endpoint as JSON, downloading any attached media automatically:
tlgrm listen --webhook-url https://your-server.com/webhook \
--webhook-header "Authorization: Bearer YOUR_TOKEN"To run it persistently as a systemd user service:
tlgrm daemon install --webhook-url https://your-server.com/webhook
tlgrm daemon status
tlgrm daemon logs
tlgrm daemon uninstallNote: self-destructing (TTL) media is not downloaded — the webhook payload includes
"media.self_destruct": truebut the file is skipped.
📖 Full guide, payload schema, and security notes: docs/webhook-guide.md.
Speech-to-text (optional)
When the stt extra is installed, the webhook daemon automatically transcribes incoming voice notes and audio, populating media.transcription in the webhook payload. You can also transcribe any audio file directly with tlgrm transcribe (no login required). tlgrm supports pluggable STT backends: local models and cloud APIs.
Default: faster-whisper (local, lightweight, auto-downloads the model on first use; CPU by default, set TG_STT_DEVICE=cuda for GPU).
tlgrm transcribe --file voice.ogg # default backend
tlgrm transcribe --file voice.ogg --backend faster-whisper# Local faster-whisper (default — recommended)
pip install "tlgrm[stt]" # requires FFmpeg on your system
# Original OpenAI Whisper
pip install "tlgrm[stt-whisper]"
# Cloud backends — just set an API key (no extra package needed)
export OPENAI_API_KEY=sk-... # uses openai backend automatically
export GROQ_API_KEY=gsk_... # uses groq backend automaticallyIf no STT backend is available, transcription is silently skipped — all other features work unchanged.
See docs/configuration.md for the full list of backends, selection precedence, config file format, and privacy considerations for cloud backends.
Output format
Every command prints pretty-printed JSON to stdout (non-ASCII preserved), making tlgrm easy to pipe into jq or other tools:
tlgrm chats --limit 3 | jq '.[].name'Errors are reported as {"success": false, "error": "..."} with a non-zero exit code on authentication failure.
Security
Your session file (
~/.tlgrm/tg_session.session) grants full access to your Telegram account. Keep it private; it is git-ignored by default.The systemd unit file is written with owner-only permissions (
0600) because it may embed webhook auth headers.Enable Two-Step Verification on your Telegram account.
Found a vulnerability? See CONTRIBUTING.md.
Troubleshooting
Symptom | Fix |
| Export |
| Run |
Transcription never appears | Install the |
| The daemon needs |
Cannot create an app at my.telegram.org | Brand-new accounts are often blocked; wait, retry in incognito with no extensions |
MCP tool not available | Check the permission tier — write/destructive tools need |
Documentation
Getting Started — install, log in, send your first message
Configuration — environment variables and paths
Command Reference — every command, flag, and output shape
Webhook & Daemon Guide — webhooks, systemd, payload schema
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for development setup, coding conventions, and how to report issues.
License
Released under the MIT License © 2026 Ali Alrabeei.
Disclaimer
tlgrm is an unofficial client and is not affiliated with, endorsed by, or sponsored by Telegram. Use at your own risk.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/ali-commits/tlgrm'
If you have feedback or need assistance with the MCP directory API, please join our Discord server