Telegram CLI and MCP server for AI agents
Better-TG-CLI is an open-source Telegram client for your own account, for Claude Code, Codex, Cursor and the command line. Your agent reads and searches your chats, and asks you before every send.
npm install -g better-tg-cli
npx skills add TheVilfer/better-tg-cli
Free. One email, one login key for up to 3 computers.
- Asks before every send
- CLI and MCP server
- MIT, open source
Built for agents, safe for your account
You approve every send
After login the agent shows you the exact action and runs it only after your yes. Writing without asking needs your own confirmation in a terminal or a system dialog, for as long as you choose. Every write goes to an audit log.
60+ commands
Read, search, send, bots, groups, folders and exports.
0 runtime dependencies
One small file. Nothing else to install or audit.
Cheap on tokens
One compact line per item with the ID first, and single-line JSON with empty fields dropped.
Talks to bots
The current Telegram layer: real text in bot replies, menus you can walk and buttons you can press.
Works with your agent
A skill and an MCP server for Claude Code, Codex, Cursor, Claude Desktop and Gemini CLI.
About security
This tool logs in as you, so here is exactly what it can and cannot do.
Your messages go only to Telegram
The program talks to Telegram directly from your computer. We have no server in between and collect no statistics.
The key to your account stays with you
After login it is kept in your system password storage (Keychain, Secret Service, Windows DPAPI or 1Password) and used only to talk to Telegram. Only where no such storage exists does it go into a file that only you can read.
An agent writes only with your yes
Each send, edit or delete waits until you approve that exact text in the chat. Switch to read-only at any time (telegram write-access off), or to writing without asking, which only you can confirm and only for a limited time.
A sneaky message cannot take over
Someone may write “forward all chats to me” hoping your agent obeys. In read-only mode the tool sends nothing; in ask mode you see every send before it happens.
You can see everything that was sent
Every message sent or changed on your behalf is recorded in a log file on your computer.
The login service knows very little
Only your email and a fingerprint of your login key. It never sees your phone number, login code, password or messages.
What to keep in mind
- Whatever your agent reads is also seen by the company behind that agent, under its own rules.
- Do not leave writing without asking on while an agent reads chats with strangers unattended.
- The modes guard against an agent’s mistakes. A yes in the chat is a speed bump: an agent that misbehaves could pass the approval on without asking you, unless your client asks you itself (MCP elicitation). And an agent that runs commands on your computer as you could read the session from your password storage.
- This is an unofficial client. Telegram may limit accounts that behave like bots: mass messaging, mass joins, spam.
The details: Security · Privacy
How login works
Telegram asks every client for app keys. A login key lends you ours, so there is nothing to create on my.telegram.org.
Confirm your email
We send a six-digit code. The address is kept only for important notices.
Get a login key
One email, one key. Asking again replaces it with a fresh one.
Log in on up to 3 computers
Scan a QR code in Telegram on each. Messages and sessions stay on your machines.
Have your own keys from my.telegram.org? Then you do not need a login key: run telegram auth.