Mcp Communicator Telegram

Mcp Communicator Telegram

🚀 MCP 通信器(Telegram)

MCP 通信器(Telegram)是一个 MCP 服务器,可借助 Telegram 与用户展开通信。它提供了丰富工具,能通过 Telegram 机器人与用户互动,涵盖提问、发送通知、共享文件以及创建项目存档等功能。

🚀 快速开始

在使用 MCP 通信器(Telegram)之前,你需要满足以下先决条件:

  • Node.js (v14 或更高版本)
  • Telegram 机器人令牌(从@BotFather获得)
  • 你的 Telegram 聊天 ID(使用随附工具获取)

📦 安装指南

通过 npm(全局)

npm install -g mcp-communicator-telegram

使用 npx(按需)

npx mcptelegram

获取你的 Telegram 聊天 ID:

npx mcptelegram-chatid

克隆仓库安装

  1. 克隆仓库:
git clone https://github.com/qpd-v/mcp-communicator-telegram.git
cd mcp-communicator-telegram
  1. 安装依赖项:
npm install
  1. 创建 Telegram 机器人并获取令牌。

  2. 使用以下命令获取你的 Telegram 聊天 ID:

npx mcptelegram-chatid

✨ 主要特性

  • 通过 Telegram 向用户提问
  • 向用户发送通知(无需响应)
  • 通过 Telegram 发送文件给用户
  • 创建并发送项目的 ZIP 文件(尊重.gitignore 规则)
  • 异步接收用户响应(无限等待响应)
  • 支持回复 - based 消息跟踪
  • 安全聊天 ID 验证
  • 错误处理和日志记录

📚 详细文档

配置

将服务器添加到 MCP 设置文件中:

config/mcp.json 中添加以下内容:

{
"telegram": {
"botToken": "your_bot_token",
"chatId": "your_chat_id"
}
}

可用工具

ask_user

通过 Telegram 提问。

输入模式
{
"type": "question",
"question": "你的问题?",
"messageId": "string" // 可选的Telegram消息ID,用于关联答案
}
示例用法:
await useMCP({
server: 'telegram',
tool: 'ask_user',
arguments: {
question: '你最喜欢的颜色是什么?',
messageId: '12345'
}
});

notify_user

通过 Telegram 发送通知。

输入模式
{
"type": "notification",
"message": "你的消息。",
"messageId": "string" // 可选的Telegram消息ID
}
示例用法:
await useMCP({
server: 'telegram',
tool: 'notify_user',
arguments: {
message: '系统状态已更新。',
messageId: '67890'
}
});

send_file

通过 Telegram 发送文件。

输入模式
{
"type": "file",
"filePath": "path/to/file", // 可选的文件路径,默认为当前目录
"message": "可选的消息内容"
}
示例用法:
  • 发送默认目录中的文件:
await useMCP({
server: 'telegram',
tool: 'send_file',
arguments: {}
});
  • 发送特定路径的文件:
await useMCP({
server: 'telegram',
tool: 'send_file',
arguments: {
filePath: '/path/to/your/file'
}
});

zip_project

创建并发送项目的 ZIP 文件。

输入模式
{
"type": "directory",
"directory": "string" // 可选的目录路径,默认为当前工作目录
}
示例用法:
  • 使用默认目录(当前工作目录):
await useMCP({
server: 'telegram',
tool: 'zip_project',
arguments: {}
});
  • 指定特定目录:
await useMCP({
server: 'telegram',
tool: 'zip_project',
arguments: {
directory: '/path/to/specific/directory'
}
});
  • 0 关注
  • 0 收藏,26 浏览
  • system 提出于 2025-10-03 12:54

相似服务问题

相关AI产品