Skip to main content

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 header
  • session_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 replies
  • media_type: "photo", "video", "audio", or "document" (auto-detected from extension if not provided)
  • media_url: URL of remote media to send
  • media_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

  1. USE TELEGRAM FOR EVERYTHING - All status updates, questions, results
  2. ALWAYS END WITH wait_for_reply=True - Never just end; keep the conversation alive
  3. ACKNOWLEDGE IMMEDIATELY - After receiving a reply, send acknowledgement before doing work
  4. 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

Metadata

Release files for telegram-mcp 0.6.3

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

Source distribution (sdist)

Source distribution for telegram-mcp 0.6.3
File Size Uploaded Provenance Actions
telegram_mcp-0.6.3.tar.gz 5.1 kB Without provenance Details for telegram_mcp-0.6.3.tar.gz

Built distribution (wheel)

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

Total release size: 11.2 kB

Release files / telegram_mcp-0.6.3.tar.gz

Download URL telegram_mcp-0.6.3.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cb4c0b267818a1be4eb19a731a2cdc591fdbffe52bff2eb0566bb6129b42cc23
BLAKE2b-256 checksum
How to use checksums
81dc785a2cc5a0a73b709c23575ab4b49ffca8cd61ebba83a704424058744de9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / telegram_mcp-0.6.3-py3-none-any.whl

Download URL telegram_mcp-0.6.3-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f3ec0c17d7756a4b9290a3c90142809e35f609d730562af7cfbce1eebb5a075
BLAKE2b-256 checksum
How to use checksums
aeac21f7e6459c9dc086f0be3fa291c2177fdbebce2a9a2e9f39d4cd639ff07f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for telegram-mcp 0.6.3

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