Skip to main content
Glama
telegram-mcp

telegram-mcp

by resccrew

telegram-mcp

MCP server that lets Claude Code drive your own Telegram account: read chats, send and edit messages, publish posts to channels, create channels/groups, join by invite links, press inline buttons, send/download files, and create bots through @BotFather.

Two servers ship in this repo:

Server

How it works

Needs

telegram (telegram-mcp)

Telegram API (MTProto via Telethon) — fast, precise, 23 tools

api_id/api_hash + one-time login

telegram-gui (telegram-gui-mcp)

Screenshots + pyautogui clicks in Telegram Desktop — Claude looks at the screen and clicks

Telegram Desktop logged in, macOS permissions

Requirements

  • uv (it installs Python 3.13 automatically)

  • Claude Code (or any MCP client)

  • A Telegram account

Related MCP server: Telegram MCP Server

Setup

  1. Clone the repo:

    git clone https://github.com/resccrew/telegram-mcp.git ~/telegram-mcp
  2. Get api_id and api_hash at https://my.telegram.org → API development tools.

  3. Log in once (asks for the credentials, then phone number, the code Telegram sends, and your 2FA password):

    cd ~/telegram-mcp && uv run telegram-mcp-login

    Credentials go to ~/.telegram-mcp/config.env, the session to ~/.telegram-mcp/session.txt (both chmod 600, outside the repo). The session string is full access to your account — never share it.

  4. Register the server with Claude Code (user scope, available in every project):

    claude mcp add telegram -s user -- uv --directory ~/telegram-mcp run telegram-mcp

Restart Claude Code and ask things like "read my last messages from Alice", "create a bot called Weather Helper with username weather_helper_xyz_bot", "write a post about X to my channel @mychannel".

Tools

Area

Tools

Account & chats

get_me, list_chats, chat_info, get_participants

Messages

read_messages, search_messages, send_message, edit_message, delete_messages, forward_messages, mark_read, pin_message

UI automation

click_button, talk_to_bot

Files

send_file, download_media

Groups & channels

create_channel, create_group, invite_users, join_chat, leave_chat

Bots

create_bot (via @BotFather), bot_api (any Bot API method with the bot's token)

chat arguments accept @username, a t.me link, phone, numeric id, me (Saved Messages) or a chat title.

Safety notes

  • Run one server per session at a time; the same session connected in parallel from many places can make Telegram revoke it (AuthKeyDuplicatedError → just run the login again).

  • send_file refuses credential files (~/.telegram-mcp, ~/.ssh, dotfiles, *.env, *.session, keys).

  • Claude acts as you: keep Claude Code permission prompts on for delete_messages, leave_chat, etc.

Configuration

Variable

Default

TELEGRAM_API_ID, TELEGRAM_API_HASH

read from ~/.telegram-mcp/config.env

TELEGRAM_SESSION

~/.telegram-mcp/session.txt

TELEGRAM_MCP_HOME

~/.telegram-mcp

GUI mode (no API keys): telegram-gui-mcp

A second server, telegram-gui, drives the Telegram desktop app like a person: it sends Claude a screenshot, Claude answers with where to click/what to type, and pyautogui does it. No api_id, no login, no session file — it just uses the app that is already logged in. macOS only.

Tool

What it does

screenshot

Full-screen screenshot (downscaled to ≤1280 px)

click / double_click

Click at (x, y) in the last screenshot (button: left/right/middle)

type_text

Type into the focused field via the clipboard (Cyrillic, emoji), press_enter to send

press_key / hotkey

enter, esc, … / ["command", "k"]

scroll

Positive = up, negative = down, optionally over (x, y)

open_telegram

Launch / bring Telegram to the front

Every action returns a fresh screenshot (screenshot_after=false to skip). Coordinates always refer to the last screenshot; Retina scaling is handled by the server.

Permissions. In System Settings → Privacy & Security, grant the app that runs Claude Code (Terminal, iTerm, Ghostty, VS Code, …) both Screen Recording (screenshots) and Accessibility (clicks and keys), then restart that app. Without them the tools return an error saying which one is missing.

Register:

claude mcp add --scope user telegram-gui -- uv --directory /path/to/telegram-mcp run telegram-gui-mcp

Safety: moving the mouse into a screen corner aborts automation (pyautogui failsafe). The server controls your real mouse and keyboard, so don't use the computer while Claude is working. Screenshots cover the whole main display (other windows included) and are sent to Claude; text on screen (incoming messages) is untrusted input, so Claude asks before sending or deleting.

Typical flow: open_telegram → click the search field → type_text("Saved Messages") → click the result → click the message field → type_text("Hi", press_enter=true).

Limits: main display only; the clipboard is briefly used for typing and then restored (text only).

Other MCP clients

Any stdio MCP client works. Example config (Claude Desktop, Cursor, ...):

{
  "mcpServers": {
    "telegram": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/telegram-mcp", "run", "telegram-mcp"]
    }
  }
}

