Better Telegram MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add better-telegram-mcp -- uvx --python 3.13 better-telegram-mcp
README.md

MCP server for Telegram with dual-mode Bot API and MTProto support

Better Telegram MCP

mcp-name: io.github.n24q02m/better-telegram-mcp

MCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot integrations and MTProto (Telethon) for full user-account access.

Features

  • Dual mode -- Bot API (httpx) for bots, MTProto (Telethon) for user accounts
  • 6 mega-tools with action dispatch: messages, chats, media, contacts, config, help
  • Auto-detect mode -- Set bot token for bot mode, or API credentials for user mode
  • Web-based OTP auth -- Browser-based authentication with remote relay support for headless environments
  • Tool annotations -- Each tool declares readOnlyHint, destructiveHint, idempotentHint, openWorldHint
  • MCP Resources -- Documentation available as telegram://docs/* resources
  • Security hardened -- SSRF protection, path traversal prevention, error sanitization

Quick Start

Claude Code Plugin (Recommended)

claude plugin add n24q02m/better-telegram-mcp

After install, set your bot token: claude config set mcpServers.better-telegram-mcp.env.TELEGRAM_BOT_TOKEN "your-token". Get one from @BotFather. For user mode (MTProto), set TELEGRAM_API_ID + TELEGRAM_API_HASH instead.

MCP Server

Python 3.13 required -- Python 3.14+ is not supported.

Bot Mode Setup
  1. Open Telegram, search for @BotFather
  2. Send /newbot, follow prompts to name your bot
  3. Copy the token (format: 123456789:ABCdefGHI-JKLmnoPQRstUVwxyz)
User Mode Setup
  1. Go to my.telegram.org, login with your phone number
  2. Click "API development tools", create an app
  3. Note your api_id (integer) and api_hash (32-char hex string)
  4. On first run, a local web page opens for OTP authentication
Option 1: uvx

Bot mode:

{
  "mcpServers": {
    "telegram": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-telegram-mcp"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "123456:ABC-DEF"
      }
    }
  }
}

User mode:

{
  "mcpServers": {
    "telegram": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-telegram-mcp"],
      "env": {
        "TELEGRAM_API_ID": "12345678",
        "TELEGRAM_API_HASH": "your-api-hash-from-my-telegram-org",
        "TELEGRAM_PHONE": "+1234567890"
      }
    }
  }
}
Option 2: Docker
{
  "mcpServers": {
    "telegram": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "TELEGRAM_BOT_TOKEN",
        "-v", "telegram-data:/data",
        "n24q02m/better-telegram-mcp"
      ],
      "env": {
        "TELEGRAM_BOT_TOKEN": "123456:ABC-DEF"
      }
    }
  }
}

For user mode in Docker, mount the session directory with -v ~/.better-telegram-mcp:/data so the session persists across container restarts.

Tools

Tool Actions Description
messages send, edit, delete, forward, pin, react, search, history Send, edit, delete, forward messages. Pin, react, search, browse history
chats list, info, create, join, leave, members, admin, settings, topics List and manage chats, groups, channels. Members, admin, forum topics

Tools (2)

messagesSend, edit, delete, forward, pin, react, search, and browse message history.
chatsList and manage chats, groups, and channels including members, admin settings, and forum topics.

Environment Variables

TELEGRAM_BOT_TOKENToken for Bot API mode obtained from BotFather
TELEGRAM_API_IDAPI ID for MTProto user mode
TELEGRAM_API_HASHAPI Hash for MTProto user mode
TELEGRAM_PHONEPhone number for MTProto user mode authentication

Configuration

claude_desktop_config.json
{"mcpServers": {"telegram": {"command": "uvx", "args": ["--python", "3.13", "better-telegram-mcp"], "env": {"TELEGRAM_BOT_TOKEN": "your-token-here"}}}}

Try it

Send a message to the 'Work' group saying the daily report is ready.
List the last 10 messages from my private channel.
Search for messages containing 'project update' in my recent chats.
Pin the latest announcement in the team group.
Add a thumbs up reaction to the last message in the general chat.

Frequently Asked Questions

What are the key features of Better Telegram MCP?

Dual-mode support for Bot API (httpx) and MTProto (Telethon). Comprehensive message management including sending, editing, and searching. Full chat and channel administration tools. Web-based OTP authentication for secure user-account access. Security-hardened with SSRF and path traversal protection.

What can I use Better Telegram MCP for?

Automating routine message broadcasts to Telegram channels. Integrating Telegram chat history into AI-driven project management workflows. Managing group member permissions and forum topics via natural language. Building custom Telegram bots with advanced message processing capabilities.

How do I install Better Telegram MCP?

Install Better Telegram MCP by running: claude plugin add n24q02m/better-telegram-mcp

What MCP clients work with Better Telegram MCP?

Better Telegram MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Better Telegram MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare