MCP Telegram

by dryeab

用于 Telegram 的 MCP 服务器,允许大型语言模型(LLMs)通过模型上下文协议(MCP)控制 Telegram。需要通过环境变量提供 API 凭据(API_ID 和 API_HASH)。

Social & communicationstdioCommunity

Repository-wide counts · Cached 2026-03-07

Overview

The MCP Telegram MCP server is a publicly available project. Review the upstream repository for installation instructions, supported tools, compatibility, permissions, and current maintenance status.

Configuration

Configuration, transport, authentication, and runtime requirements vary by project. Open the repository before connecting and use the smallest set of credentials and permissions required.

Open the MCP Telegram repository to read the latest documentation.

KEEP EXPLORING

Compare source, connection, and authentication details before choosing an implementation.

View the complete category

WhatsApp API 多设备版本

aldinokemal

Community

支持多设备和 MCP(模型上下文协议)服务器集成的 WhatsApp API,适用于 AI 代理和工具。支持通过命令行参数、环境变量和 .env 文件进行配置。需要 FFmpeg 进行媒体处理。无需通过环境变量提供外部数据文件。

chatmcp

daodao97

Community

支持MacOS、Windows、Linux、iOS、Android和Web的跨平台AI聊天客户端。需要外部数据文件,例如chatmcp.db(聊天记录)、config.json(设置)以及存储在各平台特定目录中的MCP服务器配置。

mcp-server-chatsum

chatmcp

Community

总结您的聊天消息。需要通过 CHAT_DB_PATH 环境变量配置的聊天数据库文件路径。

Telegram MCP Server

chigwell

Community

Integration with Telegram implemented via the Model Context Protocol (MCP). Requires external configuration through a .env file, including settings such as TELEGRAM_API_ID, TELEGRAM_API_HASH, TELEGRAM_SESSION_STRING, or TELEGRAM_SESSION_NAME for session management.

FROM THE SOURCE

Repository README

Build-time snapshot · Retrieved 2026-10-05

View original
MCP Telegram Logo

Enable LLMs to control your Telegram

GitHub stars PyPI version Twitter Follow

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

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 logout to logout from current session or mcp-telegram clear-session to 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-telegram despite it being accessible in the terminal, try using the full path to the executable. You can find this by running which mcp-telegram (macOS/Linux) or where mcp-telegram (Windows) in your terminal. Replace the command value 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 tools in 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