# Py2755/aiogram-mcp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/Py2755/aiogram-mcp  
**GitHub Stars:** 3  
**Views:** 5  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/py2755-aiogram-mcp

## Description
MCP server middleware for aiogram Telegram bots — 30 tools, 7 resources, 3 prompts covering messaging, rich media, moderation, interactive keyboards, real-time event streaming, rate limiting, permissions, and audit logging.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "aiogram-mcp": {
    "command": "uvx",
    "args": ["aiogram-mcp"],
    "env": {
      "BOT_TOKEN": ""
    }
  }
}
```

**Requires environment variables:** `BOT_TOKEN` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Py2755/aiogram-mcp MCP server does

Py2755/aiogram-mcp MCP server adds an MCP interface to an aiogram 3.20+ Telegram bot. AI clients can use the bot to send and manage messages, inspect chats and users, moderate members, publish rich media, create polls, and work with inline keyboard interactions. Existing aiogram handlers continue to run, so the MCP layer is added alongside the bot rather than replacing its update-processing logic.

The package exposes 30 tools grouped around messaging, interactive messages, users, chats, rich media, events, and optional broadcasting. It also provides seven read-only resources, including bot information, configuration, active chats, the last 50 messages in a chat, queued events, file metadata, and an optional audit log. Three prompts cover moderation, announcements, and user reports.

## How it works

The bot continues receiving Telegram updates normally. `MCPMiddleware` observes message and callback-query activity, while `EventManager` tracks events and makes them available to subscribed MCP clients. An agent can subscribe with chat and event-type filters; matching events are pushed through MCP notifications rather than requiring the agent to poll continuously. The event queue assigns incrementing IDs and can be read through its Telegram resource.

Interactive workflows use tools such as `send_interactive_message`, `edit_message`, and `answer_callback_query`. To capture button presses, the callback-query middleware must be attached to the dispatcher. Agents can then send menus, receive callback events, and update the related message.

Access controls include allowed chat IDs, permission levels for read-only, messaging, moderation, or full administrative access, and an opt-in broadcast capability. Built-in token-bucket rate limiting is intended to help avoid Telegram 429 responses. Tool invocations can also be recorded with timestamps and arguments when audit logging is enabled.

## Setup and configuration

Install the package with `pip install aiogram-mcp`. The documented runtime requirements are Python 3.10 or newer and aiogram 3.20 or newer. Add an `EventManager` and `MCPMiddleware` to the bot, attach the middleware to message updates and, when using buttons, callback queries, then construct `AiogramMCP` with the bot, dispatcher, middleware, and event manager.

Start the MCP service with `run_alongside_bot`, selecting the `stdio` transport in the quickstart. The example also accepts `allowed_chat_ids` to restrict which chats the agent can access. Broadcasting is disabled unless `enable_broadcast=True` is set. The sample Claude Desktop configuration launches the bot script with Python and supplies `BOT_TOKEN` through the process environment, although the quickstart code also shows a token passed directly to `Bot`.

## Tools and capabilities

Messaging tools send text, photos, documents, voice messages, videos, animations, audio, stickers, video notes, contacts, locations, and polls. Other tools forward, delete, or pin messages. Chat and user tools retrieve bot, chat, and member information, count members, manage bans, and change chat titles or descriptions.

Event tools subscribe and unsubscribe from real-time updates. The optional `broadcast` tool sends a message to multiple chats. Resources provide read-only context without a tool call, and structured Pydantic outputs include an output schema for programmatic parsing. Py2755/aiogram-mcp MCP server is therefore suited to agents that need both Telegram actions and structured bot state.

_Full upstream README: https://allmcps.com/mcp/py2755-aiogram-mcp/readme_

