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.
uv
Install via the official uv guide.Install the mcp-telegram
CLI tool:
uv tool install mcp-telegram
[!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
First, authenticate with your Telegram account:
mcp-telegram login
This interactive command will prompt you for:
+1234567890
).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 logout
to logout from current session ormcp-telegram clear-session
to remove all stored session data.
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-telegram
despite 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 thecommand
value in the configuration with the full path.
After saving the configuration file, restart your application.
Here's a comprehensive list of tools you can use to interact with Telegram through MCP:
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 |
Tool | Description |
---|---|
search_dialogs | 🔎 Find users, groups, and channels by name or username |
message_from_link | 🔗 Access specific messages using Telegram links |
Tool | Description |
---|---|
get_draft | 📋 View current message draft for any chat |
set_draft | ✍️ Create or clear message drafts |
Tool | Description |
---|---|
media_download | 📸 Download photos, videos, and documents from messages |
[!Note] For detailed parameter information and example use cases, run
mcp-telegram tools
in your terminal.
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.
If you need to stop potentially stuck processes:
pkill -f "mcp-telegram"
taskkill /F /IM mcp-telegram.exe /T
(Check Task Manager for the exact process name)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.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Yeabsira Driba
Seamless access to top MCP servers powering the future of AI integration.