# Better-TG-CLI (Telegram)

Better-TG-CLI (Telegram) is a Claude Code MCP server for reading and searching chats, sending messages, and pressing bot buttons. Every write waits for approval.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 11 repo stars
- Author: TheVilfer
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/TheVilfer/better-tg-cli
- Updated: 2026-11-15
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/better-tg-cli-telegram

## What it does

Better-TG-CLI connects an agent to its own Telegram account through the `telegram` CLI and the `telegram mcp` server. It can inspect chats, search messages, interact with bots, and press their buttons. Sending, editing, or deleting a message requires approval of the exact action text.

The package also exposes a CLI with roughly 60 commands and formats output for agent use. Write activity is recorded in `~/.config/tg/audit.jsonl`. This is an unofficial client, so Telegram may limit or freeze accounts, with higher risk from bulk messaging, mass joins, or invites. npm installation requires Node 20+; a standalone binary is another option.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `TG_PROFILE` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env TG_PROFILE=<TG_PROFILE> --transport stdio better-tg-cli-telegram -- npx -y better-tg-cli
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add better-tg-cli-telegram --env TG_PROFILE=<TG_PROFILE> -- npx -y better-tg-cli
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "better-tg-cli-telegram": {
            "command": "npx",
            "args": [
                "-y",
                "better-tg-cli"
            ],
            "env": {
                "TG_PROFILE": "<TG_PROFILE>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "better-tg-cli-telegram": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "better-tg-cli"
            ],
            "env": {
                "TG_PROFILE": "<TG_PROFILE>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e TG_PROFILE=<TG_PROFILE> better-tg-cli-telegram npx -y better-tg-cli
```
Replace <…> with your own values

## When to use it
- read Telegram chats through an agent
- search messages by chat and filters
- send a message after text approval
- press buttons in Telegram bot menus

## Example prompts
- Read the latest messages from `@alice` and summarize them.
- Find Telegram messages about release `v2.4` within the requested date range.
- Prepare this message for the chat, show the exact text, and wait for my approval before sending.

## Similar
- [telegram](https://affpapa.org/en/nevibecode/skills/telegram.md) — skill · 486 installs
- [add-telegram](https://affpapa.org/en/nevibecode/skills/add-telegram.md) — skill · ★ 31137 repo stars
- [tg-ws-proxy-telegram-socks5](https://affpapa.org/en/nevibecode/skills/tg-ws-proxy-telegram-socks5.md) — skill · 889 installs
- [Chatroost — unofficial Telegram MCP server](https://affpapa.org/en/nevibecode/mcp/chatroost-unofficial-telegram-mcp-server.md) — MCP server · ★ 72 repo stars

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