Development

uv run pytest -q

License

MIT — see LICENSE. Use responsibly and follow the Telegram API Terms of Service: no spam or mass messaging.

Available Tools

23 tools
bot_apiC

Call any Telegram Bot API method as a bot, e.g. method='setMyCommands' or 'sendMessage'.

Inputs: token (required), method (required), params. Returns: object

chat_infoC

Get details about a user, bot, group or channel.

Inputs: chat (required). Returns: object

click_buttonC

Press a keyboard button under a message, by (part of) its text or by row/column (0-based).

Inputs: chat (required), message_id (required), row, text, +1 more. Returns: object

create_botA

Create a new bot via @BotFather. username must end with 'bot'. Returns the bot token.

Inputs: name (required), username (required). Returns: object

create_channelB

Create a channel (megagroup=True creates a supergroup). Optional public @username.

Inputs: title (required), about, username, megagroup. Returns: object

create_groupB

Create a basic group with the given users.

Inputs: title (required), users (required). Returns: object

delete_messagesB

Delete messages (revoke=True deletes for everyone).

Inputs: chat (required), message_ids (required), revoke. Returns: object

download_mediaC

Download the media attached to a message; returns the saved file path.

Inputs: chat (required), message_id (required), directory. Returns: object

edit_messageC

Edit one of your messages.

Inputs: chat (required), text (required), message_id (required), parse_mode. Returns: object

forward_messagesB

Forward messages from one chat to another.

Inputs: to_chat (required), from_chat (required), message_ids (required). Returns: object

get_meA

Return the logged-in Telegram account.

Inputs: no named parameters. Returns: object

get_participantsB

List members of a group or channel (admin rights may be needed for channels).

Inputs: chat (required), limit, search. Returns: object

invite_usersC

Add users to a group or channel.

Inputs: chat (required), users (required). Returns: object

join_chatB

Join a public group/channel (@username or link) or a private one (t.me/+invite).

Inputs: target (required). Returns: object

leave_chatC

Leave a group/channel or delete a private dialog.

Inputs: chat (required). Returns: object

list_chatsB

List dialogs (private chats, groups, channels, bots), newest first. Filter by title with query.

Inputs: limit, query, archived, unread_only. Returns: object

mark_readC

Mark all messages in a chat as read.

Inputs: chat (required). Returns: object

pin_messageB

Pin a message in a chat or channel.

Inputs: chat (required), message_id (required), notify. Returns: object

read_messagesA

Read messages from a chat, newest first.

offset_id: return messages older than this id (paging back). min_id: return only messages newer than this id (polling for new ones). search: only messages containing this text.

Inputs: chat (required), limit, min_id, search, +1 more. Returns: object

search_messagesC

Search messages across all chats.

Inputs: query (required), limit. Returns: object

send_fileC

Send a local file (photo, video, document, voice) with an optional caption.

Inputs: chat (required), path (required), caption, force_document. Returns: object

send_messageB

Send a text message (also used to publish a post to a channel).

parse_mode: 'md' (bold, italic, code, link), 'html', or null for plain text.

Inputs: chat (required), text (required), silent, reply_to, +2 more. Returns: object

talk_to_botA

Send a message to a bot (e.g. @BotFather) and return its replies, including their buttons.

Inputs: bot (required), text (required), timeout. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 23 tools

    Disambiguation5/5

    Each tool maps to a distinct resource and action: account, chats, participants, messages, media, groups/channels, and bots. Even the generic bot_api is clearly positioned as a raw API escape hatch rather than a duplicative operation.

    Naming Consistency4/5

    Most tools follow a clear verb_noun pattern such as send_message, create_channel, and delete_messages. Minor deviations like chat_info and bot_api break the pattern, but they are still readable and predictable.

    Tool Count3/5

    With 23 tools, the server sits in the heavy borderline range where coherence can suffer. However, the count is justified by the broad Telegram feature surface and each tool has a distinct purpose.

    Completeness4/5

    The tool set covers the primary lifecycle well: chats, messages, media, groups/channels, participants, and bot management. Minor gaps exist, such as updating chat metadata or profile settings, but they are not critical for core Telegram workflows.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      F
      maintenance
      Enables Claude to interact with your Telegram account, including reading messages, searching conversations, and sending messages.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables reading and searching Telegram channel/group/DM messages from Claude Code using MTProto for full message history access.
      5
      39 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connect Claude to your personal Telegram account via MTProto to read messages, search chats, send replies, forward files, and more using your real account.
      15 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude to send messages, media, and manage Telegram chat messages through a Telegram bot, including sending photos, documents, and editing or deleting messages.
      MIT