telegram-channel-mcp-server
telegram-channel-mcp-server
用于通过 Bot API 在 Telegram 频道中发布和管理帖子的 MCP 服务器(stdio)。 让代理(Claude Code、Claude Desktop 等)能够发布文本、照片、视频、相册、文档、 语音消息、视频笔记、投票/测验和付费内容,并编辑/删除/置顶帖子。
安装
npm install
npm run buildRelated MCP server: Telegram Bot MCP Server
配置
变量 | 必需 | 描述 |
| 是 | 来自 @BotFather 的机器人令牌。机器人必须是频道管理员,并具有“发布消息”权限(以及相应的编辑/删除权限)。 |
| 否 | 默认频道: |
Claude Code
claude mcp add telegram-channel -e TELEGRAM_BOT_TOKEN=123:ABC -e TELEGRAM_CHAT_ID=-1001234567890 -- node /abs/path/telegram-channel-mcp/dist/index.jsClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"telegram-channel": {
"command": "node",
"args": ["/abs/path/telegram-channel-mcp/dist/index.js"],
"env": { "TELEGRAM_BOT_TOKEN": "123:ABC", "TELEGRAM_CHAT_ID": "-1001234567890" }
}
}
}工具
工具 | 功能 |
| 带 HTML/MarkdownV2 的文本、链接预览控制、按钮 |
| 带说明文字、剧透和按钮的单个媒体项 |
| 将 2-10 个媒体项作为一个帖子发送的相册 |
| 用于 Telegram Stars 的付费帖子 |
| 投票或测验 / 关闭它并获取结果 |
| 修改文本、说明文字、媒体、按钮 |
| 删除最多 100 个帖子 |
| 置顶 / 取消置顶 |
| 从另一个聊天复制或转发帖子 |
| 代表频道添加回应 |
| 频道信息和订阅者数量(只读) |
媒体 在每个工具中都以字符串形式给出:公开的 http(s) URL、本地文件的绝对路径(由服务器上传),或 Telegram file_id(在发送结果中返回,因此无需重新上传即可复用文件)。
按钮 是行的数组:[[{ "text": "Website", "url": "https://…", "style": "primary" }], [{ "text": "Copy", "copy_text": "PROMO" }]]。url / callback_data / copy_text 三选一;style:primary | success | danger。
服务器处理的 Bot API 限制
相册和视频笔记不能携带按钮——请将它们放在单独的消息中发送。
在相册中,
show_caption_above_media会同时应用于所有项目。付费内容仅在频道中有效,价格为 1-10 000 stars。
频道中的投票始终是匿名的。
限制:文本 4096 字符,说明文字 1024,文件上传 50 MB / 通过 URL 20 MB。
开发
npm run dev # run from sources
npm run smoke -- /path/to/img.png # e2e check against a real channel (creates and deletes test posts)
npx @modelcontextprotocol/inspector node dist/index.js目录结构:src/telegram.ts - API 客户端和媒体解析,src/schemas.ts - 共享的 zod schemas,
src/format.ts - 响应格式化,src/tools/* - 按领域分组的工具,src/index.ts - 入口点。
This server cannot be deployed
Maintenance
Related MCP Connectors
Run a Telegram channel from your AI agent. Posts go out through your own bot, not your account.
Telegram channels you administer: analytics, content plans, scheduled publishing. No userbot
Publish, schedule, and manage social media posts across major platforms via the Postproxy API.
Live Telegram data: trending topics, channel profiles & metrics, post history incl. edits/deletions.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with Telegram channels through the Bot API, supporting comprehensive messaging operations including sending text/photos, creating polls, managing reactions, and editing/deleting messages. Provides complete channel management capabilities for automated Telegram bot operations.726 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables sending Telegram messages, photos, and documents, and retrieving bot information through the Telegram Bot API.34 npm1MIT
- AlicenseNot gradedqualityCmaintenanceLets Claude manage a Telegram channel through the Bot API, including tracking subscriber growth and publishing, editing, pinning, or deleting posts.34 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables publishing posts to a Telegram channel via an MCP tool, designed for scheduled content delivery and integration with Claude.-