TM

tolmachov/mcp-telegram

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

2 stars 5 forks 质量 75 趋势 28MIT

MCP server for Telegram: read, search, send and summarize messages, manage chats and folders. Built in Go, with local stdio and multi-user HTTP support.

概览

- : List, search, mute/unmute chats, organise into folders - : Read, search, inspect context, send, draft, schedule, link-resolve, and backup messages - : Summarise chat conversations using multiple LLM providers - : separate versioned Keychain items on macOS; atomic 0600 session/config files in a 0700 state directory on Linux and Windows - : local (single account) or remote with an embedded OAuth 2.1 server and per-user Telegram QR login — multi-user and deployable to Cloud Run (see Remote (HTTP) Mode) 1. Go to my.telegram.org/apps 2. Create an application 3. Copy api_id and api_hash Store credentials (one versioned Keychain item per value on macOS; one atomic 0600 file per value in a 0700 state directory on Linux/Windows): Or export the current environment names explicitly: You'll be prompted for the verification code sent by Telegram and, when the account has two-step verification enabled, its 2FA password.

README

以下为原文 README 节选,完整内容请查看原文。


Features

  • Chat Management: List, search, mute/unmute chats, organise into folders
  • Messages: Read, search, inspect context, send, draft, schedule, link-resolve, and backup messages
  • AI Summarisation: Summarise chat conversations using multiple LLM providers
  • Secure storage: separate versioned Keychain items on macOS; atomic 0600 session/config files in a 0700 state directory on Linux and Windows
  • Two transports: local stdio (single account) or remote streamable HTTP with an embedded OAuth 2.1 server and per-user Telegram QR login — multi-user and deployable to Cloud Run (see Remote (HTTP) Mode)

Installation

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

Or build from source:

git clone https://github.com/tolmachov/mcp-telegram.git
cd mcp-telegram
make

Setup

1. Get Telegram API Credentials

  1. Go to my.telegram.org/apps
  2. Create an application
  3. Copy api_id and api_hash

2. Configure Environment

Store credentials (one versioned Keychain item per value on macOS; one atomic 0600 file per value in a 0700 state directory on Linux/Windows):

mcp-telegram config set api-id 123456789
mcp-telegram config set api-hash abcd1234efgh5678

Or export the current environment names explicitly:

export MCP_TELEGRAM_API_ID=123456789
export MCP_TELEGRAM_API_HASH=abcd1234efgh5678

3. Login to Telegram

mcp-telegram login --phone +1234567890

You’ll be prompted for the verification code sent by Telegram and, when the account has two-step verification enabled, its 2FA password.

If the code never arrives, log in with a QR code instead — no phone number or code needed:

mcp-telegram login --qr

The QR code is drawn in the terminal. Scan it from a signed-in Telegram app (Settings → Devices → Link Desktop Device); it refreshes on its own until scanned. The 2FA password, if any, is then asked for in the terminal.

4. Configure MCP Client

Claude Desktop

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "telegram": { "command": "mcp-telegram", "args": ["run"], "env": { "MCP_TELEGRAM_API_ID": "your_api_id", "MCP_TELEGRAM_API_HASH": "your_api_hash" } } } }