WeCom Bot MCP Server

WeCom Bot MCP Server

镜像

简介

WeCom Bot MCP 服务器是一个基于 FastMCP 实现的企业微信机器人服务器,支持通过 webhook 发送消息。

Python 包 PyPI 版本

安装

# 使用 pip
pip install wecom-bot-mcp-server

# 或使用 poetry(推荐)
poetry add wecom-bot-mcp-server

基本使用

1. 设置 Webhook URL

# Windows PowerShell
$env:WECOM_WEBHOOK_URL="你的企业微信机器人 Webhook URL"

# Linux/macOS
export WECOM_WEBHOOK_URL="你的企业微信机器人 Webhook URL"

2. 运行服务器

# 命令行直接运行
wecom-bot-mcp-server

或在代码中使用:

from wecom_bot_mcp_server.server import main

if __name__ == "__main__":
    main()

3. 发送消息和查看历史

from wecom_bot_mcp_server.server import send_message, get_message_history

# 发送消息
await send_message("Hello, WeCom!")

# 获取消息历史
history = get_message_history()

Cline 集成配置

  1. 找到 Cline MCP 设置文件位置:

    • Windows: %APPDATA%\Code\User\globalStorage\ooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
    • Linux: ~/.config/Code/User/globalStorage/ooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
    • macOS: ~/Library/Application Support/Code/User/globalStorage/ooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
  2. 添加配置:

{
  "mcpServers": {
    "wecom-bot-server": {
      "command": "wecom-bot-mcp-server",
      "args": [],
      "env": {
        "WECOM_WEBHOOK_URL": "<你的企业微信机器人Webhook URL>"
      },
      "alwaysAllow": [
        "send_message"
      ],
      "disabled": false
    }
  }
}

系统要求

  • Python >= 3.10
  • FastMCP >= 0.4.1
  • httpx >= 0.24.1

更多详细信息请查看完整文档