te

telegram-mcp

Telegram API integration for accessing user data, managing dialogs (chats, channels, groups), retrieving messages, and handling read status

Publishertelegram-mcp
Submitted date4/13/2025

Bridging Telegram and AI: A Deep Dive into the Telegram MCP Server

The Telegram MCP server acts as a crucial intermediary, leveraging the Model Context Protocol to seamlessly connect AI assistants with the Telegram API. This integration unlocks a range of powerful capabilities, enabling AI to interact with and understand your Telegram data in a controlled and secure manner.

MCP Server OS Agnostic

Understanding the Power of MCP

The Model Context Protocol (MCP) is a game-changer for AI applications. It provides a standardized framework for Large Language Models (LLMs) to access external data sources and tools. This means AI assistants can now leverage real-world information and perform actions beyond their initial training, opening up a world of possibilities.

Telegram MCP Server: Unleashing AI within Telegram

This server specifically bridges the gap between the Telegram API and MCP-compatible AI assistants. By implementing the MCP, the server allows AI to:

  • Access your Telegram data: Retrieve messages, dialogs, and account information.
  • Understand your conversations: Analyze message content and identify key information.
  • Act on your behalf: Draft and send messages, mark dialogs as read, and organize your chats.

Crucially, this is all done with the user in control, ensuring privacy and security.

Core Capabilities

The Telegram MCP server boasts a robust set of features:

  • tool: tg_me: Get current account information (name, profile picture, etc.).
  • tool: tg_dialogs: List all your Telegram dialogs, with the option to filter for unread messages.
  • tool: tg_read: Mark specific dialogs as read.
  • tool: tg_dialog: Retrieve messages from a specific dialog, allowing AI to analyze conversation history.
  • tool: tg_send: Send draft messages to any dialog, enabling AI to assist with communication.

Real-World Applications: Prompt Examples

Here are some practical examples of how you can use the Telegram MCP server with your AI assistant:

Message Management

  • "Check for any unread messages in my Telegram from my boss."
  • "Summarize all my unread Telegram messages related to project X."
  • "Read and analyze my unread messages, and prepare draft responses for the ones that require immediate attention."
  • "Check non-critical unread messages and give me a brief overview of the topics discussed."

Organization

  • "Analyze my Telegram dialogs and suggest a folder structure based on topic and sender."
  • "Help me categorize my Telegram chats by importance and urgency."
  • "Find all work-related conversations and suggest how to organize them into dedicated channels or groups."

Communication

  • "Monitor the 'Project X' chat for updates about the upcoming deadline."
  • "Draft a polite response to the last message in the 'Client Y' chat, acknowledging their request and providing an estimated timeline."
  • "Check if there are any unanswered questions in my chats from the past 24 hours."

Installation Guide: Choose Your Method

The Telegram MCP server offers multiple installation options to suit your technical expertise and operating system.

Option 1: Homebrew (macOS/Linux)

The easiest method for macOS and Linux users:

# Install brew install chaindead/tap/telegram-mcp # Update brew upgrade chaindead/tap/telegram-mcp

Option 2: NPX (Cross-Platform)

Run the latest version directly without installation:

npx -y @chaindead/telegram-mcp

Important NPX Considerations:

  • Authentication: npx -y @chaindead/telegram-mcp auth ...

  • Claude/Cursor Configuration:

    { "mcpServers": { "telegram": { "command": "npx", "args": ["-y", "@chaindead/telegram-mcp"], "env": { "TG_APP_ID": "<your-api-id>", "TG_API_HASH": "<your-api-hash>" } } } }

Option 3: From Releases (macOS, Linux, Windows)

Download pre-built binaries for your operating system and architecture.

MacOS

Click to expand
# For Intel Mac (x86_64) curl -L -o telegram-mcp.tar.gz https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Darwin_x86_64.tar.gz # For Apple Silicon (M1/M2) curl -L -o telegram-mcp.tar.gz https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Darwin_arm64.tar.gz # Extract the binary sudo tar xzf telegram-mcp.tar.gz -C /usr/local/bin # Make it executable sudo chmod +x /usr/local/bin/telegram-mcp # Clean up rm telegram-mcp.tar.gz

Linux

Click to expand
# For x86_64 (64-bit) curl -L -o telegram-mcp.tar.gz https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Linux_x86_64.tar.gz # For ARM64 curl -L -o telegram-mcp.tar.gz https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Linux_arm64.tar.gz # Extract the binary sudo tar xzf telegram-mcp.tar.gz -C /usr/local/bin # Make it executable sudo chmod +x /usr/local/bin/telegram-mcp # Clean up rm telegram-mcp.tar.gz

Windows

Click to expand
  1. Download the latest release for your architecture:
  2. Extract the .zip file
  3. Add the extracted directory to your PATH or move telegram-mcp.exe to a directory in your PATH

Option 4: From Source (Advanced)

For developers who want to build from source:

go install github.com/chaindead/telegram-mcp@latest

Prerequisites:

  • Go 1.24 or later
  • GOBIN in PATH

Configuration: Connecting to Telegram

Step 1: Authorization

  1. Obtain your API ID and hash from Telegram API.

  2. Run the following command, replacing the placeholders with your actual credentials:

    telegram-mcp auth --app-id <your-api-id> --api-hash <your-api-hash> --phone <your-phone-number>
    • 2FA: If you have two-factor authentication enabled, add --password <2fa_password>.
    • Override Session: To create a new session, add --new.
  3. Enter the verification code you receive from Telegram.

Step 2: Client Configuration (Claude/Cursor)

Configure your AI client (e.g., Claude Desktop, Cursor) to recognize the Telegram MCP server.

  1. Locate the configuration file:

    • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the server configuration:

    For Claude Desktop:

    { "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>" } } } }

Conclusion: Empowering AI with Telegram Data

The Telegram MCP server is a powerful tool for integrating AI assistants with your Telegram account. By following this guide, you can unlock a new level of productivity and efficiency, leveraging AI to manage your messages, organize your conversations, and communicate more effectively. Remember to always adhere to the Telegram API Terms of Service to ensure responsible and ethical usage.

Visit More

View All