home / mcp / mcp telegram server
MCP Server for Telegram
Configuration
View docs{
"mcpServers": {
"dryeab-mcp-telegram": {
"command": "mcp-telegram",
"args": [
"start"
],
"env": {
"API_ID": "<your_api_id>",
"API_HASH": "<your_api_hash>"
}
}
}
}You can connect Large Language Models to Telegram through the Model Context Protocol (MCP). This server lets AI agents interact with Telegram to send, edit, delete messages, search chats, manage drafts, download media, and more using MTProto, enabling powerful automation and assistant-driven workflows.
Set up your MCP client to connect with the Telegram MCP server. Start the MCP server from your terminal, then configure your MCP client to point to that local process. Once connected, you can command AI agents to perform common Telegram actions such as sending messages, editing content, retrieving chat history, and handling drafts and media.
Prerequisites: Install Python 3.10 or higher and follow the official uv guide to install uv for running MCP tools.
Install the MCP Telegram CLI tool with uv.
uv tool install mcp-telegramLogin to Telegram from the MCP Telegram CLI to authorize access to your account. You will be prompted for your API ID, API Hash, phone number, verification code, and 2FA if enabled. Your credentials are stored in a session file for future use.
Create an MCP configuration that points your MCP client to the local Telegram MCP server. The following configuration starts the MCP server through the MCP CLI and passes the required API credentials as environment variables.
{
"mcpServers": {
"mcp_telegram": {
"command": "mcp-telegram",
"args": ["start"],
"env": {
"API_ID": "<your_api_id>",
"API_HASH": "<your_api_hash>"
}
}
}
}Keep your API credentials private. Do not share your API_ID or API_HASH publicly. Use the logout or clear-session commands when you need to remove credentials from the local machine.
If you encounter database locked errors from Telethon when running multiple instances, ensure only one MCP Telegram process uses the session file at a time. If you need to stop a stuck process, force-stop the MCP Telegram instance appropriate to your operating system.
Contributions are welcome. Share issues, feature requests, and pull requests to improve MCP Telegram for everyone.
This project is licensed under the MIT License.
Send text messages or files to any user, group, or channel.
Modify the content of previously sent messages.
Remove one or multiple messages.
Retrieve message history with filtering options.
Find users, groups, and channels by name or username.
Access specific messages using Telegram links.
View current message draft for any chat.
Create or clear message drafts.
Download photos, videos, and documents from messages.