wecom-doc-mcp
by Tiansiyu-tj
README.md
<div align="center">
# ๐ wecom-doc-mcp
**Let AI read your Enterprise WeChat docs โ in real time.**
[](https://modelcontextprotocol.io)
[](https://nodejs.org)
[](https://www.typescriptlang.org)
[](LICENSE)
<br/>
<p>
<img src="https://img.shields.io/badge/ไผไธๅพฎไฟก-ๆๆกฃ-07C160?style=flat-square&logo=wechat&logoColor=white" />
<img src="https://img.shields.io/badge/Claude_Code-Ready-D97706?style=flat-square" />
<img src="https://img.shields.io/badge/Cookie-Auth-red?style=flat-square&logo=cookiecutter&logoColor=white" />
</p>
[English](#-why) ยท [ไธญๆ](README_CN.md)
</div>
---
## ๐ค Why
> Enterprise WeChat documents sit behind SSO. AI assistants can't access them.
This MCP server bridges the gap: provide your browser cookie once, and the server handles authenticated fetching + HTML-to-Markdown conversion on every request.
```
๐ฌ "ๅธฎๆ็ไธ่ฟไธชๆๆกฃ: https://doc.weixin.qq.com/doc/w3_xxx"
โ
โผ
โโโโโโโโโโโโโโโ ๐ช โโโโโโโโโโโโโโโโ ๐ โโโโโโโโโโโโ
โ Claude Code โ โโCookieโโโถ โ MCP Server โ โโHTMLโโโถ โ Markdown โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโ
```
## ๐ ๏ธ Tools
| Tool | Description |
|:-----|:------------|
| ๐ `fetch_wecom_doc` | Fetch a document by URL โ return Markdown |
| ๐ช `set_wecom_cookie` | Save cookie locally (`chmod 600`) |
| โ
`check_wecom_auth` | Verify if saved cookie is still valid |
## ๐ Quick Start
### Step 1 โ Install
```bash
git clone https://github.com/Tiansiyu-tj/wecom-doc-mcp.git
cd wecom-doc-mcp
npm install
```
### Step 2 โ Register with Claude Code
Add to `~/.mcp.json`:
```json
{
"mcpServers": {
"wecom-doc": {
"command": "npx",
"args": ["tsx", "/path/to/wecom-doc-mcp/src/index.ts"]
}
}
}
```
### Step 3 โ Get Your Cookie ๐ช
```
1. ๐ Open doc.weixin.qq.com โ log in
2. ๐ง F12 โ Network tab
3. ๐ Click any request โ copy the Cookie header value
```
### Step 4 โ Use It
```text
You: ๅธฎๆ่ฎพ็ฝฎไผไธๅพฎไฟก Cookie: <paste>
Claude: โ
Cookie ๅทฒไฟๅญ
You: ๅธฎๆ็ไธ่ฟไธชๆๆกฃ: https://doc.weixin.qq.com/doc/w3_xxx
Claude: # ๆๆกฃๆ ้ข
่ฟๆฏๆๆกฃ็ๅ
ๅฎน...
```
## ๐ Architecture
```
wecom-doc-mcp
โโโโโโโโโโโโโโโโโโโโโโโ
โ โ
fetch_wecom_doc โโโค ๐ก /dop-api/opendocโ
โ โ Call WeChat's โ
โ โ internal API for โโโโโ ๐ Markdown
โ โ document JSON data โ
โ โ โ
โ โ ๐งน cleanDocText โ
โ โ Strip HYPERLINK โ
โ โ markup โ clean text โ
โ โ โ
โ โ ๐ Fallback: โ
โ โ cheerio + turndown โ
โ โโโโโโโโโโโโโโโโโโโโโโโ
โ
set_wecom_cookie โโโ ๐พ ~/.claude/wecom-doc-mcp/.env (mode 600)
โ
check_wecom_auth โโโ ๐ฅ GET doc.weixin.qq.com โ 200?
```
## ๐ Cookie Auth
Two modes, your choice:
| Mode | How | When |
|:-----|:----|:-----|
| ๐พ Persistent | `set_wecom_cookie` โ saved to `~/.claude/wecom-doc-mcp/.env` | Set once, use forever (until expiry) |
| โก Per-request | Pass `cookie` param to `fetch_wecom_doc` | Override on the fly |
> ๐ Cookie file lives outside the project directory โ never committed, never shared, `chmod 600`.
## ๐ Supported Document Types
| Type | URL Pattern | Status |
|:-----|:------------|:------:|
| ๐ Documents | `/doc/` | โ
Verified |
| ๐ Spreadsheets | `/sheet/` | ๐ง Untested |
| ๐๏ธ Slides | `/slide/` | ๐ง Untested |
| ๐ง Mind Maps | `/mind/` | โ
Verified |
| ๐ Flowcharts | `/flowchart/` | ๐ง Untested |
| ๐ Smart Sheets | `/smartsheet/` | ๐ง Untested |
## ๐ฆ Tech Stack
| Dependency | Purpose |
|:-----------|:--------|
| `@modelcontextprotocol/sdk` | MCP protocol implementation |
| `cheerio` | HTML parsing |
| `turndown` | HTML โ Markdown conversion |
| `tsx` | TypeScript runtime |
## ๐ License
MIT
---
<div align="center">
<sub>Built with โค๏ธ for teams drowning in enterprise docs</sub>
</div>
TDQS
A4.1/5.0
Scored across 3 tools
Disambiguation5/5
Each tool has a distinct purpose: fetching document content, saving authentication credentials, and verifying authentication validity. No overlap or ambiguity between them.
Naming Consistency5/5
All tool names follow a consistent verb_noun pattern using snake_case: fetch_wecom_doc, set_wecom_cookie, check_wecom_auth.
Tool Count5/5
With 3 tools, the server is well-scoped for its purpose of fetching WeCom documents with authentication management. Each tool earns its place.
Completeness4/5
The set covers authentication setup, validation, and document fetching. A minor gap is the lack of a tool to list or search documents, but the core workflow is complete for fetching known documents.
Maintenance
ActivityInactive
ResponsivenessNo issues