一个MCP服务器,支持通过Telegram与用户进行通信。该服务器提供了通过Telegram机器人与用户互动的工具,包括提问、发送通知、分享文件和创建项目存档。
npm install -g mcp-communicator-telegram
npx mcptelegram
获取您的Telegram聊天ID:
npx mcptelegram-chatid
git clone https://github.com/qpd-v/mcp-communicator-telegram.git
cd mcp-communicator-telegram

npm install
创建Telegram机器人:
/newbot
并按照指示操作获取您的聊天ID:
.env.example
到.env
.env
文件:TELEGRAM_TOKEN=your_bot_token_here
npm run build node build/get-chat-id.js
.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": "向用户提问的问题"
}
},
"required": ["question"]
}

示例用法:
const response = await use_mcp_tool({
server_name: "mcp-communicator-telegram",
tool_name: "ask_user",
arguments: {
question: "你最喜欢的颜色是什么?"
}
});

通过Telegram向用户发送通知消息(无需回复)。
输入模式:
{
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "发送给用户的消息"
}
},
"required": ["message"]
}

示例用法:
await use_mcp_tool({
server_name: "mcp-communicator-telegram",
tool_name: "notify_user",
arguments: {
message: "任务成功完成!"
}
});

通过Telegram向用户发送文件。
输入模式:
{
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "要发送的文件路径"
}
},
"required": ["filePath"]
}

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

创建一个项目目录的压缩文件(遵循.gitignore模式)并通过Telegram发送给用户。
输入模式:
{
"type": "object",
"properties": {
"directory": {
"type": "string",
"description": "要压缩的目录(默认为当前工作目录)"
}
},
"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
的压缩文件构建项目:
npm run build
以开发模式运行:
npm run dev
监听更改:
npm run watch
清理构建目录:
npm run clean
ISC
qpd-v
0.2.1 # 主要版本更新,新增功能:notify_user、send_file和zip_project工具