wecom-docs-mcp-server
A stdio MCP proxy for WeCom's official robot-doc backend that enables LLM agents to read, create, and edit WeCom documents and smartsheets with ergonomic output transforms.
Document Management
Read: Fetch full content of a WeCom doc or smartsheet as Markdown, auto-detecting the URL type (
wecom_read_doc,wecom_get_doc_content)Create: Create new documents (type 3) or smartsheets (type 10) by name, receiving back a URL and docid (
wecom_create_doc)Edit: Write Markdown content (headings, lists, tables, bold, italic) to an existing document via docid or URL (
wecom_edit_doc)
Smartsheet Management
Navigation: List all sheets (sub-tables) within a smartsheet, retrieving their IDs and titles (
wecom_smartsheet_get_sheet)Field inspection: Retrieve column definitions including field names, types, and IDs (
wecom_smartsheet_get_fields)Schema setup: Initialize a smartsheet's column layout before adding data (
wecom_smartsheet_setup_fields)Record reading: Fetch all rows with structured, unwrapped cell data and ISO 8601 timestamps (
wecom_smartsheet_get_records)Record writing: Append rows using plain
{column_name: value}dicts with automatic cell format conversion (wecom_smartsheet_add_records)
Ergonomic Transforms (applied automatically)
Cell unwrapping: Flattens nested smartsheet cell formats into plain scalars (
_rowsview)Timestamp conversion: Converts 13-digit ms-epoch timestamps to ISO 8601 format
Enhanced error reporting: Human-readable
_error_summaryand_error_hintfor Chinese error codes to aid troubleshooting
The server dynamically fetches and proxies all 25 tools from the WeCom backend, converting HTTP-based communication to stdio for broader MCP client compatibility.
Provides document CRUD operations for WeCom (Enterprise WeChat) Docs and Smartsheets, including creating, reading, and editing documents and structured tables via the @wecom/cli API.
wecom-docs-mcp-server
An ergonomic stdio MCP facade over WeCom's official robot-doc MCP backend. It proxies all 25 backend tools verbatim and adds a transform layer that makes the raw output usable by LLM agents:
Schema passthrough — the tool list is fetched from the backend at startup, so it auto-tracks official updates. Zero schema maintenance.
Cell unwrap — smartsheet
values[field] = [{"type":"text","text":...}]cells become plain scalars (in a_rowsview).ms → ISO — 13-digit ms-epoch timestamps (
create_time,update_time) convert to ISO 8601.Chinese error hints —
errcode851003 etc. get_error_summary+_error_hintso the agent learns the fix, not just the code.
Relationship to the backend: This server requires the official robot-doc MCP backend (an apikey from WeCom admin → 智能文档机器人 → API). It is a thin proxy + ergonomics layer, not a replacement.
Why this exists
The official robot-doc backend is an HTTP (StreamableHttp) MCP server. Two friction points: (1) many MCP clients and dev workflows prefer stdio; (2) its raw output is agent-hostile — nested cell format, ms-epoch strings, opaque error codes. This server bridges both:
official robot-doc | this server | |
Transport | HTTP (StreamableHttp) | stdio |
Tool schema | raw 25 tools | same 25, passthrough |
Cell format |
| unwrapped scalars ( |
Timestamps | ms-epoch strings | ISO 8601 |
Error codes |
| + Chinese summary + fix hint |
apikey | required | required (proxied) |
Related MCP server: dingtalk-wiki-mcp
Requirements
Python 3.9+
A WeCom 智能文档机器人 (Smart Doc Bot) with its API key — available to enterprises (≥10 members) via WeCom admin → 应用管理 → 智能文档机器人 → API.
Install
pip install wecom-docs-mcp-serverOr clone + editable:
git clone https://github.com/Beltran12138/wecom-docs-mcp-server
cd wecom-docs-mcp-server
pip install -e .Configuration
Variable | Required | Description |
| yes | robot-doc apikey |
| no | override backend URL (default |
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"wecom-doc": {
"command": "wecom-docs-mcp-server",
"env": { "WECOM_MCP_APIKEY": "your_apikey_here" }
}
}
}Tools
All 25 backend tools are exposed verbatim (fetched live at startup). By domain:
Domain | Read | Write |
doc | get_doc_content | create_doc, edit_doc_content, upload_doc_image, upload_doc_file |
smartsheet (智能表) | get_sheet, get_fields, get_records | add/update/delete × sheet/fields/records |
sheet (电子表格) | get_info | add_sub, delete_sub, update_range_data, append_data |
smartpage (智能页面) | get_export_result | create, export_task |
Permission model (empirically observed 2026-07):
get_doc_contentandsmartsheet_get_*use independent permission scopes. A bot may read a smartsheet viasmartsheet_get_records(errcode 0) yet get851003 no authorityfromget_doc_contenton the same doc. Route reads by doc type.
Transforms (the value-add)
Applied automatically on every tools/call response:
_rowsonsmartsheet_get_records— a flattened view where cells are unwrapped to scalars and top-level record fields (record_id,create_time, …) are preserved. The originalrecordsarray is kept intact.ms → ISO on all successful dict payloads — 13-digit ms-epoch strings → ISO 8601. Alphanumeric IDs (
q979lj) are untouched._error_summary+_error_hinton any non-zero errcode — Chinese explanation + concrete fix.
Usage
Read a smartsheet end-to-end:
User: read https://doc.weixin.qq.com/smartsheet/s3_xxx?scode=yyy
Agent:
1. smartsheet_get_sheet(url=...) → sheet_id (e.g. "q979lj")
2. smartsheet_get_fields(sheet_id, url) → field schema (types, IDs)
3. smartsheet_get_records(sheet_id, url) → records + _rows (cells unwrapped, timestamps ISO)Pass the full
url(with?scode=) rather than guessingdocid— the backend resolves it. Manually extracting docid by stripping prefixes is error-prone (empirically:301085 invalid docid).
Troubleshooting
errcode | meaning | fix |
851000 | 文档链接有误 | check url + scode, or use docid |
851002 | 文档类型与工具不兼容 | smartsheet → use |
851003 | 无文档权限 | smartsheet 用 |
851008 | 缺文档内容读取权限 | 企微后台 → 机器人 → API 权限 |
301085 | 无效 docid | 用完整 url 含 scode |
40058 | 参数缺失 | smartsheet 需 sheet_id(先 get_sheet) |
Related
Project | Focus |
official robot-doc MCP | backend (HTTP, ≥10 人企业) |
bot messaging via webhook | |
this server | robot-doc stdio proxy + ergonomics |
Tests
pip install -e ".[dev]" # or: pip install pytest httpx
pytest25 unit tests cover SSE/JSON parsing, ms-timestamp normalization, cell unwrap, error humanizing, and server routing/post-processing — all offline (httpx mocked).
License
MIT
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Beltran12138/wecom-docs-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server