
aiogram-mcp
io.github.Py2755由 GitHub 账号 Py2755 发布v0.7.1更新于 Oct 25, 2026
MCP server for aiogram Telegram bots — 30 tools, 7 resources, 3 prompts, event streaming
概览
把现有的 aiogram Telegram 机器人变成 MCP 服务器,让 AI 助手能发消息、管理群聊并响应事件。
- 可以做什么
- 发送、转发、删除和置顶消息,以及照片、文档、语音、视频、贴纸、投票、联系人和位置,并可创建带按钮的内联键盘、编辑消息和回应按钮回调。查询机器人、群聊和成员信息、成员数量及用户头像。管理群聊:封禁或解封用户,修改群标题和描述。订阅以 MCP 通知推送的实时 Telegram 事件,并可选向多个群聊广播。读取机器人信息、配置、群聊列表、消息历史、事件队列、文件元数据和审计日志等资源,并使用审核、公告和用户报告提示词。
- 适用场景
- 适合已经运行 aiogram 机器人、希望让 Claude Desktop 等 AI 客户端操作同一个机器人的场景:收发消息、执行审核、发布公告,或搭建交互式按钮流程,而无需重写处理函数。
- 运行要求
- 作为本地 stdio 进程与机器人一起启动(需要 Python 3.10+ 和 aiogram 3.20+,可通过 pip 或 uvx 安装)。需要 Telegram Bot API 令牌,通过 BOT_TOKEN 环境变量提供,并在机器人代码中加入中间件和 MCP 服务器。需要访问 Telegram 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 aiogram-mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
aiogram-mcp
[CI] [Python 3.10+] [License: MIT] [PyPI version] [MCP Registry]
Connect your Telegram bot to AI agents via the Model Context Protocol.
aiogram-mcp turns any aiogram bot into an MCP server. AI clients like Claude Desktop can then send messages, read chat history, build interactive menus, and react to events in real time — all through your existing bot, without rewriting a single handler.
Why aiogram-mcp?
Most Telegram MCP servers are thin wrappers with 3-5 tools. aiogram-mcp goes further:
- 30 tools — messaging, rich media, moderation, interactive keyboards, event subscriptions, broadcasting
- 7 resources — bot info, config, chat lists, message history, event queue, file metadata, audit log
- 3 prompts — ready-made moderation, announcement, and user report workflows
- Structured output — every tool returns typed Pydantic models with
outputSchemafor programmatic parsing - Real-time events — the bot pushes Telegram events to AI clients via MCP notifications (no polling)
- Interactive messages — AI agents create inline keyboard menus, handle button presses, edit messages
- Rate limiting — built-in token bucket prevents Telegram 429 errors
- Permission levels — restrict AI agents to read-only, messaging, moderation, or full admin access
- Audit logging — track every tool invocation with timestamps and arguments
- Zero rewrite — add 5 lines to your existing bot, keep all your handlers
How It Works
The bot runs normally for Telegram users. The MCP server runs alongside it, giving AI agents access to the same bot via tools and resources.
Installation
Requires Python 3.10+ and aiogram 3.20+.
Quickstart
1. Add aiogram-mcp to your bot
2. Connect Claude Desktop
Add to your claude_desktop_config.json:
Now Claude can send messages, read history, create button menus, and react to events in your Telegram bot.
Built-in Tools
Messaging (5 tools)
Interactive Messages (3 tools)
Users (3 tools)
Chats (6 tools)
Rich Media (10 tools)
Events (2 tools)
Broadcast (1 tool, opt-in)
MCP Resources
Read-only data that AI agents can access without calling tools:
MCP Prompts
Pre-built workflows that give AI agents structured context:
Real-time Event Streaming
AI agents don't need to poll. The bot pushes events automatically:
The AI agent calls subscribe_events once, then receives push notifications whenever new events match its filters.
Interactive Messages
AI agents can build full interactive UIs in Telegram — menus, confirmations, multi-step wizards:
The AI agent sends a message with buttons:
User taps a button → event appears in the queue → AI agent reacts:
The bot needs dp.callback_query.middleware(middleware) to capture button presses.
Safety Controls
allowed_chat_ids— AI can only interact with listed chats. Default: all chats.enable_broadcast— broadcast tool is disabled by default as a safety measure.max_broadcast_recipients— caps the number of chats in a single broadcast.
Advanced Configuration
Rate Limiting
Built-in token bucket rate limiter prevents Telegram 429 errors. All outgoing API calls are automatically paced.
Permission Levels
Audit Log
Every tool invocation is logged. Access via telegram://audit/log resource.
Examples
Development
License
MIT. See LICENSE.
来源:README.md,提交 a5ae934
工具
0版本历史
1- v0.7.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分