MCP server for Telegram - lets AI agents communicate with users via Telegram
Project description
Telegram MCP
MCP server that lets AI agents communicate with users via Telegram.
Installation
pip install telegram-mcp
Configuration
Add to your MCP client config (e.g., Antigravity, Claude Desktop):
{
"telegram": {
"command": "telegram-mcp",
"env": {
"TELEGRAM_CHAT_ID": "your-chat-id"
}
}
}
Get your chat ID: Message @agent_comm_mcp_bot on Telegram and send /start.
That's it! No bot token needed - the client connects to our hosted server.
Tools
interact
Send a message or media to the user via Telegram.
Required Parameters:
project_name: Project/repository name (e.g., "my-project") - shown in message headersession_name: Current task/session context (e.g., "Fix login bug") - shown in message header
Optional Parameters:
message: Text to send (optional if sending media)wait_for_reply: Block until user replies (default: False)choices: Button labels for quick repliesmedia_type: "photo", "video", "audio", or "document" (auto-detected from extension if not provided)media_url: URL of remote media to sendmedia_path: Local file path to upload and send
Message Format
Messages appear with a header showing context:
🤖 my-project • 📋 Fix login bug
────────────────────
Your message content here...
⏳ Waiting for your reply...
Examples
# Simple status update
interact("my-project", "Deploy", "Working on it...")
# Wait for reply and acknowledge
result = interact("my-project", "Code review", "What's next?", wait_for_reply=True)
interact("my-project", "Code review", f"Got it! Working on: {result['reply']}")
# Yes/No buttons with acknowledgement
result = interact("my-project", "Cleanup", "Delete?", choices=["Yes", "No"], wait_for_reply=True)
if result["reply"] == "Yes":
interact("my-project", "Cleanup", "Deleting now...")
# Send a photo from URL
interact("my-project", "Results", "Here's the result:", media_type="photo", media_url="https://...")
# Send a local file
interact("my-project", "Export", "Generated image:", media_type="photo", media_path="/path/to/image.png")
# IMPORTANT: Always end with wait_for_reply to keep the loop alive!
interact("my-project", "Complete", "Done! What's next?", wait_for_reply=True)
Agent Guidelines
- USE TELEGRAM FOR EVERYTHING - All status updates, questions, results
- ALWAYS END WITH
wait_for_reply=True- Never just end; keep the conversation alive - ACKNOWLEDGE IMMEDIATELY - After receiving a reply, send acknowledgement before doing work
- USE MEANINGFUL HEADERS -
project_name= repo name,session_name= current task
User Reply Requirement: When responding to wait_for_reply messages, users must swipe the message in Telegram to reply. This ensures replies go to the correct request, especially when multiple agents are active.
Response format
# Text reply
{"reply": "user's text message"}
# Media reply (when user sends photo/video/audio/document)
{
"reply": {
"text": "caption if any",
"media": {
"type": "photo",
"file_id": "telegram_file_id",
"url": "https://api.telegram.org/file/..."
}
}
}
# No reply (when wait_for_reply=False)
{"reply": None, "message_id": 123}
get_messages
Get recent conversation history.
result = get_messages(limit=10)
Self-Hosting
If you prefer to run your own server:
{
"telegram": {
"command": "telegram-mcp",
"env": {
"TELEGRAM_SERVER_URL": "https://your-server.com",
"TELEGRAM_CHAT_ID": "your-chat-id"
}
}
}
See the GitHub repo for server setup.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telegram_mcp-0.6.2.tar.gz.
File metadata
- Download URL: telegram_mcp-0.6.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ead4ebaee9a6fa6df691435003137215507427a111a704b41129af5e6c29a2
|
|
| MD5 |
262fbf932e3a189dd8952805981267f4
|
|
| BLAKE2b-256 |
2c9e730fe5e058624ed0a2705270e62ddc36cccfcb4a0d60e91180dd91f4e494
|
File details
Details for the file telegram_mcp-0.6.2-py3-none-any.whl.
File metadata
- Download URL: telegram_mcp-0.6.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9b2d82a581f9b3232540dcb933b51914b38e997aa39f3949bd6a27a4c3c0caa
|
|
| MD5 |
09bf622e91a306c3523b1250ca3f8041
|
|
| BLAKE2b-256 |
b333530c6334a792b825ba5ad0b47cf898b23f9c7e6c0f221e577559e941f4e4
|