Token导航 LogoToken导航

MCP Server · 开发工具

WeCom Bot MCP Server

A Python server implementation for WeCom (WeChat Work) bot that follows the Model Context Protocol (MCP). This server provides a standardized interface for handling automated messaging and context-aware interactions within enterprise WeChat environments.

stdio官方级别未说明来源级核验工具 0@smithery/cli
团队协作PythonClaudeClaude DesktopWindsurfCline

快速开始

作者 / 组织
loonghao
提供方
loonghao
运行时
Node.js

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

87

仓库热度

收录来源

4 个

MCP.so

选型结论

WeCom Bot MCP Server 属于开发工具类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,适配 Claude Desktop、Claude、Windsurf,有可以直接复制的安装命令;接入前先确认权限范围。

分类

开发工具

传输方式

stdio

认证方式

无需认证

部署方式

支持远程部署

安装与配置

安装命令

npx -y @smithery/cli install wecom-bot-mcp-server --client claude

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 0 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

WeCom Bot MCP服务器

WeCom(WeChat Work)机器人的模型上下文协议(MCP)兼容服务器实现。

英语 | 中文

特性

  • 支持多种消息类型:

- Markdown消息(带有@提及和字体颜色) - Markdown V2消息(带表格、列表、嵌入式图像) - 图像消息(base64/本地文件/URL) - 文件消息 - 卡片消息模板(text_notice和news_notice)

  • 多机器人支持:配置和使用多个WeCom机器人
  • @提及支持(通过用户ID或电话号码)
  • 邮件历史跟踪
  • 可配置的日志记录系统
  • 完整类型注释
  • 基于Pydantic的数据验证

需求

  • Python 3.10+
  • WeCom Bot Webhook URL(从WeCom组设置中获取)

安装

有几种方法可以安装WeCom Bot MCP服务器:

1.自动安装(推荐)

使用Smithery(适用于Claude Desktop):
npx -y @smithery/cli install wecom-bot-mcp-server --client claude
将VSCode与Cline扩展一起使用:
  1. 安装 临床扩展 来自VSCode市场
  2. 打开命令面板(Ctrl+Shift+P/Cmd+Shift+P)
  3. 搜索“临床:安装包”
  4. 键入“wecom bot mcp server”,然后按Enter键

2.手动配置

将服务器添加到MCP客户端配置文件中:

// For Claude Desktop on macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
// For Claude Desktop on Windows: %APPDATA%\Claude\claude_desktop_config.json
// For Windsurf: ~/.windsurf/config.json
// For Cline in VSCode: VSCode Settings > Cline > MCP Settings
{
  "mcpServers": {
    "wecom": {
      "command": "uvx",
      "args": [
        "wecom-bot-mcp-server"
      ],
      "env": {
        "WECOM_WEBHOOK_URL": "your-webhook-url"
      }
    }
  }
}

配置

设置环境变量

单个机器人(默认)
# Windows PowerShell
$env:WECOM_WEBHOOK_URL = "your-webhook-url"

# Optional configurations
$env:MCP_LOG_LEVEL = "DEBUG"  # Log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
$env:MCP_LOG_FILE = "path/to/custom/log/file.log"  # Custom log file path
多机器人配置

您可以使用以下任何方法配置多个机器人:

方法1:JSON配置(推荐)

# Windows PowerShell
$env:WECOM_BOTS = '{"alert": {"name": "Alert Bot", "webhook_url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx", "description": "For alerts"}, "ci": {"name": "CI Bot", "webhook_url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=yyy", "description": "For CI/CD"}}'

# Linux/macOS
export WECOM_BOTS='{"alert": {"name": "Alert Bot", "webhook_url": "https://...", "description": "For alerts"}, "ci": {"name": "CI Bot", "webhook_url": "https://...", "description": "For CI/CD"}}'

方法2:单个环境变量

# Windows PowerShell
$env:WECOM_BOT_ALERT_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx"
$env:WECOM_BOT_CI_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=yyy"
$env:WECOM_BOT_NOTIFY_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=zzz"

方法3:组合模式

# WECOM_WEBHOOK_URL becomes the "default" bot
$env:WECOM_WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=default"
# Additional bots
$env:WECOM_BOT_ALERT_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=alert"
具有多个机器人的MCP客户端配置
{
  "mcpServers": {
    "wecom": {
      "command": "uvx",
      "args": ["wecom-bot-mcp-server"],
      "env": {
        "WECOM_WEBHOOK_URL": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=default",
        "WECOM_BOTS": "{\"alert\": {\"name\": \"Alert Bot\", \"webhook_url\": \"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=alert\"}, \"ci\": {\"name\": \"CI Bot\", \"webhook_url\": \"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=ci\"}}"
      }
    }
  }
}

日志管理

