Read-only fork of chaindead/telegram-mcp with write operations disabled in dry run mode for safety
Find a file
2025-04-03 02:22:46 +03:00
.github/workflows add GoReleaser configuration and GitHub Actions workflow 2025-04-02 18:09:19 +03:00
cmd/test refactor 2025-04-02 03:05:45 +03:00
internal/tg fix: dialogs tool 2025-04-03 02:22:46 +03:00
.gitignore update .gitignore to include dist/ and modify GoReleaser configuration for archive formats 2025-04-02 18:36:49 +03:00
.golangci.yaml refactor 2025-04-02 03:05:45 +03:00
.goreleaser.yaml Enhance GoReleaser configuration for Windows archive formats and expand installation instructions in README.md for various platforms. 2025-04-02 18:58:00 +03:00
auth.go refactor 2025-04-02 03:05:45 +03:00
go.mod fix: dialogs tool 2025-04-03 02:22:46 +03:00
go.sum Initial 2025-04-01 17:48:16 +03:00
main.go debug 2025-04-02 00:51:51 +03:00
README.md Update README.md 2025-04-02 19:12:31 +03:00
resourse.go fix: dialogs tool 2025-04-03 02:22:46 +03:00
serve.go fix: dialogs tool 2025-04-03 02:22:46 +03:00
Taskfile.yml fix: dialogs tool 2025-04-03 02:22:46 +03:00

Telegram MCP server

The server is a bridge between the Telegram API and the AI assistants and is based on the Model Context Protocol.

Important

Ensure that you have read and understood the Telegram API Terms of Service before using this server. Any misuse of the Telegram API may result in the suspension of your account.

Table of Contents

What is MCP?

The Model Context Protocol (MCP) is a system that lets AI apps, like Claude Desktop or Cursor, connect to external tools and data sources. It gives a clear and safe way for AI assistants to work with local services and APIs while keeping the user in control.

What does this server do?

  • Get current user data
  • Get the list of dialogs (chats, channels, groups)
  • Get the list of (unread) messages in the given dialog
  • Mark chanel as read
  • Retrieve messages by date and time
  • Get the list of contacts
  • Draft a message

Installation

From Releases

macOS

Note: The command above install to /usr/local/bin. To install elsewhere, replace /usr/local/bin with your preferred directory in your PATH.

# Intel Mac (x86_64)
curl -L https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Darwin_x86_64.tar.gz | tar xz -C /usr/local/bin

# Apple Silicon (M1/M2)
curl -L https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Darwin_arm64.tar.gz | tar xz -C /usr/local/bin

Linux

Note: The commands install to /usr/local/bin. To install elsewhere, replace /usr/local/bin with your preferred directory in your PATH.

# x86_64 (64-bit)
curl -L https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin

# ARM64
curl -L https://github.com/chaindead/telegram-mcp/releases/latest/download/telegram-mcp_Linux_arm64.tar.gz | tar xz -C /usr/local/bin

Windows

  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

From Source

Requirements:

  • Go 1.24 or later
  • GOBIN in PATH
go install github.com/chaindead/telegram-mcp@latest

Configuration

Telegram API Configuration

Before you can use the server, you need to connect to the Telegram API.

  1. Get the API ID and hash from Telegram API

  2. Run the following command:

    telegram-mcp auth --app-id <your-api-id> --api-hash <your-api-hash> --phone <your-phone-number>
    

    Enter the code you received from Telegram to connect to the API.

    The password may be required if you have two-factor authentication enabled.

Client Configuration

Example of Configuring Claude Desktop to recognize the Telegram MCP server.

  1. Open the Claude Desktop configuration file:

    • in MacOS, the configuration file is located at ~/Library/Application Support/Claude/claude_desktop_config.json
    • in Windows, the configuration file is located at %APPDATA%\Claude\claude_desktop_config.json

    Note: You can also find claude_desktop_config.json inside the settings of Claude Desktop app

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