MCP Catalogs
首页

telegram-api-mcp

by timoncool·20·综合分 45

全面的 Telegram Bot API MCP 服务器,完整支持 v9.6,包含元模式和高级速率限制。

communicationdeveloper-toolsproductivity
7
Forks
1
活跃 Issue
1 个月前
最近提交
2 天前
收录于

概述

这个 MCP 服务器完整覆盖 Telegram Bot API v9.6,提供了全部 169 个方法作为工具。它包含高级功能如速率限制(全局和每聊天)、熔断器模式、带退避的重试机制和元模式以提高上下文效率。服务器使用 TypeScript 和 Zod 验证进行健壮的参数检查,实现了安全措施如令牌屏蔽和路径遍历保护,并保持最少的依赖(仅 2 个)。代码库采用清晰的架构,具有声明式方法注册,使其易于扩展和维护。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:构建具有 AI 助手的 Telegram 机器人,能够发送消息、媒体、投票并与聊天互动
:通过自动化审核和内容发布管理 Telegram 群组/频道
:将 Telegram 功能集成到 AI 驱动的工作流程和自动化中
:什么是元模式,为什么使用它?
:速率限制如何工作?

什么时候选它

如果您需要将 Telegram 机器人与 Claude AI 集成,特别是当您使用最新的 Bot API 功能并需要元模式等高级功能以提高 token 效率时,请选择此服务器。

什么时候不要选它

如果您需要其他消息平台的 API 或需要 Telegram Bot API 之外的功能,请考虑替代方案,因为它专门用于 Telegram。

此 server 暴露的工具

从 README 抽取出 12 个工具
  • telegram_find

    Search Telegram Bot API methods by keyword or category

  • telegram_call

    Call any Telegram Bot API method by name with JSON parameters

  • sendMessage

    Send text messages to a chat

  • sendPhoto

    Send photos to a chat

  • sendPoll

    Send polls to a chat

  • getChat

    Get information about a chat

  • banChatMember

    Ban a user from a chat

  • forwardMessage

    Forward messages between chats

  • editMessageText

    Edit text messages

  • getMe

    Get information about the bot

  • setMyCommands

    Set bot commands in the menu

  • sendSticker

    Send stickers to a chat

可对比工具

slack-api-mcpdiscord-api-mcpwhatsapp-api-mcp

安装

安装

Claude Code

claude mcp add telegram -- npx telegram-api-mcp -e TELEGRAM_BOT_TOKEN=your_token

Claude Desktop

添加到 claude_desktop_config.json

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["telegram-api-mcp"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your_token_from_botfather"
      }
    }
  }
}

从源码安装

git clone https://github.com/timoncool/telegram-api-mcp.git
cd telegram-api-mcp
npm install && npm run build
TELEGRAM_BOT_TOKEN=your_token node dist/index.js

FAQ

什么是元模式,为什么使用它?
元模式只使用 2 个工具(telegram_find 和 telegram_call)而不是 169 个,节省约 99% 的上下文令牌。这在长期对话中很有用,因为维持所有 169 个工具的上下文会过于昂贵。
速率限制如何工作?
服务器实现了令牌桶速率限制,有两个级别:全局(默认 30 请求/秒)和每聊天(默认 20 消息/分钟)。这些限制符合 Telegram 的官方要求,可以防止 API 滥用。

telegram-api-mcp 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。