Skip to main content
Glama
qpd-v

MCP-Communicator-Telegram

by qpd-v

MCP 通讯器(电报)

一个 MCP 服务器,支持通过 Telegram 与用户通信。该服务器提供通过 Telegram 机器人与用户交互的工具,包括提问、发送通知、共享文件以及创建项目存档。

安装

通过 npm(全局)

npm install -g mcp-communicator-telegram

通过 npx(按需)

npx mcptelegram

要获取您的 Telegram 聊天 ID:

npx mcptelegram-chatid

Related MCP server: Telegram MCP Server

特征

  • 通过 Telegram 向用户提问

  • 向用户发送通知(无需回复)

  • 通过 Telegram 向用户发送文件

  • 创建并发送项目 zip 文件(尊重 .gitignore)

  • 异步接收响应(无限期等待响应)

  • 支持基于回复的消息跟踪

  • 安全聊天 ID 验证

  • 错误处理和日志记录

先决条件

  • Node.js(v14 或更高版本)

  • Telegram 机器人令牌(从@BotFather获得)

  • 您的 Telegram 聊天 ID(可使用附带的实用程序获取)

安装

  1. 克隆存储库:

git clone https://github.com/qpd-v/mcp-communicator-telegram.git cd mcp-communicator-telegram
  1. 安装依赖项:

npm install
  1. 创建 Telegram 机器人:

    • 打开 Telegram 并搜索@BotFather

    • 发送/newbot并按照说明操作

    • 保存您收到的机器人令牌

  2. 获取您的聊天 ID:

    • .env.example复制到.env

    • 将您的机器人令牌添加到.env文件:

      TELEGRAM_TOKEN=your_bot_token_here
    • 运行聊天 ID 实用程序:

      npm run build node build/get-chat-id.js
    • 向您的机器人发送任何消息

    • 复制控制台中显示的聊天 ID

    • 将聊天 ID 添加到您的.env文件:

      TELEGRAM_TOKEN=your_bot_token_here CHAT_ID=your_chat_id_here

配置

将服务器添加到您的 MCP 设置文件(在 Windows 上通常位于%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json ):

{ "mcpServers": { "mcp-communicator-telegram": { "command": "node", "args": ["path/to/mcp-communicator-telegram/build/index.js"], "env": { "TELEGRAM_TOKEN": "your_bot_token_here", "CHAT_ID": "your_chat_id_here" } } } }

可用工具

询问用户

通过 Telegram 向用户提出问题并等待他们的回复。

输入模式:

{ "type": "object", "properties": { "question": { "type": "string", "description": "The question to ask the user" } }, "required": ["question"] }

使用示例:

const response = await use_mcp_tool({ server_name: "mcp-communicator-telegram", tool_name: "ask_user", arguments: { question: "What is your favorite color?" } });

通知用户

通过 Telegram 向用户发送通知消息(无需回复)。

输入模式:

{ "type": "object", "properties": { "message": { "type": "string", "description": "The message to send to the user" } }, "required": ["message"] }

使用示例:

await use_mcp_tool({ server_name: "mcp-communicator-telegram", tool_name: "notify_user", arguments: { message: "Task completed successfully!" } });

发送文件

通过 Telegram 向用户发送文件。

输入模式:

{ "type": "object", "properties": { "filePath": { "type": "string", "description": "The path to the file to send" } }, "required": ["filePath"] }

使用示例:

await use_mcp_tool({ server_name: "mcp-communicator-telegram", tool_name: "send_file", arguments: { filePath: "path/to/file.txt" } });

zip_项目

创建项目目录的 zip 文件(尊重 .gitignore 模式)并通过 Telegram 将其发送给用户。

输入模式:

{ "type": "object", "properties": { "directory": { "type": "string", "description": "Directory to zip (defaults to current working directory)" } }, "required": [] }

使用默认目录(当前工作目录)的示例:

await use_mcp_tool({ server_name: "mcp-communicator-telegram", tool_name: "zip_project", arguments: {} });

特定目录的使用示例:

await use_mcp_tool({ server_name: "mcp-communicator-telegram", tool_name: "zip_project", arguments: { directory: "/path/to/your/project" } });

特征:

  • 根据目录名称创建一个名为[project-name]-project.zip的 zip 文件

  • 可以压缩任何指定目录或当前工作目录

  • 尊重 .gitignore 模式

  • 维护档案中的正确文件路径

  • 发送后自动清理 zip 文件

  • 处理最大 2GB 的文件

发展

构建项目:

npm run build

以开发模式运行:

npm run dev

注意变化:

npm run watch

清理构建目录:

npm run clean

安全

  • 服务器仅响应来自配置的聊天ID的消息

  • 环境变量用于敏感配置

  • 消息 ID 用于跟踪问题/答案对

  • 机器人会忽略没有适当上下文的消息

执照

国际学习中心

作者

qpd-v

版本

0.2.1 # 主要版本升级,新增功能:notify_user、send_file 和 zip_project 工具

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/qpd-v/mcp-communicator-telegram'

If you have feedback or need assistance with the MCP directory API, please join our Discord server