mcpField
T
Telegram MCP Server

Telegram MCP Server

本地服务
github.com/MobileVibe通信协作456 周前更新

关于 Telegram MCP Server

Telegram MCP Server 让 LLM 通过 Telegram 向指定聊天发送通知,并接收用户回复,适用于需要异步沟通的 MCP 应用。通知可设置紧急程度,并支持等待回复。

主要功能

  1. 01向 Telegram 聊天发送文本通知
  2. 02设置通知紧急程度
  3. 03等待并获取用户回复

适用场景

  1. 01发送项目进展或任务通知
  2. 02请求用户确认并读取回复

MCP 相关

该 MCP 服务向兼容客户端提供发送 Telegram 通知和检查回复的工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Telegram MCP 服务

一个模型上下文协议(MCP)服务,可让大模型通过 Telegram 发送通知并接收用户回复。

功能

  • 向 Telegram 聊天发送文本通知,并可自定义紧急程度
  • 等待并获取用户回复
  • 与 Cline 和其他兼容 MCP 的大模型应用集成

前提条件

  • Node.js 16 或更高版本
  • Telegram 机器人令牌(从 @BotFather 获取)
  • 你的 Telegram 聊天 ID

安装

从 npm 安装(推荐)
npm install -g telegram-mcp
从 GitHub 安装
git clone https://github.com/CHarrisTech/telegram-mcp.git
cd telegram-mcp
npm install
npm run build

配置

该服务需要两个环境变量:

  • TELEGRAM_BOT_TOKEN:你的 Telegram 机器人令牌
  • TELEGRAM_CHAT_ID:你的 Telegram 聊天 ID
获取 Telegram 机器人令牌
  1. 在 Telegram 上与 @BotFather 开始聊天
  2. 发送命令 /newbot
  3. 按照说明创建新机器人
  4. BotFather 会向你提供新机器人的令牌
查找你的聊天 ID
  1. 与新机器人开始聊天
  2. 向机器人发送消息
  3. 访问 https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  4. 在响应中找到 chat 对象,并记下 id 字段

使用方法

独立运行
# Set environment variables
export TELEGRAM_BOT_TOKEN="your_bot_token"
export TELEGRAM_CHAT_ID="your_chat_id"

# Run the server
telegram-mcp
与 Cline 集成

将以下内容添加到 Cline MCP 设置文件中:

{
  "mcpServers": {
    "telegram-mcp": {
      "command": "node",
      "args": ["path/to/telegram-mcp/build/index.js"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your_bot_token",
        "TELEGRAM_CHAT_ID": "your_chat_id"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
与 Claude Desktop 集成

将以下内容添加到 Claude Desktop 配置文件中:

{
  "mcpServers": {
    "telegram-mcp": {
      "command": "node",
      "args": ["path/to/telegram-mcp/build/index.js"],
      "env": {
        "TELEGRAM_BOT_TOKEN": "your_bot_token",
        "TELEGRAM_CHAT_ID": "your_chat_id"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

可用工具

send_notification

向配置的 Telegram 聊天发送通知消息。

参数:

  • message(必填):要发送给用户的消息
  • project(必填):大模型正在处理的项目名称
  • urgency(可选):紧急程度(“low”“medium”或“high”)
check_notification_response

检查用户是否已回复之前发送的通知。

参数:

  • message_id(必填):要检查回复的消息 ID
  • timeout_seconds(可选):放弃前等待回复的时长(默认值:30)

开发

# Clone the repository
git clone https://github.com/CHarrisTech/telegram-mcp.git
cd telegram-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Watch for changes during development
npm run watch

# Test with the MCP Inspector
npm run inspector
本地测试

该仓库包含帮助你在本地测试服务的脚本:

Windows
# Set environment variables
set TELEGRAM_BOT_TOKEN=your_bot_token
set TELEGRAM_CHAT_ID=your_chat_id

# Run the test script
test-server.bat
macOS/Linux
# Set environment variables
export TELEGRAM_BOT_TOKEN=your_bot_token
export TELEGRAM_CHAT_ID=your_chat_id

# Make the script executable (first time only)
chmod +x test-server.sh

# Run the test script
./test-server.sh

示例

examples 目录包含示例代码,演示如何使用 Telegram MCP 服务:

  • programmatic-usage.js:演示如何在自己的 Node.js 应用中以编程方式使用该服务

运行示例:

# Set required environment variables
export TELEGRAM_BOT_TOKEN="your_bot_token"
export TELEGRAM_CHAT_ID="your_chat_id"

# Run the example
node examples/programmatic-usage.js

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。