Skip to main content

Telegram Bot MCP

MCP (Multi-purpose Computing Platform) for working with Telegram Bot API. Provides functions for sending and receiving messages through Telegram bot.

Features

  • Send text messages to chats
  • Send media content (photos, documents, videos, audio)
  • Create and send polls
  • Get bot information
  • Get updates (messages, events) from users
  • Delete messages

Installation

git clone https://github.com/coderroleggg/telegram-bot-mcp
cd telegram-bot-mcp
uv venv
source .venv/bin/activate
uv pip install -e .

Connecting to Claude Desktop, Cursor

Add the telegram-bot block to your mcp.json or claude_desktop_config.json or completely replace the file content with:

{
    "mcpServers": {
        "telegram-bot": {
            "type": "stdio",
            "command": "uv",
            "args": [
                "run",
                "--directory",
                "/Users/yourusername/Downloads/telegram-bot-mcp", // path to the bot code folder
                "server"
            ],
            "name": "Telegram Bot API",
            "description": "MCP for working with Telegram Bot API. Send messages, media and work with bot.",
            "config": {
                "token": "YOUR_BOT_TOKEN_HERE"
            }
        }
    }
}

Available Functions

  • sendMessage - send text message
  • sendPhoto - send photo
  • deleteMessage - delete message
  • getMe - get bot information
  • getUpdates - get new messages and events

Usage Examples

Sending a Message

response = mcp.call("sendMessage", {"chatId": "12345678", "text": "Hello, world!"})
print(response)

Getting Updates

updates = mcp.call("getUpdates", {})
for update in updates["updates"]:
    print(update)

Example Usage in Cursor

Here's how to use the Telegram Bot MCP in Cursor:

Cursor Usage Example

Result Message

Example of a message sent through the bot:

Result Message

License

MIT

API Tools

initialize

Initializes configuration for Telegram Bot MCP.

Parameters:

  • token: Your Telegram bot token obtained from @BotFather

sendMessage

Sends a text message to the specified chat.

Parameters:

  • chatId: Chat ID where to send the message (string or number)
  • text: Message text to send

sendPhoto

Sends a photo to the specified chat.

Parameters:

  • chatId: Chat ID where to send the photo (string or number)
  • photoUrl: Photo URL or path to local file
  • caption: Photo caption (optional)

sendDocument

Sends a document to the specified chat.

Parameters:

  • chatId: Chat ID where to send the document (string or number)
  • documentUrl: Document URL or path to local file
  • caption: Document caption (optional)
  • filename: File name (optional)

sendVideo

Sends a video to the specified chat.

Parameters:

  • chatId: Chat ID where to send the video (string or number)
  • videoUrl: Video URL or path to local file
  • caption: Video caption (optional)
  • duration: Video duration in seconds (optional)
  • width: Video width (optional)
  • height: Video height (optional)

sendAudio

Sends audio to the specified chat.

Parameters:

  • chatId: Chat ID where to send the audio (string or number)
  • audioUrl: Audio URL or path to local file
  • caption: Audio caption (optional)
  • duration: Audio duration in seconds (optional)
  • performer: Performer (optional)
  • title: Track title (optional)

sendPoll

Sends a poll message to the specified chat.

Parameters:

  • chatId: Chat ID where to send the poll (string or number)
  • question: Poll question
  • options: List of answer options (strings)
  • isAnonymous: Whether the poll is anonymous (optional, default True)
  • allowsMultipleAnswers: Whether multiple answers are allowed (optional, default False)

getMe

Gets information about the bot.

Parameters: none

getUpdates

Gets updates (messages, events) from Telegram Bot API.

Parameters:

  • offset: ID of the first update to return (optional)
  • limit: Maximum number of updates to return (optional, default 100)
  • timeout: Timeout in seconds (optional, default 0)

deleteMessage

Deletes a message from the chat.

Parameters:

  • chatId: Chat ID from which to delete the message (string or number)
  • messageId: Message ID to delete (number)

How to Get chatId?

To get a chat or user ID, there are several ways:

  1. Use the getUpdates tool and find the needed ID after sending a message to your bot

  2. Use a bot like @userinfobot: send it a message, and it will return your ID

  3. For group chats: add your bot to the group, send a message and use getUpdates to find the group ID

  4. For channels:

    • First, add your bot as an administrator to the channel with permission to send messages
    • Forward any message from the channel to @userdatailsbot
    • The bot will return the channel ID (it will be negative and start with -100)
    • Use this ID as chatId when sending messages to the channel

Limitations

  • Bot cannot start a conversation with a user first, the user must send a message to the bot first
  • Bot can only send messages to chats where it is present
  • Some file formats may be restricted by Telegram
  • When sending local files, they must be accessible to the process in which MCP is running

Additional Information

For more information about Telegram Bot API:

Metadata

Release files for iflow-mcp_coderroleggg-telegram-bot-mcp 1.0.0

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

Source distribution (sdist)

Source distribution for iflow-mcp_coderroleggg-telegram-bot-mcp 1.0.0
File Size Uploaded
iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_coderroleggg-telegram-bot-mcp 1.0.0
File Interpreter ABI Platform
iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0.tar.gz

Download URL iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
87d852beefbda64d3ddf47380c30a21c4ca5b7fe3155e62bb87d08815cb68fde
BLAKE2b-256 checksum
How to use checksums
2ed23da7c75de969556f778be4347142998849080cef5b039571851161809055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0-py3-none-any.whl

Download URL iflow_mcp_coderroleggg_telegram_bot_mcp-1.0.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e154792186bae193c17f725436e7b6f3f70f7ab4b12f8fc967acc7dd69e4f99e
BLAKE2b-256 checksum
How to use checksums
a492bb34f9fa850b813be05fff0bd8acaada3ff7039e2192a9eaea57f0438c57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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