SuperAPIAI Directory

telegram-mcp

github.com · AI developer platforms

Telegram API integration: access user data, manage dialogs (chats, channels, groups), retrieve messages and handle read status.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Windows · Linux

About this tool

Telegram MCP is a server based on the Model Context Protocol (MCP) that establishes a connection between the Telegram API and AI assistants. MCP is a system that allows AI applications (such as Claude Desktop or Cursor) to connect to external tools and data sources, aiming to let AI assistants interact with local services and APIs in a clear, secure way while keeping users in control.

Purpose

This server's main purpose is to let AI assistants access and manage conversations, messages, drafts, and read status in a Telegram account. It is suitable for scenarios that require AI-assisted handling of Telegram messages, such as checking unread messages, summarizing conversations, drafting replies, organizing chat categories, and more.

Main Capabilities

The server provides the following tools:

  • tg_me: get information about the current account.
  • tg_dialogs: list conversations, with optional unread filtering.
  • tg_read: mark a conversation as read.
  • tg_dialog: retrieve messages from a specific conversation.
  • tg_send: send a draft message to any conversation.

Usage

Installation

Supports multiple installation methods:

  • Homebrew (macOS/Linux): use brew to install the binary release.
  • NPX (supports macOS, Linux, Windows): run the latest version directly, with adjustments to the standard command and configuration.
  • Install from a release:
    • macOS/Linux: download the archive for the corresponding architecture, then install the binary to /usr/local/bin (this can be replaced with another directory in PATH).
    • Windows: download the latest release for Windows x64 or Windows ARM64, extract the .zip file, add the extracted directory to PATH, or move telegram-mcp.exe to a directory in PATH.
  • Install from source: requires Go 1.24 or later.

Authorization

Before use, you need to connect to the Telegram API:

  1. Obtain the API ID and hash from the Telegram API.
  2. Run the authorization command: telegram-mcp auth --app-id <your-api-id> --api-hash <your-api-hash> --phone <your-phone-number>. If 2FA is enabled, add --password <2fa_password>; if you want to overwrite an existing session, add --new.
  3. Enter the verification code received from Telegram to connect to the API.

Client Configuration

Using Claude Desktop as an example:

  • Open the configuration file: on macOS it is located at ~/Library/Application Support/Claude/claude_desktop_config.json, and on Windows at %APPDATA%\Claude\claude_desktop_config.json. It can also be found in the Claude Desktop app settings.
  • Add the server configuration:
{
  "mcpServers": {
    "telegram": {
      "command": "telegram-mcp",
      "env": {
        "TG_APP_ID": "<your-app-id>",
        "TG_API_HASH": "<your-api-hash>",
        "PATH": "<path_to_telegram-mcp_binary_dir>",
        "HOME": "<path_to_your_home_directory>"
      }
    }
  }
}

For Cursor:

{
  "mcpServers": {
    "telegram-mcp": {
      "command": "telegram-mcp",
      "env": {
        "TG_APP_ID": "<your-app-id>",
        "TG_API_HASH": "<your-api-hash>"
      }
    }
  }
}

JSON Schema Version

Some MCP clients (such as VS Code) do not support JSON Schema Draft 2020-12 and will reject tools[1] using that version. The JSON Schema version can be overridden by setting the --schema-version flag or the TG_SCHEMA_VERSION environment variable.

Suitable Scenarios

  • Check important unread messages.
  • Summarize all unread messages.
  • Read and analyze unread messages, and prepare draft replies.
  • Analyze conversations and suggest a folder structure.
  • Classify chats by importance.
  • Find work-related conversations and suggest ways to organize them.
  • Monitor a specific chat for updates about a certain topic.
  • Draft a polite reply to the last message in a chat.
  • Check whether there are unanswered questions in a chat.

Limitations

Before use, you must read and understand the Telegram API Terms of Service. Any abuse of the Telegram API may result in account suspension.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools