MCP Telegram
Control Telegram using LLMs through the Model Context Protocol (MCP).
Enable LLMs to control your Telegram
Connect Large Language Models to Telegram via the Model Context Protocol (MCP).
Built with Telethon, this server allows AI agents to interact with Telegram, enabling features like sending/editing/deleting messages, searching chats, managing drafts, downloading media, and more using the MTProto.
TableΒ ofΒ Contents
π Getting Started
Prerequisites
- Python 3.10 or higher
uvInstall via the official uv guide.
Installation
Install the mcp-telegram CLI tool:
uv tool install mcp-telegram
βοΈ Usage
[!IMPORTANT] Please ensure you have read and understood Telegram's ToS before using this tool. Misuse of this tool may result in account restrictions.
The mcp-telegram command-line tool is your entry point.
mcp-telegram --help # See all commands
Login
First, authenticate with your Telegram account:
mcp-telegram login
This interactive command will prompt you for:
- API ID & API Hash: Obtain these from my.telegram.org/apps.
- Phone Number: Your Telegram-registered phone number (international format, e.g.,
+1234567890). - Verification Code: Sent to your Telegram account upon first login.
- 2FA Password: If you have Two-Factor Authentication enabled.
Your credentials are securely stored in the session file for future use.
[!WARNING] Keep your API credentials private and never share them publicly
[!NOTE] Use
mcp-telegram logoutto logout from current session ormcp-telegram clear-sessionto remove all stored session data.
Connect to the MCP server
To use MCP Telegram with MCP clients like Claude Desktop or Cursor, you'll need to configure the MCP server. The configuration process varies by client and operating system.
For detailed setup instructions, please refer to:
The configuration file should contain:
{
"mcpServers": {
"mcp-telegram": {
"command": "mcp-telegram" /* Use full path if client can't find the command (e.g. "/usr/local/bin/mcp-telegram"). See IMPORTANT section below for full path instructions. */,
"args": ["start"],
"env": {
"API_ID": "<your_api_id>",
"API_HASH": "<your_api_hash>"
}
}
}
}
[!Note] Configuration paths vary by OS and client. For example:
- macOS:
~/Library/Application Support/Claude/or~/.cursor/- Windows:
%APPDATA%\Claude\or%APPDATA%\Cursor\
[!IMPORTANT] If your client cannot execute
mcp-telegramdespite it being accessible in the terminal, try using the full path to the executable. You can find this by runningwhich mcp-telegram(macOS/Linux) orwhere mcp-telegram(Windows) in your terminal. Replace thecommandvalue in the configuration with the full path.
After saving the configuration file, restart your application.
π§° Available Tools
Here's a comprehensive list of tools you can use to interact with Telegram through MCP:
π¨ Messaging Tools
| Tool | Description |
|---|---|
send_message | βοΈ Send text messages or files to any user, group, or channel |
edit_message | βοΈ Modify content of previously sent messages |
delete_message | ποΈ Remove one or multiple messages |
get_messages | π Retrieve message history with advanced filtering options |
π Search & Navigation
| Tool | Description |
|---|---|
search_dialogs | π Find users, groups, and channels by name or username |
message_from_link | π Access specific messages using Telegram links |
π Draft Management
| Tool | Description |
|---|---|
get_draft | π View current message draft for any chat |
set_draft | βοΈ Create or clear message drafts |
π Media Handling
| Tool | Description |
|---|---|
media_download | πΈ Download photos, videos, and documents from messages |
[!Note] For detailed parameter information and example use cases, run
mcp-telegram toolsin your terminal.
π οΈ Troubleshooting
Database Locked Errors
Running multiple mcp-telegram instances using the same session file can cause database is locked errors due to Telethon's SQLite session storage. Ensure only one instance uses a session file at a time.
Force-Stopping Existing Processes
If you need to stop potentially stuck processes:
- macOS / Linux:
pkill -f "mcp-telegram" - Windows:
taskkill /F /IM mcp-telegram.exe /T(Check Task Manager for the exact process name)
π€ Contributing
We welcome contributions! If you'd like to help improve MCP Telegram, please feel free to submit issues, feature requests, or pull requests. Your feedback and contributions help make this project better for everyone.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ by Yeabsira Driba
Server Terkait
mcp-gmail
MCP server for full Gmail operations via Unipile API. 9 tools: send, reply, list, read, delete, search, labels, attachments, drafts. Dry-run by default, 55 unit tests. MIT licensed.
Twist MCP Server
Interact with a Twist workspace using its REST API.
ssyubix-agentlink
ssyubix is an open source MCP project for cross-device communication between AI agents over the public internet.
Gmail
Search and delete emails in your Gmail account.
Social Neuron MCP Server
50+ AI tools for end-to-end social media management β brand extraction, video generation, multi-platform scheduling, analytics, and closed-loop optimization.
Gmail MCP Server
Send emails with attachments through Gmail's SMTP server using AI agents.
Aligo SMS
Send SMS messages using the Aligo SMS API.
BotEmail MCP Server
Give your AI agent its own email address β instant bot inboxes via API, no human setup required.
Mailinator MCP Server
Free disposable email for AIβcheck any @mailinator.com inbox, retrieve messages in multiple formats, and extract verification codes for automated workflows.
AgentNet
Agent-to-agent referral network where AI agents discover each other, cross-refer users, and earn credits. Available as MCP server and HTTP API.