# better-tg-cli (Telegram) [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/TheVilfer/better-tg-cli  
**GitHub Stars:** 12  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/better-tg-cli-telegram

## Description
Telegram on your own account: read, search, send and press bot buttons. Writes need your approval.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/TheVilfer/better-tg-cli), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
brew install thevilfer/tap/better-tg-cli   # standalone binary, macOS and Linux
```

2. Install:

```sh
npm install -g better-tg-cli               # Node >= 20, any OS
```

3. Install:

```sh
scoop bucket add thevilfer https://github.com/TheVilfer/scoop-bucket
```

4. Install:

```sh
scoop install better-tg-cli
```

5. Install:

```sh
grok plugin install TheVilfer/better-tg-cli --trust
```

6. Install:

```sh
grok plugin marketplace add TheVilfer/better-tg-cli && grok plugin install better-tg-cli --trust
```

## Documentation

## 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:

```bash
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.

_Full upstream README: https://allmcps.com/mcp/better-tg-cli-telegram/readme_

