Skip to main content

📬 mcp-telegram-agent

Give your AI agent full Telegram Bot superpowers — zero login risk, zero setup.

A lightweight, zero-login-risk Model Context Protocol (MCP) server empowering AI agents with Telegram Bot capabilities. Built with Python (SDK-compatible with both mcp 1.x FastMCP and 2.x MCPServer), designed to work seamlessly out-of-the-box with uvx and modern AI coding agents like VS Code Cline and Claude Desktop. Also includes the ultra-short command alias tg-agent.

PyPI Version Python Versions PyPI Downloads License: MIT

English · 繁體中文 · 简体中文


✨ Highlights

  • Pure Bot API Architecture — Zero login session risk, no SMS codes or sensitive credential files needed.
  • Dual CLI Entry Points — Call via standard mcp-telegram-agent or the compact tg-agent alias.
  • Full Keyboard Support — Effortlessly construct dynamic Inline Keyboards (with URLs or callback data) and custom Reply Keyboards.
  • Rich Media & Local Files — Deliver logs, reports, source code, images, audio, voice notes, videos, and multi-image albums (2–10 files).
  • Interactive Tooling — Launch quizzes, single/multiple-choice polls, GPS coordinates, digital contact cards, and animated dice.
  • Message Lifecycle — Broadcast bot statuses (typing, uploading) and edit or delete messages on the fly.
  • Instant uvx Execution — Run directly with no virtual environments or manual package installs.

🚀 Quick Start

1️⃣ Create a Telegram Bot & Get the Token

  1. Open Telegram and search for @BotFather (verified blue check).
  2. Send /newbot and follow the prompts: choose a display name, then a username ending in bot (e.g. my_alert_bot).
  3. BotFather replies with your Bot Token, e.g. 123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Keep it secret — anyone with this token can control your bot.
  4. Important: open your new bot's chat and press Start (or send /start). A bot cannot message a user who has never started a conversation with it.

2️⃣ Get Your Personal Chat ID

  1. Send any message (e.g. "hi") to your new bot.
  2. Open this URL in a browser, replacing <YOUR_BOT_TOKEN> with your token: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  3. In the JSON response, locate "chat":{"id": 123456789, ...} — that number is your Chat ID.
    • Alternative: send any message to @userinfobot and it replies with your ID.

3️⃣ Send to Groups or Channels (Optional)

  • Add the bot to the group first (via group settings → Add members). For channels, the bot must be added as an administrator to post.
  • Group IDs are negative numbers (e.g. -1001234567890). To find one:
    • Temporarily add @userinfobot to the group and forward a group message to it, or
    • Disable the bot's Group Privacy via @BotFather (/setprivacy → select your bot → Disable), post a message in the group, then check getUpdates as above.
  • Once the bot is a member of the group/channel, it can send messages there — no extra configuration needed.

4️⃣ Sending to Any Chat at Runtime

TELEGRAM_DEFAULT_CHAT_ID is only the fallback target. Every tool accepts an optional chat_id parameter, so you can simply ask your AI agent to "send this to chat ID -1001234567890":

  • chat_id omitted → the message goes to the TELEGRAM_DEFAULT_CHAT_ID from your config.
  • chat_id provided → the message goes to that user/group/channel instead.
  • Requirement: the bot must be a member of that group/channel (or the target user must have pressed Start on the bot).

5️⃣ Configuration for AI Clients

Add the configuration below to your MCP settings file (e.g., cline_mcp_settings.json or claude_desktop_config.json).

Works with every MCP client. No client-specific fields — each tool call will ask for your confirmation before executing:

{
  "mcpServers": {
    "Telegram": {
      "command": "uvx",
      "args": ["mcp-telegram-agent"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN",
        "TELEGRAM_DEFAULT_CHAT_ID": "YOUR_CHAT_ID"
      }
    }
  }
}