测井系统使用 platformdirs.user_log_dir() 对于跨平台日志文件管理:

  • 窗户: C:\Users\\AppData\Local\hal\wecom-bot-mcp-server\Logs
  • Linux: ~/.local/state/hal/wecom-bot-mcp-server/log
  • macOS: ~/Library/Logs/hal/wecom-bot-mcp-server

日志文件名为 mcp_wecom.log 并存储在上述目录中。

您可以使用环境变量自定义日志级别和文件路径:

  • MCP_LOG_LEVEL:设置为调试、信息、警告、错误或严重
  • MCP_LOG_FILE:设置为自定义日志文件路径

用法

配置后,当您的MCP客户端启动时,MCP服务器会自动运行。您可以通过AI助手中的自然语言与它进行交互。

使用示例

场景1:向WeCom发送天气信息

USER: "How's the weather in Shenzhen today? Send it to WeCom"
ASSISTANT: "I'll check Shenzhen's weather and send it to WeCom"
[The assistant will use the send_message tool to send the weather information]

场景2:发送会议提醒并@提及相关人员

USER: "Send a reminder for the 3 PM project review meeting, remind Zhang San and Li Si to attend"
ASSISTANT: "I'll send the meeting reminder"
[The assistant will use the send_message tool with mentioned_list parameter]

场景3:发送文件

USER: "Send this weekly report to the WeCom group"
ASSISTANT: "I'll send the weekly report"
[The assistant will use the send_file tool]

场景4:发送图像

USER: "Send this chart image to WeCom"
ASSISTANT: "I'll send the image"
[The assistant will use the send_image tool]

可用的MCP工具

服务器提供了您的AI助手可以使用的以下工具:

  1. send_message -发送文本或标记消息

- 参数: content, msg_type (markdown/markdown_v2), mentioned_list, mentioned_mobile_list, bot_id - markdown:当内容包含以下内容时使用 ` 提及或字体颜色。这 语法是微信的官方提及格式,它避免了与电子邮件地址的冲突,如 @user@email.com - markdown_v2`:用于表格、列表、嵌入图像或常规内容(默认)

  1. send_wecom_文件 -将文件发送到WeCom

- 参数: file_path, bot_id

  1. send_wecom_image -将图片发送至WeCom

- 参数: image_path (本地路径或URL), bot_id

  1. send_wecom_template_card_text_note通知 -发送短信通知模板卡

- 参数: template_card_source, template_card_main_title, template_card_card_action, bot_id,以及可选字段 - 用于带有强调内容、引号和操作按钮的通知

  1. send_wecom_template_card_news_notice -发送新闻通知模板卡

- 参数: template_card_source, template_card_main_title, template_card_card_action, template_card_image, bot_id,以及可选字段 - 用于带有图像和丰富内容的新闻风格通知

  1. list_wecom_bots -列出所有已配置的机器人

- 返回:可用机器人及其ID、名称和描述的列表

多机器人使用示例

场景5:向特定机器人发送警报

USER: "Send a critical alert to the alert bot: Server CPU usage is above 90%"
ASSISTANT: "I'll send the alert to the alert bot"
[The assistant will use send_message with bot_id="alert"]

场景6:列出可用的机器人

USER: "What WeCom bots are available?"
ASSISTANT: "Let me check the available bots"
[The assistant will use list_wecom_bots tool]

场景7:发送CI通知

USER: "Send build success notification to the CI bot"
ASSISTANT: "I'll send the notification to the CI bot"
[The assistant will use send_message with bot_id="ci"]

场景8:发送模板卡通知

USER: "Send a deployment success notification card with a link to the dashboard"
ASSISTANT: "I'll send a template card notification"
[The assistant will use send_wecom_template_card_text_notice tool]

场景9:发送新闻风格的通知

USER: "Send a news card about the new feature release with an image"
ASSISTANT: "I'll send a news notice card"
[The assistant will use send_wecom_template_card_news_notice tool]

对于开发人员:直接使用API

如果你想在Python代码中直接使用这个包(而不是作为MCP服务器):

from wecom_bot_mcp_server import send_message, send_wecom_file, send_wecom_image, send_wecom_template_card

# Send markdown message (uses default bot)
await send_message(
    content="**Hello World!**",
    msg_type="markdown"
)

# Send markdown_v2 message with tables and lists (default)
await send_message(
    content="| Column1 | Column2 |\n|---------|---------|\\n| Value1  | Value2  |",
    msg_type="markdown_v2"
)

# Send text message and mention users (use markdown for @mentions)
await send_message(
    content="Hello  ",
    msg_type="markdown",
    mentioned_list=["user1", "user2"]
)

# Send message to a specific bot
await send_message(
    content="Build completed successfully!",
    msg_type="markdown_v2",
    bot_id="ci"  # Send to CI bot
)

# Send alert to alert bot
await send_message(
    content="⚠️ High CPU usage detected!",
    msg_type="markdown_v2",
    bot_id="alert"
)

