Telegram机器人MCP服务器

Telegram Bot MCP Server是一个基于Model Context Protocol(MCP)的服务,提供27种工具用于发送消息、管理聊天、处理Webhook等Telegram Bot API功能,适用于Claude Desktop、Cursor、VS Code等MCP客户端。

  • by node2flow-th
  • TypeScript
  • 混合部署
  • 更新于
在 GitHub 查看 node2flow-th/telegram-bot-mcp-community

使用说明

电报机器人MCP服务器

用于Telegram Bot API的MCP(模型上下文协议)服务器。通过27个工具发送消息、管理聊天、处理Webhook等。

适用于Claude Desktop、Cursor、VS Code和任何MCP客户端。


快速开始

克劳德桌面

增添 claude_desktop_config.json:

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["-y", "@node2flow/telegram-bot-mcp"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token"
      }
    }
  }
}

光标/VS代码

添加到MCP设置:

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["-y", "@node2flow/telegram-bot-mcp"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your-bot-token"
      }
    }
  }
}

HTTP模式(流式HTTP)

对于远程部署或共享访问:

TELEGRAM_BOT_TOKEN=your_token npx @node2flow/telegram-bot-mcp --http

服务器在端口3000上启动(可通过配置 PORT env变量)。MCP端点: http://localhost:3000/mcp


配置

环境变量 必填 说明
TELEGRAM_BOT_TOKEN 是 来自的Telegram Bot令牌 @植物学家
PORT 否 HTTP服务器的端口(默认值: 3000,仅用于 --http)

所有工具(27个工具)

机器人信息(2个工具)

工具 说明
tg_get_me 获取机器人信息
tg_set_my_commands 设置机器人命令菜单

发送消息(8个工具)

工具 说明
tg_send_message 使用Markdown/HTML格式发送文本
tg_send_photo 发送照片(URL或file_id)
tg_send_document 发送文档/文件(最大50MB)
tg_send_video 发送视频(MPEG4,最大50MB)
tg_send_audio 发送音频(MP3/M4A,最大50MB)
tg_send_location 发送地理位置
tg_send_poll 发送投票(常规或测验)
tg_send_contact 发送电话联系卡

编辑/删除(3个工具)

工具 说明
tg_edit_message_text 编辑消息文本
tg_edit_message_caption 编辑媒体标题
tg_delete_message 删除消息(48小时限制)

聊天管理(5个工具)

工具 说明
tg_get_chat 获取聊天详细信息
tg_get_chat_member_count 获取会员数量
tg_get_chat_member 获取会员信息
tg_ban_chat_member 禁止用户聊天
tg_unban_chat_member 取消阻止用户

Webhooks(3个工具)

工具 说明
tg_set_webhook 设置webhook URL
tg_delete_webhook 删除webhook
tg_get_webhook_info 获取webhook状态

回调和文件(3个工具)

工具 说明
tg_answer_callback_query 按下在线应答按钮
tg_get_file 获取文件下载URL
tg_get_user_profile_photos 获取用户个人资料照片

固定链接和邀请链接(3个工具)

工具 说明
tg_pin_chat_message 固定消息
tg_unpin_chat_message 不愉快的消息
tg_create_chat_invite_link 创建邀请链接

需求

  • Node.js 18+
  • Telegram Bot令牌

如何创建Telegram Bot

  1. 打开 @植物学家 在Telegram上
  2. 发送 /newbot 并按照提示进行操作
  3. 复制令牌并将其用作 TELEGRAM_BOT_TOKEN

面向开发者

git clone https://github.com/node2flow-th/telegram-bot-mcp-community.git
cd telegram-bot-mcp-community
npm install
npm run build

# Run in stdio mode
TELEGRAM_BOT_TOKEN=your_token npm start

# Run in dev mode (hot reload)
TELEGRAM_BOT_TOKEN=your_token npm run dev

# Run in HTTP mode
TELEGRAM_BOT_TOKEN=your_token npm start -- --http

许可证

MIT许可证-请参阅 许可证

版权所有(c)2026 Node2Flow

链接