Skip to main content

Telegram Bot API integration via MCP

Project description

🚀 telegram-mcp-kit

MCP server that exposes the Telegram Bot API as tools for Claude Code (or any MCP client).

License: MIT Python Version uv

Table of Contents


🚀 Quick Start

Get your bot token from @BotFather on Telegram. Once the server is configured, you can run /mcp inside Claude Code to verify it is connected.

🛠️ Installation

Get your bot token from @BotFather on Telegram first.

Option 1: From PyPI (recommended)

claude mcp add telegram-mcp-kit \
  -e TELEGRAM_BOT_TOKEN=your-bot-token-here \
  -e TELEGRAM_CHAT_ID=your-chat-id \
  -- uvx telegram-mcp-kit
Manual MCP config
{
  "mcpServers": {
    "telegram-mcp-kit": {
      "command": "uvx",
      "args": ["telegram-mcp-kit"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token-here",
        "TELEGRAM_CHAT_ID": "your-chat-id"
      }
    }
  }
}

Option 2: From GitHub

claude mcp add telegram-mcp-kit \
  -e TELEGRAM_BOT_TOKEN=your-bot-token-here \
  -e TELEGRAM_CHAT_ID=your-chat-id \
  -- uvx --from "git+https://github.com/QuocTang/telegram-bot.git#subdirectory=telegram-mcp-kit" telegram-mcp-kit
Manual MCP config
{
  "mcpServers": {
    "telegram-mcp-kit": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/QuocTang/telegram-bot.git#subdirectory=telegram-mcp-kit",
        "telegram-mcp-kit"
      ],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token-here",
        "TELEGRAM_CHAT_ID": "your-chat-id"
      }
    }
  }
}

Option 3: From source

git clone https://github.com/QuocTang/telegram-bot.git
cd telegram-bot/telegram-mcp-kit
cp .env.example .env   # add your TELEGRAM_BOT_TOKEN
uv sync
claude mcp add telegram-mcp-kit \
  -- uv run --directory /absolute/path/to/telegram-mcp-kit telegram-mcp-kit
Manual MCP config
{
  "mcpServers": {
    "telegram-mcp-kit": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/telegram-mcp-kit",
        "telegram-mcp-kit"
      ]
    }
  }
}

With this option, TELEGRAM_BOT_TOKEN is read from the .env file inside the project directory.

Environment variables

Variable Required Description
TELEGRAM_BOT_TOKEN Yes Token from BotFather
TELEGRAM_CHAT_ID No Default chat ID (if set, chat_id can be omitted in tool calls)
MCP_TRANSPORT No stdio (default) or sse
MCP_HOST No Bind host (default 127.0.0.1)
MCP_PORT No Bind port (default 8000)
HTTP_TIMEOUT No Telegram API timeout in seconds (default 30)

📦 Features

🚀 Feature 📝 Description
🛠️ 20+ Tools Comprehensive coverage for messages, chat management, files/photos, and bot info.
🔍 Auto-discovery Simply add a Python file to the tools/ folder and it registers automatically.
📡 Flexible Transport Works seamlessly over stdio (for local clients) or SSE (remote/Docker).

Tools List

Messages

Tool Description
send_message Send a text message (Markdown/HTML)
edit_message Edit an existing message
delete_message Delete a message
forward_message Forward a message between chats

Updates

Tool Description
get_updates Fetch recent messages/updates the bot received

Chat management

Tool Description
get_chat_info Get chat metadata (name, type, description)
get_chat_member_count Count members
get_chat_admins List administrators
ban_member Ban a user
unban_member Unban a user
set_chat_title Change group/channel title
set_chat_description Change group/channel description
pin_message Pin a message
unpin_message Unpin a message

Files & photos

Tool Description
send_photo Send a photo by URL or file_id
send_photo_file Send a local photo file
send_document Send a document by URL or file_id
send_document_file Send a local file as document
get_file_info Get file metadata + download link

Bot

Tool Description
get_bot_info Get bot name, username, etc.

🤝 How to Contribute

We welcome contributions! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature.
  3. Submit a Pull Request.

See CONTRIBUTING.md for how to add new tools.

Development

uv sync                        # install all deps (including dev)
uv run pytest -v               # run tests
uv run ruff check src/ tests/  # lint

💬 Community & Support

If this repository saves you time, please star the repository!

👥 Repo Contributors

Repository contributors

Made with contrib.rocks.

⚖️ License

MIT License. See LICENSE for details.

🌟 Star History

Star History Chart

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_kit-0.2.1.tar.gz (47.7 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_kit-0.2.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file telegram_mcp_kit-0.2.1.tar.gz.

File metadata

  • Download URL: telegram_mcp_kit-0.2.1.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for telegram_mcp_kit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7d199152c038688786135e769c01363694bd227a73f464cb221ca3f442fbc9cd
MD5 d3d15180ee664d00babfd4712d901e6c
BLAKE2b-256 9a2f7792f41a1e60344fa0f4ea272e09f6553f8c1774719951fda1e269835f49

See more details on using hashes here.

File details

Details for the file telegram_mcp_kit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: telegram_mcp_kit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for telegram_mcp_kit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c0959f4fe80b2d825713288e4871fa1069798f7540bfab3c5c2f19a849dd747
MD5 bc214c3e7b51a3adb90a2d620585a75b
BLAKE2b-256 5e496afb14e4b0dd58fea9be77428814450f94125e0bef393f7e7ccff0e28f1b

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