Aiogram MCP logo

Aiogram MCP

by Py2755

Connects aiogram Telegram bots to AI agents with tools, resources, prompts, event streaming, and access controls.

Install Aiogram MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "py2755-aiogram-mcp": {
      "command": "uvx",
      "args": [
        "aiogram-mcp"
      ],
      "env": {
        "BOT_TOKEN": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx aiogram-mcp

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

Py2755/aiogram-mcp MCP server connects an existing aiogram Telegram bot to AI clients through the Model Context Protocol. It exposes 30 tools, 7 read-only resources, and 3 prompts for messaging, media, moderation, interactive keyboards, chat data, and event handling. Middleware records chats, users, message history, callbacks, and events while the server runs alongside the bot over stdio or SSE. Reach for it when an agent needs to operate a Telegram bot without replacing its existing handlers.

Use cases

  • Send Telegram announcements with formatted text and rich media
  • Build interactive menus and confirmation flows with inline buttons
  • Review chat history and compile user activity reports
  • Moderate users by inspecting membership and recent messages
  • React to Telegram messages and callback events in real time

Key features

  • 30 Telegram bot tools
  • 7 read-only MCP resources
  • 3 workflow prompts
  • Inline keyboard and callback handling
  • Event subscriptions with MCP notifications
  • Rate limiting, permissions, and optional audit logging

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/17 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · aiogram-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit8mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Directory activity5 viewsConfig copies, upvotes, and views on AllMCPs.

How Aiogram MCP works

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Aiogram MCP

Py2755/aiogram-mcp is an MCP server that connects aiogram Telegram bots to AI clients. Its main tools send and manage messages, publish rich media, inspect chats and users, moderate members, create interactive keyboards, subscribe to events, and optionally broadcast messages. It also exposes resources and prompts for structured bot context.

Install it with `pip install aiogram-mcp`. The documented requirements are Python 3.10 or newer and aiogram 3.20 or newer. Add the middleware and MCP server to an existing bot, then run it alongside the bot with a supported transport.

Connect it by adding the bot script as an MCP server in `claude_desktop_config.json`. The documented example uses `python` as the command, passes the script path in `args`, and supplies the Telegram token through the `BOT_TOKEN` environment variable.

The server uses MCP over stdio or SSE, so client compatibility depends on whether the chosen client supports the selected transport and MCP configuration.

Attach `MCPMiddleware` to `dp.callback_query` as well as `dp.message`. The middleware then captures callback-query events, which an agent can receive after subscribing with `subscribe_events`; interactive messages can be created and edited with the corresponding tools.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewAiogram MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/py2755-aiogram-mcp?style=directory)](https://allmcps.com/mcp/py2755-aiogram-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/py2755-aiogram-mcp"><img src="https://allmcps.com/api/badge/py2755-aiogram-mcp?style=directory" alt="Aiogram MCP on AllMCPs" /></a>