💡 The autoApprove field above is intentionally omitted. This is the safe, portable default: the agent will prompt you for approval on every tool call, and the config stays valid for Claude Desktop and any other client.

⚡ Example B — VS Code Cline Auto-Approve (Optional)

⚠️ autoApprove is a VS Code Cline–specific field (cline_mcp_settings.json). Claude Desktop does not support it — do not copy this block into claude_desktop_config.json.

If you want Cline to send messages and files without asking for confirmation every time, add the autoApprove whitelist on top of Example A:

{
  "mcpServers": {
    "Telegram": {
      "command": "uvx",
      "args": ["mcp-telegram-agent"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN",
        "TELEGRAM_DEFAULT_CHAT_ID": "YOUR_CHAT_ID"
      },
      "autoApprove": [
        "send_text_message",
        "send_chat_action",
        "send_local_document",
        "send_local_photo",
        "send_local_video",
        "send_local_audio_or_voice",
        "send_media_album",
        "send_poll",
        "send_location",
        "send_contact",
        "send_dice",
        "edit_message_text",
        "delete_message"
      ]
    }
  }
}

🔐 Security note: with autoApprove enabled, the agent can send messages, files and media autonomously. Only enable it if you fully trust the bot's target chats.


🧰 Available Tools

Tool Description
send_text_message Send Markdown/HTML text with inline buttons or custom reply keyboards.
send_local_document Send any local file (PDF, CSV, code, logs, archives).
send_local_photo Send image files with captions and inline buttons.
send_local_video Send video files as native players.
send_local_audio_or_voice Send music tracks or native voice audio notes.
send_media_album Deliver 2 to 10 photos or videos as a grouped carousel.
send_poll Create interactive single/multiple choice polls or scored quizzes.
send_location Broadcast map location points via coordinates.
send_contact Share phone contact cards.
send_dice Send animated dice, basketball, football, or slot machines.
send_chat_action Display temporary bot statuses (typing, uploading).
edit_message_text Dynamically update previously sent text and keyboards.
delete_message Clean up or remove specific messages.

🛠️ Development & Release Flow

  • Develop against main — all feature work and PRs land here.
  • Publishing happens only from the release branch: open a PR main → release, bump version in pyproject.toml within the PR, then merge — CI builds and publishes to PyPI automatically, and creates a matching GitHub Release (v* tag + auto-generated notes).
  • If the version was not bumped, the workflow skips publishing with a clear warning — docs-only PRs won't break CI.
  • Direct pushes to release are blocked by branch protection; always go through a PR.

📄 License

This project is licensed under the MIT License.

Metadata

Release files for mcp-telegram-agent 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-telegram-agent 0.1.5
File Size Uploaded Provenance Actions
mcp_telegram_agent-0.1.5.tar.gz 93.7 kB Without provenance Details for mcp_telegram_agent-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-telegram-agent 0.1.5
File Interpreter ABI Platform Actions
mcp_telegram_agent-0.1.5-py3-none-any.whl Python 3 none any Details for mcp_telegram_agent-0.1.5-py3-none-any.whl

Total release size: 104.7 kB

Release files / mcp_telegram_agent-0.1.5.tar.gz

Download URL mcp_telegram_agent-0.1.5.tar.gz
Size 93.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a69cb4cd883ea07ff819da8b012fa351f1cfafc8be5035c3b0e26206f7dc6694
BLAKE2b-256 checksum
How to use checksums
7f20eed9ae07b909e493b19808ff91a98647be897e01b61895439067731e09cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mcp_telegram_agent-0.1.5-py3-none-any.whl

Download URL mcp_telegram_agent-0.1.5-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
643a55591acdf6eab1f808bce64bf1cb9604045d4b631924a1634558771ad639
BLAKE2b-256 checksum
How to use checksums
bfff3f6fed85a8106950da43461973269bb24bfd6b32275d14295740c773e660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mcp-telegram-agent 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page