telegram-api-mcp
by timoncool·★ 20·综合分 45
全面的 Telegram Bot API MCP 服务器,完整支持 v9.6,包含元模式和高级速率限制。
概述
这个 MCP 服务器完整覆盖 Telegram Bot API v9.6,提供了全部 169 个方法作为工具。它包含高级功能如速率限制(全局和每聊天)、熔断器模式、带退避的重试机制和元模式以提高上下文效率。服务器使用 TypeScript 和 Zod 验证进行健壮的参数检查,实现了安全措施如令牌屏蔽和路径遍历保护,并保持最少的依赖(仅 2 个)。代码库采用清晰的架构,具有声明式方法注册,使其易于扩展和维护。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
如果您需要将 Telegram 机器人与 Claude AI 集成,特别是当您使用最新的 Bot API 功能并需要元模式等高级功能以提高 token 效率时,请选择此服务器。
什么时候不要选它
如果您需要其他消息平台的 API 或需要 Telegram Bot API 之外的功能,请考虑替代方案,因为它专门用于 Telegram。
此 server 暴露的工具
从 README 抽取出 12 个工具telegram_findSearch Telegram Bot API methods by keyword or category
telegram_callCall any Telegram Bot API method by name with JSON parameters
sendMessageSend text messages to a chat
sendPhotoSend photos to a chat
sendPollSend polls to a chat
getChatGet information about a chat
banChatMemberBan a user from a chat
forwardMessageForward messages between chats
editMessageTextEdit text messages
getMeGet information about the bot
setMyCommandsSet bot commands in the menu
sendStickerSend stickers to a chat
可对比工具
安装
安装
Claude Code
claude mcp add telegram -- npx telegram-api-mcp -e TELEGRAM_BOT_TOKEN=your_tokenClaude 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.jsFAQ
- 什么是元模式,为什么使用它?
- 元模式只使用 2 个工具(telegram_find 和 telegram_call)而不是 169 个,节省约 99% 的上下文令牌。这在长期对话中很有用,因为维持所有 169 个工具的上下文会过于昂贵。
- 速率限制如何工作?
- 服务器实现了令牌桶速率限制,有两个级别:全局(默认 30 请求/秒)和每聊天(默认 20 消息/分钟)。这些限制符合 Telegram 的官方要求,可以防止 API 滥用。
telegram-api-mcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。