📬 mcp-telegram-agent
Give your AI agent full Telegram Bot superpowers — zero login risk, zero setup.
A 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.
🔐 Stop giving AI your personal Telegram account credentials.
mcp-telegram-agent is a lightweight, zero-login-risk notification and delivery tool — just one Bot Token sends local files, reports, interactive keyboards, and rich notifications straight to your phone.
✨ 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-agentor the compacttg-agentalias. - 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
- Open Telegram and search for @BotFather (verified blue check).
- Send
/newbotand follow the prompts: choose a display name, then a username ending inbot(e.g.my_alert_bot). - BotFather replies with your Bot Token, e.g.
123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Keep it secret — anyone with this token can control your bot. - 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
- Send any message (e.g. "hi") to your new bot.
- Open this URL in a browser, replacing
<YOUR_BOT_TOKEN>with your token:https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - In the JSON response, locate
"chat":{"id": 123456789, ...}— that number is your Chat ID.- Alternative: send any message to
@userinfobotand it replies with your ID.
- Alternative: send any message to
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
@userinfobotto 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 checkgetUpdatesas above.
- Temporarily add
- 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_idomitted → the message goes to theTELEGRAM_DEFAULT_CHAT_IDfrom your config.chat_idprovided → 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).
✅ Example A — Universal Default (Recommended)
A universal configuration that works with every MCP client — just fill in your bot token and chat ID:
{
"mcpServers": {
"Telegram": {
"command": "uvx",
"args": ["mcp-telegram-agent"],
"env": {
"TELEGRAM_BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN",
"TELEGRAM_DEFAULT_CHAT_ID": "YOUR_CHAT_ID"
}
}
}
}
💡 Both
envvariables are optional. If they are missing, the server still starts normally — it returns a clear, human-readable error only when a tool call actually needs the token or the fallback chat ID. This also allows a credential-free trial run with noenvblock at all:
{
"mcpServers": {
"Telegram": {
"command": "uvx",
"args": ["mcp-telegram-agent"]
}
}
}
🧰 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. |
💬 Usage Examples
Once configured, simply talk to your AI agent in natural language — it picks the right tool automatically. Below are typical requests together with the tool calls the agent makes:
📢 Send a formatted notification
"Tell me in Telegram that the nightly build succeeded, with a button linking to https://example.com"
{
"tool": "send_text_message",
"arguments": {
"text": "✅ *Nightly build succeeded!*",
"parse_mode": "Markdown",
"inline_buttons": [[{"text": "Dashboard", "url": "https://example.com"}]]
}
}
📁 Share local files
"Upload
logs/app.logto my Telegram and summarize the errors"
{
"tool": "send_local_document",
"arguments": {
"file_path": "logs/app.log",
"caption": "Error log summary: 3 timeout warnings"
}
}
🖼️ Send an album
"Send the three screenshots in
screenshots/to my Telegram as one album"
{
"tool": "send_media_album",
"arguments": {
"file_paths": ["screenshots/1.png", "screenshots/2.png", "screenshots/3.png"],
"caption": "Latest UI screenshots"
}
}
🗳️ Run a quiz in a group
"Post a quiz to chat ID -1001234567890: which port does HTTPS use? Options 80 / 443 / 8080, the answer is 443, with a short explanation"
{
"tool": "send_poll",
"arguments": {
"chat_id": "-1001234567890",
"question": "Which port does HTTPS use?",
"options": ["80", "443", "8080"],
"type": "quiz",
"correct_option_id": 1,
"explanation": "HTTPS defaults to port 443."
}
}
♻️ Update or clean up messages
"Change that deployment notice to 'finished', then delete the old reminder (ID 120)"
{
"tool": "edit_message_text",
"arguments": { "message_id": 123, "text": "🚀 Deployment **finished**" }
}
{
"tool": "delete_message",
"arguments": { "message_id": 120 }
}
💡 When
chat_idis omitted, messages go toTELEGRAM_DEFAULT_CHAT_ID; pass it explicitly to reach any user, group, or channel — see step 4️⃣ above.
🛠️ Development & Release Flow
- Develop against
main— all feature work and PRs land here. - Publishing happens only from the
releasebranch: open a PRmain→release, bumpversioninpyproject.tomlwithin 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
releaseare 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.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_telegram_agent-0.1.8.tar.gz | 96.7 kB | Without provenance | Details for mcp_telegram_agent-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_telegram_agent-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for mcp_telegram_agent-0.1.8-py3-none-any.whl |
Total release size: 108.5 kB
Release files / mcp_telegram_agent-0.1.8.tar.gz
| Download URL | mcp_telegram_agent-0.1.8.tar.gz |
|---|---|
| Size | 96.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5280faf73c42291b78742b47e2ee3823a42124ff40c9e6f8e79fb50c78da630a
|
|
BLAKE2b-256 checksum How to use checksums |
49f47b4025366625c4e0a9671015218491aaec425bd9a7487f22e7654ff1f66d
|
| 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.8-py3-none-any.whl
| Download URL | mcp_telegram_agent-0.1.8-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04e9f963fece56321488adacab87d4ac43974bd5e4fc3342fd99cffeed8f7297
|
|
BLAKE2b-256 checksum How to use checksums |
0738949aefce5067f71da14dbe1a9b388bf7e838d01c628d9ab4f783af89a6ff
|
| 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.8
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.