Telegram MCP
Provides tools for end-to-end interaction with Telegram bots, including sending commands and messages, clicking inline and reply buttons, running multi-step test suites, sending and downloading media, performing inline queries, managing chats and messages, and verifying bot responses.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Telegram MCPSend /start to @MyTestBot and report what it replies."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Telegram MCP ๐ค๐งช
Disclaimer: This project is an independent open-source tool and is not affiliated with, authorized, maintained, sponsored, or endorsed by Telegram FZ-LLC, Telegram Messenger Inc., or any of their affiliates. "Telegram" is a registered trademark of its respective owners.
A Model Context Protocol (MCP) server that allows AI Coding Agents (such as Antigravity, Claude Desktop, Cursor, and custom agent backends) to autonomously interact with, test, click buttons on, and verify Telegram bots end-to-end.
๐ AI Agents: See the dedicated AI Agent Testing Guide for tool selection workflows, test suites, and best practices.
Environment Recommendation: We strongly recommend using the Test Server (TELEGRAM_TEST_MODE=true) for bot development and automated testing because it carries zero risk to your main personal Telegram account.
Note: Make sure your target bot and user account are on the same environment (Test Server bot โ Test Server account, or Prod bot โ Prod account), as Telegram test and production networks are completely isolated.
๐ Features
Command & Message Dispatch: Send commands (
/start,/help,/settings) and text payloads to any target bot.Inline Keyboard Navigation: Click inline callback buttons (
CallbackQuery), trigger button menus, and inspect in-place message updates.Multi-Step Test Suite Runner (
telegram_run_test_suite): Execute full regression test scenarios with assertions andsleepdelays in a single tool call.Media & File Testing: Send photos, documents, audio, or PDFs to bots, and download returned media to verify generated files.
Inline Query Mode: Test
@bot queryinline modes and inspect returned inline articles and preview metadata.Python Code Execution Sandbox (
telegram_execute_code): Run custom asynchronous Python scripts with direct access to the liveTelegramClientand raw MTProto functions.Clean State Management: Clear dialog history before/after test runs for idempotent testing.
Related MCP server: agent-telegram-mcp
๐ Quickstart
1. Clone & Install Dependencies
git clone https://github.com/Telegram-mcp/telegram-mcp.git
cd telegram-mcp
pip install -r requirements.txt2. Configure Environment
Copy .env.example to .env:
cp .env.example .envAdd your Telegram API credentials from my.telegram.org:
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_TEST_MODE=false3. Generate Session (One-Time Login)
Run the interactive login script:
python3 login.pyEnter your phone number and the verification code sent to your Telegram app.
The script saves your
TELEGRAM_SESSIONstring automatically into.env.
4. Run the MCP Server
python3 server.py๐ Connecting to AI Agents
Antigravity CLI (agy) / Gemini
The repository includes a pre-configured .agents/plugins/telegram-bot/ plugin. Any agy session started in this workspace will automatically discover and load the tools.
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"telegram-bot": {
"command": "python3",
"args": ["/path/to/telegram-bot-mcp/server.py"],
"env": {
"TELEGRAM_API_ID": "your_api_id",
"TELEGRAM_API_HASH": "your_api_hash",
"TELEGRAM_SESSION": "your_session_string",
"TELEGRAM_TEST_MODE": "false"
}
}
}
}๐ ๏ธ MCP Tools Reference
Tool Name | Parameters | Purpose |
| None | Checks connection health, environment, and user info with masked phone for privacy. |
|
| Sends a command and waits for reply. |
|
| Sends text payloads or queries with Markdown/HTML formatting. |
|
| Edits a previously sent message by ID. |
|
| Deletes messages by ID for clean teardown. |
|
| Forwards messages from one chat/bot to another. |
|
| Sends an emoji reaction (๐, ๐ฅ, โค๏ธ, etc.) to a message. |
|
| Sends native polls or quizzes. |
|
| Marks dialog history as read. |
|
| Lists recent chats, groups, bots, and channels with unread counts. |
|
| Searches message history by text query keyword. |
|
| Clicks inline buttons and returns updated message state. |
|
| Uploads images/documents/audio (or circular voice notes). |
|
| Downloads media from bot messages. |
|
| Performs inline queries ( |
|
| Convenience single-step assertion. |
|
| Runs multi-step test workflows with |
|
| Inspects a bot's description, about text, commands list, and profile metadata. |
|
| Pins a message in the chat with the bot or group. |
|
| Unpins a specific message, or unpins all messages in the chat. |
|
| Fetches preceding and succeeding messages around a message ID. |
|
| Sends multiple photos/files as a grouped album in one message. |
|
| Saves an uncommitted draft directly into the Telegram chat input box. |
|
| Schedules a message for future automated delivery. |
|
| Retrieves all pending scheduled messages queued in a chat. |
|
| Cancels and deletes scheduled messages before delivery. |
|
| Fetches pinned messages directly from a chat, bot, or channel. |
|
| Mutes notifications for a specified duration or permanently. |
|
| Unmutes notifications for a chat or channel. |
|
| Exports conversation history as clean Markdown or JSON for AI summarization. |
|
| Lists group/channel participants with names, IDs, and bot flags. |
|
| Retrieves saved Telegram contacts with privacy-masked phone numbers. |
|
| Resolves any username, phone, or ID to detailed entity metadata and type. |
|
| Waits for an incoming message, specific substring, or message edit/progress update. |
|
| Extracts authenticated Web App launch URLs from Telegram Mini App buttons for frontend testing. |
|
| Clicks buttons in persistent bottom reply keyboards and dispatches user actions. |
|
| Broadcasts chat presence indicators ('typing', 'upload_photo', 'record_video', etc.). |
|
| Joins a public channel/supergroup via @username or private chat via invite link (t.me/+...). |
|
| Leaves a channel or group by username or ID. |
|
| Casts a vote on a specific option in a poll or quiz message. |
|
| Retracts a previously submitted poll vote. |
|
| Searches chat messages filtered by media type ('photo', 'document', 'url', 'video', etc.). |
|
| Sends a message or file to your personal Telegram 'Saved Messages' cloud chat (InputPeerSelf). |
|
| Retrieves recent messages from your personal Telegram 'Saved Messages' cloud chat. |
|
| Downloads the profile photo or avatar of any user, bot, or group for visual inspection. |
|
| Sends geographic coordinates or a named venue to a bot or chat. |
|
| Retrieves full profile metadata (about, Telegram Premium, verified, badges). |
|
| Inspects administrator or restricted permissions of a user or bot in a group/channel. |
|
| Blocks a user or bot from contacting you. |
|
| Unblocks a previously blocked user or bot. |
|
| Retrieves the list of currently blocked users and bots. |
| Retrieves configured Telegram chat folders/filters (e.g. Work, Bots, Personal) and rule counts. | |
|
| Creates a new Telegram chat folder/filter to organize conversations. |
|
| Deletes a Telegram chat folder/filter by folder ID. |
|
| Creates a new supergroup or broadcast channel for testing workflows or bot integrations. |
|
| Permanently deletes a supergroup or channel (must be creator/owner). |
|
| Generates custom invite links with expiration, member limits, and approval gates. |
|
| Executes arbitrary Python code with live Telethon client access. |
|
| Fetches recent conversation history. |
|
| Clears conversation dialog for clean tests. |
๐งช Example Test Suite Scenario
[
{"action": "send", "text": "/start"},
{"action": "sleep", "seconds": 1.0},
{"action": "assert_reply", "contains": "Welcome to my bot!"},
{"action": "click_button", "text": "Settings"},
{"action": "sleep", "seconds": 0.5},
{"action": "assert_reply", "contains": "Notification Preferences"}
]๐ฌ Running Unit Tests
Run the test suite locally with pytest or Python's built-in unittest:
pip install -r requirements-dev.txt
python3 -m pytest tests -v๐ License
MIT License. See LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents โ HTTP+stdio, 8 tools, MTProto User API
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Build and deploy websites, Telegram and Discord bots from chat via the DreamAgent platform.
Run WhatsApp and Telegram AI assistants: projects, prompts, leads, chats, analytics.
Related MCP Servers
- FlicenseAqualityBmaintenanceEnables AI agents to interact with Telegram via MTProto, supporting high-performance communication and seamless integration.1-
- AlicenseAqualityDmaintenanceEnables AI agents to send and receive messages, media, and files on Telegram, and manage chats via a bot token.17MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to test Telegram bots by driving the official Telegram Web client in a real browser, allowing visual verification of bot responses, inline keyboards, and Mini Apps.2MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to operate a Telegram account through the same commands as the terminal client: messaging, chat management, voice transcription, calls, stickers, and privacy settings.1MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Telegram-mcp/telegram-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server