Labsco
Beltran12138 logo

wecom-docs-mcp-server

4

from Beltran12138

WeCom (Enterprise WeChat) document operations via MCP — create, read, and edit Docs and Smartsheets. 9 tools. Fills the doc-CRUD gap: existing WeCom MCP servers only support webhook messaging

🔥🔥🔥✓ VerifiedFreeQuick setup

wecom-docs-mcp-server

MCP Python License: MIT

MCP server for WeCom (企业微信 / Enterprise WeChat) document operations — create, read, and edit WeCom Docs and Smartsheets from any MCP-compatible AI agent.

Gap this fills: Existing WeCom MCP servers (wecom-bot-mcp-server, wecom-mcp) only support sending messages via webhook. This server provides document CRUD operations via the @wecom/cli document API.

Compatible with: Claude Desktop · Hermes Agent · Cursor · any MCP client


Tools (9)

ToolDescription
wecom_read_docRead a WeCom Doc or Smartsheet → Markdown
wecom_create_docCreate a new Doc (type 3) or Smartsheet (type 10)
wecom_edit_docWrite Markdown content to a doc
wecom_smartsheet_setup_fieldsInitialize a smartsheet's column schema
wecom_smartsheet_add_recordsAppend rows (auto cell-format conversion)
wecom_smartsheet_get_sheetList sheets in a smartsheet
wecom_smartsheet_get_fieldsGet column definitions
wecom_smartsheet_get_recordsFetch all rows from a sheet
wecom_get_doc_contentAsync-poll full doc content as Markdown

Why This Exists (The Silent Failure Problem)

Calling wecom-cli from WSL via bash hits a three-layer failure:

  1. UNC path issuecmd.exe launches with wrong working directory under WSL
  2. Exit code lies — process returns 0 but writes nothing
  3. Chinese encoding — shell argument boundary corrupts multi-byte characters

Fix: call node.exe directly via subprocess.run([...], capture_output=True) — no shell, args pass through CreateProcessW, Chinese content works correctly.

# ❌ silently fails from WSL
os.system(f'wecom-cli doc edit_doc_content --json "{json_content}"')

# ✅ works
subprocess.run(["node.exe", WECOM_JS, "doc", "edit_doc_content", "--json", json_content],
               capture_output=True)

Related Projects

ProjectFocus
wecom-bot-mcp-serverBot messaging via webhook
wecom-mcpSend messages/files via webhook
wecom-docs-mcp-server (this)Document CRUD: create/read/edit Docs & Smartsheets

License

MIT


<details> <summary>中文说明</summary>

简介

wecom-docs-mcp-server 是一个 MCP stdio 服务器,将企业微信文档操作(创建、读取、编辑文档和智能表格)暴露为 MCP 工具,可在 Claude Desktop、Hermes Agent、Cursor 等任何 MCP 客户端中使用。

与已有企微 MCP 项目的区别:现有项目(wecom-bot-mcp-server、wecom-mcp)均只支持通过 Webhook 发送消息;本项目专注于文档 CRUD 操作,使用 @wecom/cli 文档 API。

核心技术问题

从 WSL 通过 bash 调用 wecom-cli静默失败(exit code 0,但文档为空)。原因是 UNC 路径问题 + cmd.exe 工作目录错误 + 中文编码失败三层叠加。

解决方案:直接用 subprocess.run(["node.exe", ...]) 调用,绕过 shell,通过 CreateProcessW 传参,中文内容完全正常。

安装

pip install wecom-docs-mcp-server

快速配置(Claude Desktop)

{
  "mcpServers": {
    "wecom-docs": {
      "command": "python",
      "args": ["-m", "wecom_docs_mcp_server"]
    }
  }
}
</details>