Better Tg Cli (Telegram) logo

Better Tg Cli (Telegram)

Read, search, send Telegram messages, and operate bot buttons from an MCP-enabled agent with approval-gated writes.

Install Better Tg Cli (Telegram)

Run the project’s own setup commands, in order.

Setup steps from the project

better-tg-cli (Telegram) installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    brew install thevilfer/tap/better-tg-cli   # standalone binary, macOS and Linux
    
  2. 2. Install
    npm install -g better-tg-cli               # Node >= 20, any OS
    
  3. 3. Install
    scoop bucket add thevilfer https://github.com/TheVilfer/scoop-bucket
    
  4. 4. Install
    scoop install better-tg-cli
    
  5. 5. Install
    grok plugin install TheVilfer/better-tg-cli --trust
    
  6. 6. Install
    grok plugin marketplace add TheVilfer/better-tg-cli && grok plugin install better-tg-cli --trust
    

Overview

better-tg-cli (Telegram) connects AI agents to a user’s Telegram account through an unofficial MTProto client and exposes both a CLI and MCP server. It supports reading chats, searching messages, sending or managing messages, and pressing bot buttons, with writes requiring confirmation. Reach for it when an agent needs account-level Telegram access, especially for precise reads, bot workflows, or controlled message drafting and sending.

Use cases

  • Read recent Telegram conversations through an AI agent
  • Search messages by sender, date, or content type
  • Navigate Telegram bots and press their buttons
  • Draft and send messages with explicit approval
  • Inspect groups, channels, threads, and Saved Messages

Key features

  • Telegram account access over MTProto
  • MCP server and command-line interface
  • Approval-gated send, edit, and delete operations
  • Bot button and menu interaction
  • Filtered search and paginated reads
  • Compact text and single-line JSON output

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 62d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 15d ago via OSV.dev

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars12Stargazers on the source repository.
Last commit7d agoMost recent push to the default branch.

How Better Tg Cli (Telegram) works

What better-tg-cli (Telegram) does

better-tg-cli (Telegram) gives AI agents access to a user’s own Telegram account through an unofficial MTProto client based on teleproto. It is distributed as the telegram command-line application and as an MCP server started with telegram mcp. An agent can inspect inboxes and chats, search messages, read individual messages, send messages, interact with bots, and work with groups, channels, and exports.

The client is designed for agent-readable output. Non-interactive use produces compact one-line records, while JSON output keeps each result on one line and omits empty fields. Long text can be shortened with --max-text.

How it works

Telegram operations run against the account used during login rather than a separate bot identity. The underlying client uses MTProto and Telegram layer 229. Reading supports pagination, date ranges, unread filtering, threads, channel comments, forum topics, message lookup by ID, and search filters for message type, sender, and date. Saved Messages can be addressed through me or Избранное.

The MCP entry point lets supported agents call the Telegram functionality from their tool interface. The package also includes an agent skill, and the project identifies Claude Code, Codex, Cursor, Claude Desktop, and Gemini CLI as supported agent environments.

Setup and configuration

Install the CLI and MCP server with npm on Node.js 20 or newer:

Terminal
npm install -g better-tg-cli

On macOS or Linux, Homebrew installs a standalone binary:

bash
brew install thevilfer/tap/better-tg-cli

Standalone release binaries are also available through the project’s installer, GitHub Releases, and Scoop on Windows. The Windows package is experimental. The npm package runs on any supported operating system with Node.js; the standalone binary does not require Node.js.

After installation, log in to the Telegram account you want the agent to use, then start the MCP server with telegram mcp. Credentials are stored using the macOS Keychain, Linux Secret Service, or 1Password. TG_NO_UPDATE_CHECK=1 disables the CLI’s periodic update check.

Tools and capabilities

  • Read inboxes, chats, threads, channel comments, forum topics, and individual messages.
  • Search messages with filters for type, sender, and date.
  • Send, edit, or delete messages with approval controls.
  • Press bot buttons and navigate bot menus with the click operation.
  • Work with groups, channels, Saved Messages, and exports.
  • Return compact terminal output or single-line JSON for agent workflows.

Writes use a guarded model by default. Before each send, edit, or delete, the agent asks for approval and displays the exact text. Enabling write-access on requires confirmation in a terminal or macOS dialog.

Limitations and notes

This is an unofficial Telegram client that signs in as the user. Telegram may restrict or freeze accounts that behave like bots, with increased risk from new accounts, bulk messaging, mass joins or invites, and spam-like activity. Keep writes disabled unless needed and review the project’s security guidance before granting an agent write access.

Audit-enabled commands attempt to record results in ~/.config/tg/audit.jsonl inside the active profile directory, but writes stopped for approval or disabled writes end before the audit record, and not every write has an audit entry. The project also warns that manually downloaded macOS binaries are not notarized. The package is licensed under MIT.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Better Tg Cli (Telegram)

better-tg-cli (Telegram) is an MCP server that connects AI agents to your own Telegram account through MTProto. Its main tools support reading chats and messages, searching Telegram, sending or managing messages with approval, and pressing bot buttons. It also ships as the `telegram` CLI and supports compact or JSON output.

Install it with `npm install -g better-tg-cli` on Node.js 20 or newer, or use Homebrew on macOS and Linux with `brew install thevilfer/tap/better-tg-cli`. After logging in, start the MCP server with `telegram mcp`.

Yes, better-tg-cli (Telegram) names Cursor as a supported agent environment. Install the package, log in to the Telegram account it should use, and configure the MCP server through the client’s MCP setup.

Not by default. Send, edit, and delete operations ask for approval and show the exact text before proceeding. The `write-access on` mode permits writing only after confirmation in a terminal or macOS dialog.

Yes. It can press bot buttons and navigate bot menus through the `click` operation, including bot replies that contain rich content.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewBetter Tg Cli (Telegram) AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/better-tg-cli-telegram?style=directory)](https://allmcps.com/mcp/better-tg-cli-telegram)
HTML Embed
<a href="https://allmcps.com/mcp/better-tg-cli-telegram"><img src="https://allmcps.com/api/badge/better-tg-cli-telegram?style=directory" alt="Better Tg Cli (Telegram) on AllMCPs" /></a>