# Send file to specific bot
await send_wecom_file("/path/to/file.txt", bot_id="ci")

# Send image to specific bot
await send_wecom_image("/path/to/image.png", bot_id="alert")

# Send template card (text_notice)
await send_wecom_template_card(
    template_card_type="text_notice",
    template_card_source={"icon_url": "", "desc": "System"},
    template_card_main_title={"title": "Deployment Success", "desc": "Production environment"},
    template_card_card_action={"type": 1, "url": "https://example.com/dashboard"},
    template_card_emphasis_content={"title": "100%", "desc": "Success Rate"},
    bot_id="ci"
)

代码中的多机器人配置

from wecom_bot_mcp_server.bot_config import get_bot_registry, list_available_bots

# List all available bots
bots = list_available_bots()
for bot in bots:
    print(f"Bot: {bot['id']} - {bot['name']}")

# Check if a specific bot exists
registry = get_bot_registry()
if registry.has_bot("alert"):
    print("Alert bot is configured")

# Get webhook URL for a specific bot
url = registry.get_webhook_url("ci")

发展

设置开发环境

  1. 克隆存储库:
git clone https://github.com/loonghao/wecom-bot-mcp-server.git
cd wecom-bot-mcp-server
  1. 创建虚拟环境并安装依赖项:
# Using uv (recommended)
pip install uv
uv venv
uv pip install -e ".[dev]"

# Or using traditional method
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e ".[dev]"

测试

# Run all tests with coverage
uvx nox -s pytest

# Run import tests only
uvx nox -s test_imports

# Run specific test file
uvx nox -s pytest -- tests/test_message.py

# Run tests with verbose output
uvx nox -s pytest -- -v

代码风格

# Check code
uvx nox -s lint

# Automatically fix code style issues
uvx nox -s lint_fix

建筑与出版

# Build the package
uvx nox -s build

# Publish to PyPI (requires authentication)
uvx nox -s publish

持续集成

该项目使用GitHub Actions for CI/CD:

  • MR检查:在所有拉取请求上运行,在Ubuntu、Windows和macOS上使用Python 3.10、3.11和3.12进行测试
  • 代码覆盖率:将覆盖率报告上传到Codecov
  • 导入测试:确保安装后可以正确导入包

在CI期间会自动测试所有依赖关系,以便及早发现问题。

项目结构

wecom-bot-mcp-server/
├── src/
│   └── wecom_bot_mcp_server/
│       ├── __init__.py
│       ├── __main__.py
│       ├── __version__.py
│       ├── app.py           # FastMCP application setup
│       ├── server.py        # Server entry point
│       ├── message.py       # Message and template card handling
│       ├── file.py          # File upload handling
│       ├── image.py         # Image upload handling
│       ├── bot_config.py    # Multi-bot configuration
│       ├── utils.py         # Utility functions
│       ├── log_config.py    # Logging configuration
│       └── errors.py        # Error definitions
├── tests/
│   ├── test_server.py
│   ├── test_message.py
│   ├── test_file.py
│   ├── test_image.py
│   └── test_bot_config.py
├── docs/
├── pyproject.toml
├── noxfile.py
└── README.md

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

联系

  • 作者:龙浩
  • 电子邮件:hal.long@outlook.com

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

developer-tools微信机器人Python本地部署企业通讯消息推送自动化工具多机器人管理

支持客户端

Claude DesktopClaudeWindsurfCline

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

让助手直接读代码

把仓库、提交记录和 issue 交给模型检索,补全和重构时不用来回复制文件。

在对话里跑命令

触发构建、测试和脚本,执行结果直接回到上下文,省去切终端。

接进开发流程

把 PR、CI 状态和代码审查接进助手,减少在几个工具之间跳。

选择建议

值得选的地方

  • 只提供 0 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Claude Desktop、Claude、Windsurf,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 Node.js,换机器要重新装一遍。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在开发工具场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
WeCom Bot MCP Server

MCP.so · 本页

0stdio有4 个2026-05-17
Git 838e2ec1

MCP World

12stdio有2 个2026-05-17
Markitdown MCP 2c653a5f

MCP World

1stdio有1 个2026-05-17
Context7 831acf40

MCP World

0stdio有1 个2026-05-17
Context7 MCP C671e75a

MCP World

0stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

WeCom Bot MCP Server 怎么安装?

公开资料给出的安装命令是 npx -y @smithery/cli install wecom-bot-mcp-server --client claude,运行环境为 Node.js。装完后按客户端要求写进 MCP 配置,重启客户端生效。

WeCom Bot MCP Server 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Node.js;保存后完全退出客户端再打开,配置才会生效。

WeCom Bot MCP Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

WeCom Bot MCP Server 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

WeCom Bot MCP Server 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude、Windsurf、Cline;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP