Skip to main content
Glama

✈️ TgPilot

Give Claude, Cursor or any MCP-compatible AI agent your Telegram account.

Read chats, get unread digests, search history, reply, forward, post to channels, manage groups — by just asking your AI in plain language.

PyPI MCP Telegram License: MIT

You:    What did I miss in Telegram this morning? Reply to Alex that I'll be there at 7.
Claude: You have 4 unread chats:
        • Alex — asks if you're coming to dinner tonight
        • Design team — new mockups for the landing page (3 files)
        • Mom — "call me when you're free"
        • @durov channel — 1 new post
        ✅ Replied to Alex: "Sure, I'll be there at 7!"

Why TgPilot

  • 🧠 Works with any MCP client — Claude Desktop, Claude Code, Cursor, Windsurf, Cline, Zed, n8n, your own agent.

  • 👤 Real user account, not a bot: everything you can do in the Telegram app, your agent can do too.

  • 🛡 Safety first — read-only mode, allow / deny lists of chats, rate-limit handling, no data leaves your machine.

  • 🙋 Human-like — shows "typing…" with a natural pause before messaging people.

  • ⚡ One command to log in, one line of config to connect. No database, no bot token, session is a single string.

Related MCP server: telegram-mcp

🧰 Tools

Read

Act

get_me — account info

send_message — text, reply, scheduled send

list_dialogs — recent chats & unread

send_file — photo, video, document, voice

search_chats — people, groups, channels

forward_messages

get_chat_info — bio, members, about

edit_message / delete_messages

read_messages — history with pagination

react — emoji reactions

search_messages — in one chat or everywhere

pin_message / mark_read

unread_digest — what you missed

send_poll

read_comments — comments under a post

join_chat / leave_chat

get_participants — group members

create_group — group or channel + invite link

download_media — save media locally

invite_users, update_profile, block_user

Run tgpilot tools to see the list.

📦 Install

pip install git+https://github.com/Shukurov777/tgpilot
# or
uv tool install git+https://github.com/Shukurov777/tgpilot

🔑 Log in (once)

  1. Get api_id and api_hash at my.telegram.org/apps.

  2. Run:

tgpilot login

Enter your phone, the code from Telegram and 2FA password (if any). You'll get TG_SESSION — a string that gives full access to the account. Keep it secret.

🔌 Connect to your AI

{
  "mcpServers": {
    "telegram": {
      "command": "tgpilot",
      "args": ["serve"],
      "env": {
        "TG_API_ID": "123456",
        "TG_API_HASH": "your_api_hash",
        "TG_SESSION": "your_session_string"
      }
    }
  }
}
claude mcp add telegram \
  -e TG_API_ID=123456 -e TG_API_HASH=your_api_hash -e TG_SESSION=your_session_string \
  -- tgpilot serve
{
  "mcpServers": {
    "telegram": {
      "command": "tgpilot",
      "args": ["serve"],
      "env": { "TG_API_ID": "123456", "TG_API_HASH": "your_api_hash", "TG_SESSION": "your_session_string" }
    }
  }
}
docker build -t tgpilot .
docker run -i --rm --env-file .env tgpilot serve
tgpilot serve --transport streamable-http

⚙️ Configuration

Variable

Default

Description

TG_API_ID, TG_API_HASH

—

From my.telegram.org

TG_SESSION

—

Printed by tgpilot login

TG_READ_ONLY

0

1 = only reading tools are exposed (also serve --read-only)

TG_HUMAN_LIKE

1

"typing…" and a short pause before messaging people

TG_ALLOW_CHATS

empty

Comma list of @usernames / ids the agent may access. Empty = all

TG_DENY_CHATS

empty

Chats the agent must never see or touch

TG_DOWNLOAD_DIR

~/.tgpilot/downloads

Where download_media saves files

💡 Ideas to try

  • "Give me a digest of all unread chats, grouped by importance."

  • "Find who sent me the invoice last week and forward it to @accountant."

  • "Summarize the last 200 messages in the Design team group and post the summary there."

  • "Create a channel 'Daily AI news' and post today's top 5 headlines."

  • "Every message from @boss — reply that I'll answer within an hour." (with a scheduler / agent loop)

🔒 Security

  • Everything runs locally; TgPilot talks only to Telegram servers.

  • The session string is equal to your password — store it in env/secret manager, never commit it.

  • Start with --read-only and TG_ALLOW_CHATS until you trust your agent.

  • Content of messages is untrusted input. Tool instructions remind the model to treat chats as data, not commands.

  • Automating a user account must follow the Telegram Terms of Service. Don't spam.

🗺 Roadmap

  • Voice message transcription (Whisper)

  • Stories: view & download

  • Real-time events (new message → agent)

  • Multiple accounts

  • Prompts: daily digest, inbox zero

🤝 Contributing

Issues and PRs are welcome. If TgPilot saves you time — leave a ⭐, it really helps the project grow.

License

MIT © Bahrullo Shukurov

Available Tools

25 tools
block_userC

Block or unblock a user.

Inputs: user (required), unblock. Returns: result

create_groupC

Create a supergroup (or a channel when channel=True).

Inputs: title (required), about, channel. Returns: result

delete_messagesC

Delete messages (your own for everyone, or locally).

Inputs: chat (required), message_ids (required), for_everyone. Returns: result

download_mediaB

Download photo/video/voice/file from a message, returns local path.

Inputs: chat (required), message_id (required). Returns: result

edit_messageC

Edit your own message.

Inputs: chat (required), text (required), message_id (required). Returns: result

forward_messagesC

Forward one or more messages to another chat.

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

get_chat_infoC

Details of a user, group or channel (bio, members, links).

Inputs: chat (required). Returns: result

get_meB

Info about the connected Telegram account.

Inputs: no named parameters. Returns: result

get_participantsC

Members of a group or channel (admin rights required for channels).

Inputs: chat (required), limit, query. Returns: result

invite_usersC

Add users to a group or channel.

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

join_chatB

Join a public channel/group (@name) or an invite link (t.me/+hash).

Inputs: link (required). Returns: result

leave_chatB

Leave a group/channel or delete a private dialog.

Inputs: chat (required). Returns: result

list_dialogsC

Recent chats with type, id and unread counters.

Inputs: limit, unread_only. Returns: result

mark_readC

Mark a chat as read.

Inputs: chat (required). Returns: result

pin_messageC

Pin or unpin a message.

Inputs: chat (required), message_id (required), unpin. Returns: result

reactB

Put an emoji reaction on a message (empty emoji removes it).

Inputs: chat (required), message_id (required), emoji. Returns: result

read_commentsC

Comments under a channel post.

Inputs: channel (required), post_id (required), limit. Returns: result

read_messagesB

Last messages of a chat, oldest first. Use before_id to paginate.

Inputs: chat (required), limit, before_id. Returns: result

search_chatsC

Find users, groups and channels by name, @username or phone.

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

search_messagesC

Full-text search in one chat or across all chats (chat='').

Inputs: query (required), chat, limit. Returns: result

send_fileC

Send a local file, photo, video or voice note.

Inputs: chat (required), path (required), caption, as_voice. Returns: result

send_messageB

Send a text message (Markdown). Optional reply and scheduled send.

Inputs: chat (required), text (required), reply_to, schedule_minutes. Returns: result

send_pollC

Create a poll with 2-10 options.

Inputs: chat (required), options (required), question (required), multiple. Returns: result

unread_digestC

Summary of unread chats with their latest messages.

Inputs: chats, per_chat. Returns: result

update_profileB

Change name and/or bio of the account (empty = keep).

Inputs: bio, last_name, first_name. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 25 tools

    Disambiguation4/5

    Tools mostly map to distinct Telegram resources and actions. Some related areas exist—list_dialogs/search_chats/get_chat_info for chat discovery and read_messages/search_messages/unread_digest for retrieval—but their descriptions make the boundaries usable.

    Naming Consistency4/5

    Nearly all tools follow a snake_case verb_noun pattern such as send_message, read_messages, and join_chat. A few exceptions like unread_digest, react, and get_me are readable but slightly break the convention.

    Tool Count4/5

    25 tools is on the high side, but the broad Telegram client surface justifies most of them. Each tool corresponds to a real operation, with little obvious duplication, though some settings/admin functions could potentially be consolidated.

    Completeness4/5

    The set covers core messaging, media handling, chat discovery, group membership, profile updates, and basic moderation. Minor gaps remain around admin/permission management, chat settings such as mute/archive, and retrieving block lists.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with Telegram accounts through MCP, supporting messaging, contacts, groups, media, and admin functions.
      4
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to control a real Telegram user account via MTProto, allowing message sending, chat reading/searching, and message management through MCP tools.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to interact with a personal Telegram account via MCP, offering tools for reading and searching chats, summarizing unread messages, sending and editing messages, handling files and voice transcripts, and managing groups and channels, with read-only mode by default.
      Apache 2.0