Telegram MCP server

Telegram MCP server

site icon
2025.04.18 28
GoTelegram API 桥梁AI 助手集成交流协作
Telegram MCP server 是一个基于 Model Context Protocol (MCP) 的桥梁服务,连接 Telegram API 和 AI 助手。它提供了一种安全的方式,让 AI 应用能够与 Telegram 的聊天、群组和频道等功能进行交互,同时确保用户保持控制权。
View on GitHub

Overview

基本能力

产品定位

Telegram MCP server 是一个桥梁服务,连接 Telegram API 和 AI 助手,基于 Model Context Protocol (MCP)。

核心功能

  • 获取当前用户数据
  • 获取对话列表(聊天、频道、群组)
  • 获取指定对话中的消息列表
  • 草拟消息
  • 标记对话为已读

适用场景

  • AI 助手与 Telegram 的集成
  • 自动化消息处理
  • 聊天数据分析

工具列表

  • telegram-mcp:主服务工具,用于连接 Telegram API 和 AI 助手。

常见问题解答

使用教程

使用依赖

  • Go 1.24 或更高版本(如果从源代码安装)

安装教程

macOS

# 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

# 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

  1. 下载最新版本的压缩包:
  2. Windows x64
  3. Windows ARM64
  4. 解压 .zip 文件
  5. 将解压后的目录添加到 PATH 或移动 telegram-mcp.exe 到 PATH 中的目录

从源代码安装

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

调试方式

Telegram API 配置

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

客户端配置

示例配置 Claude Desktop 识别 Telegram MCP server:

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

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。