Skip to main content

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.

# Simple status update
interact(message="Working on it...")

# Wait for reply and acknowledge
result = interact(message="What's next?", wait_for_reply=True)
interact(f"Got it! Working on: {result['reply']}")  # Always acknowledge!

# Yes/No buttons with acknowledgement
result = interact(message="Delete?", choices=["Yes", "No"], wait_for_reply=True)
if result["reply"] == "Yes":
    interact("Deleting now...")  # Acknowledge before action!

# Send a photo from URL
interact(message="Here's the result:", media_type="photo", media_url="https://...")

# Send a local file
interact(message="Generated image:", media_type="photo", media_path="/path/to/image.png")

# Send a document
interact(media_type="document", media_path="/path/to/report.pdf")

Important: After receiving a user reply, always send an acknowledgement immediately!

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telegram_mcp-0.5.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telegram_mcp-0.5.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file telegram_mcp-0.5.3.tar.gz.

File metadata

  • Download URL: telegram_mcp-0.5.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for telegram_mcp-0.5.3.tar.gz
Algorithm Hash digest
SHA256 7a2064e0e376e2b6ffdc59498eb50085f9b43d67f56d7889c0009f316b05c159
MD5 f3e0464103ec33b801dd8c55b11784f4
BLAKE2b-256 2e623c436825f8a42c247bc779ae5eb7268ef4166ebbc8c1f21d14551f6b6a7f

See more details on using hashes here.

File details

Details for the file telegram_mcp-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: telegram_mcp-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for telegram_mcp-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 285aaa4b8a0da6b06d3b998430879133b2ea6023bb8c49e1e3246d5ffc2ed990
MD5 9feba381df13199b1ff42a3fda72aa4c
BLAKE2b-256 46118e143f89f3b246ed19c307e198092d280a494b85baff2c86643e10829b13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page