Telegram MCP 服务器
该服务器是 Telegram API 和 AI 助手之间的桥梁,基于模型上下文协议。
重要提示:使用此服务器前,请确保您已阅读并理解Telegram API 服务条款。任何滥用 Telegram API 的行为都可能导致您的帐户被暂停。
目录
什么是 MCP?
模型上下文协议 (MCP) 是一个允许 AI 应用(例如 Claude Desktop 或 Cursor)连接到外部工具和数据源的系统。它为 AI 助手提供了一种清晰、安全的方式,使其能够使用本地服务和 API,同时确保用户的控制权。
这个服务器是做什么的?
功能
- [x] 获取当前账户信息(
tool: tg_me
) - [x] 使用可选的未读过滤器列出对话框(
tool: tg_dialogs
) - [x] 将对话框标记为已读(
tool: tg_read
) - [x] 从特定对话框中检索消息(
tool: tg_dialog
) - [x] 向任意对话框发送草稿消息(
tool: tg_send
)
提示示例
以下是一些可以与 AI 助手一起使用的示例提示:
消息管理
- “检查我的电报中是否有未读的重要消息”
- “总结我所有未读的电报消息”
- “阅读并分析我的未读消息,并在需要时准备回复草稿”
- “检查非关键的未读消息并给我一个简要概述”
组织
- “分析我的电报对话并建议一个文件夹结构”
- “帮我按重要性对 Telegram 聊天进行分类”
- “查找所有与工作相关的对话并提出组织建议”
沟通
- “监控特定聊天中有关 [主题] 的更新”
- “起草一份对[聊天]中最后一条消息的礼貌回复”
- “检查我的聊天中是否有未回答的问题”
安装
自制
您可以使用 brew 在 macOS/Linux 上安装二进制版本:
NPX
您可以使用 npx 直接运行最新版本(支持 macOS、Linux 和 Windows):
使用NPX时,请修改标准命令和配置如下:
- 认证命令变为:
来自发布
MacOS
**注意:**以下命令将安装到
/usr/local/bin
目录。要安装到其他目录,请将/usr/local/bin
替换为 PATH 中你希望安装的目录。
首先,下载适合您的架构的档案:
然后安装二进制文件:
Linux
**注意:**以下命令将安装到
/usr/local/bin
目录。要安装到其他目录,请将/usr/local/bin
替换为 PATH 中你希望安装的目录。
首先,下载适合您的架构的档案:
然后安装二进制文件:
视窗
视窗
- 下载适合您的体系结构的最新版本:
- 提取
.zip
文件 - 将解压的目录添加到您的 PATH 或将
telegram-mcp.exe
移动到您的 PATH 中的目录
来自源
要求:
- Go 1.24 或更高版本
- PATH 中的 GOBIN
配置
授权
在使用服务器之前,您需要连接到 Telegram API。
- 从Telegram API获取 API ID 和哈希值
- 运行以下命令:
**注意:**如果您启用了 2FA:添加 --password <2fa_password>
**注意:**如果要覆盖现有会话:添加--new
📩 输入您从 Telegram 收到的代码以连接到 API。 - 完成!请给这个项目一个⭐️以支持其开发。
客户端配置
配置 Claude Desktop 识别 Telegram MCP 服务器的示例。
- 打开Claude桌面配置文件:
- 在 MacOS 中,配置文件位于
~/Library/Application Support/Claude/claude_desktop_config.json
- 在 Windows 中,配置文件位于
%APPDATA%\Claude\claude_desktop_config.json
**注意:**您还可以在 Claude Desktop 应用程序的设置中找到 claude_desktop_config.json
- 在 MacOS 中,配置文件位于
- 添加服务器配置对于 Claude 桌面:对于光标:
星史
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Telegram API 集成用于访问用户数据、管理对话(聊天、频道、群组)、检索消息和处理已读状态。
Related MCP Servers
- AsecurityAlicenseAqualityA bridge allowing Claude Desktop to access Telegram chats and messages via the Model Context Protocol, providing read-only capabilities to retrieve dialogs and messages from Telegram.Last updated -238PythonMIT License
- AsecurityAlicenseAqualityEnables AI models to interact with messages from various messaging platforms (Mobile, Mail, WhatsApp, LinkedIn, Slack, Twitter, Telegram, Instagram, Messenger) through a standardized interface.Last updated -38PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to interact with Telegram, allowing them to search channels, list available channels, retrieve messages, and filter messages by regex patterns.Last updated -713JavaScriptMIT License
- -securityAlicense-qualityA server that enables interaction with Telegram chats directly through MCP-compatible hosts like Claude for Desktop, providing tools to retrieve chats, get messages, and send messages.Last updated -134PythonApache 2.0