mcp-telegram
v1.0.7MCP server that connects an AI agent to one Telegram channel through a bot: read incoming posts, publish, edit, delete, pin, react and exchange files.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_channel_info
Describe the configured channel: title, @username, link, description, subscriber count, pinned post, and the bot's administrator rights, with the rights it lacks. Call it first when a write fails for lack of rights, or to check the setup.
list_posts
List the channel's posts, newest first, after fetching the updates Telegram holds for the bot. Only posts published or edited since the bot became an administrator are known: a bot cannot read older history. Posts deleted by a human stay listed, because Telegram does not tell bots about deletions. Page backwards with before_message_id, or read what came after a known post with after_message_id (then the oldest come first in the page, still returned newest first).
| Parameter | Type | Description |
|---|---|---|
after_message_id | integer | Only posts with a greater message_id |
before_message_id | integer | Only posts with a smaller message_id |
limit | integer | Number of posts to return, 1-100. Defaults to 20 |
get_post
Return one post of the channel by its message_id, with its text or caption, media, reactions and link.
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
wait_for_posts
Block until at least one new or edited post arrives in the channel, or until the timeout. Returns the posts received (an empty list on timeout) and a cursor. Pass that cursor to the next call to get exactly what arrived since, edits included, even if another call read it first. Posts sent through this server are not waited for: their result is already returned by the sending tool.
| Parameter | Type | Description |
|---|---|---|
cursor | string | Cursor returned by a previous call: only posts received after it are returned. Omit to wait for posts received from now on |
timeout_seconds | integer | Maximum wait, 1-300 seconds. Defaults to 60 |
enable_notifications
Get notified of new and edited posts of the channel without waiting for them. Returns immediately: it hands you the exact Monitor call to make right after — arming that watcher is what actually delivers notifications, and until you do it no post will reach you. Call it once at the start of a session; then keep working, new posts interrupt you on their own. The host stops the watcher after 30 minutes at most: re-arm it with the same Monitor call each time it expires. Works locally and behind mcp-http-gateway.
| Parameter | Type | Description |
|---|---|---|
_gateway_watch | object | Filled in by the mcp-http-gateway relay, never by the agent: the relay will run the watcher and needs a watch specification instead of a local command |
send_post
Publish a text post in the channel. The text is limited to 4096 characters after formatting is parsed. Returns the published post. Requires the can_post_messages right.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text of the post |
disable_link_preview | boolean | Do not show a preview of the first link. Defaults to false |
parse_mode | string | Formatting of the text. Omit for plain text. HTML supports <b>, <i>, <u>, <s>, <code>, <pre>, <a href>, <blockquote>, <tg-spoiler>; escape <, > and & as entities. MarkdownV2 requires escaping _*[]()~`… |
reply_to_message_id | integer | Identifier of a post of the channel this post replies to |
silent | boolean | Publish without a notification sound for subscribers. Defaults to false |
send_media
Publish a photo, video, animation, audio, voice note or document in the channel, with an optional caption (1024 characters at most). Give exactly one source: file_path for a file on the agent machine (10 MB for a photo, 50 MB otherwise), url for a file Telegram downloads itself, or file_id to reuse a file already on Telegram (the media.file_id of a post). Returns the published post. Requires the can_post_messages right.
| Parameter | Type | Description |
|---|---|---|
kind * | string | How Telegram shows the file. 'document' sends any file as is, without compression |
caption | string | Caption shown under the media |
file_content | string | Filled in by the mcp-http-gateway relay, never by the agent: the base64 content of the file read on the agent machine |
file_id | string | Telegram file_id of a file already sent to Telegram |
file_name | string | Filled in by the mcp-http-gateway relay, never by the agent: the name of the file read on the agent machine |
file_path | string | Absolute path of the file to publish, on the agent machine. It must sit inside one of the directories allowed by TELEGRAM_UPLOAD_ROOTS |
parse_mode | string | Formatting of the text. Omit for plain text. HTML supports <b>, <i>, <u>, <s>, <code>, <pre>, <a href>, <blockquote>, <tg-spoiler>; escape <, > and & as entities. MarkdownV2 requires escaping _*[]()~`… |
reply_to_message_id | integer | Identifier of a post of the channel this post replies to |
silent | boolean | Publish without a notification sound for subscribers. Defaults to false |
url | string | HTTP(S) URL of the file, downloaded by Telegram |
edit_post
Change the text of a text post (text), or the caption of a media post (caption). Give exactly one of the two. Returns the edited post. Requires the can_edit_messages right.
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
caption | string | New caption of a media post; an empty string removes it |
disable_link_preview | boolean | Text posts only: do not show a link preview. Defaults to false |
parse_mode | string | Formatting of the text. Omit for plain text. HTML supports <b>, <i>, <u>, <s>, <code>, <pre>, <a href>, <blockquote>, <tg-spoiler>; escape <, > and & as entities. MarkdownV2 requires escaping _*[]()~`… |
text | string | New text of a text post |
delete_posts
Delete posts of the channel. Irreversible. If one post cannot be deleted, none is. Requires the can_delete_messages right.
| Parameter | Type | Description |
|---|---|---|
message_ids * | array | Identifiers of the posts to delete, 1-100 |
pin_post
Pin a post at the top of the channel. Requires the can_edit_messages right.
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
silent | boolean | Publish without a notification sound for subscribers. Defaults to false |
unpin_post
Unpin a pinned post of the channel. Requires the can_edit_messages right.
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
react_to_post
Set the bot's reaction on a post, or remove it when emoji is omitted. Only the emoji allowed in the channel's settings are accepted (for example 👍 ❤ 🔥 🎉 👏).
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
emoji | string | The reaction emoji. Omit to remove the bot's reaction |
download_media
Download the file of a media post (photo, video, document…) into a directory of the agent machine. The file never passes through the conversation. Bots can download files up to 20 MB.
| Parameter | Type | Description |
|---|---|---|
message_id * | integer | Identifier of the post in the channel (message_id) |
destination_overwrite | boolean | Replace the destination file if it already exists. Defaults to false |
destination_path | string | ABSOLUTE path of the destination DIRECTORY on the agent machine, inside one of the directories allowed by TELEGRAM_DOWNLOAD_ROOTS. It is created if missing. Required |
destination_relay | boolean | Filled in by the mcp-http-gateway relay, never by the agent. Signals that the destination lives on another machine and that the file content must travel in the response |
filename | string | Name of the file to create, extension included. Must not contain path separators. Defaults to the name Telegram gives the file |