Yuque AI MCP README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Yuque AI MCP listing page.

yuque-ai-mcp

yuque-ai-mcp

65 MCP tools (45 OpenAPI + 20 web-API)

version license skills

中文文档


A full-featured Yuque (语雀) MCP Server built on the Model Context Protocol. Provides 65 fine-grained tools across 13 domains — 45 Yuque OpenAPI endpoints plus 20 web-API tools requiring a browser session cookie.

Why

  • 19 → 65 tools — 3x more coverage than the official yuque-mcp-server
  • Dual transport — stdio + HTTP SSE, shared registry, zero downtime on reload
  • Modular architecture — 13 domains, barrel exports, single source of truth registry
  • Full API coverage — group, recycle, upload, statistics, versions, boards — all the missing pieces
  • Skill layer — 67 usage guides for AI agents

Table of Contents

Quick Start

bash
cd server
npm install
npm run build

# Copy config template
cp ../config/config.example.json ../config/config.json
# Edit config.json with your Yuque API token

# Run
npm start              # stdio mode
npm run dev:http       # HTTP SSE mode (http://localhost:3099)

Note: npm run dev:http uses tsx for hot-reload during development, but it shares the production HTTP entry — it also requires YUQUE_MCP_HTTP_TOKEN or the process exits.

Install from npm (no clone needed)

Terminal
npm install -g yuque-ai-mcp
yuque-mcp            # stdio transport
yuque-mcp-http       # HTTP SSE transport (needs YUQUE_MCP_HTTP_TOKEN)

# or run straight from the registry without a global install
npx -y -p yuque-ai-mcp yuque-mcp

The package ships two binaries: yuque-mcp (stdio, what MCP clients should point at) and yuque-mcp-http (SSE). Config is read from --config <path> first, then ./yuque-config.json, then ~/.yuque-mcp/config.json (there is no environment-variable token override — the token must be in the config file).

Windows: when a client config rejects npx, use "command": "npx.cmd" (PowerShell) or "command": "node", "args": ["C:/path/to/node_modules/yuque-ai-mcp/dist/cli.js"]. If PowerShell blocks .ps1 shims, call npx.cmd instead of npx.

Export output is sandboxed by default

yuque_export_repo / yuque_export_doc / yuque_export_resources only write inside the current working directory (or YUQUE_EXPORT_ROOT); absolute paths outside it return INVALID_OUTPUT_DIR instead of writing. To allow another location:

server.ts
export YUQUE_EXPORT_ROOT="/path/to/exports"

HTTP / SSE mode requires an access token

dist/http.js exposes all tools over the network, so it refuses to start unless a shared token is set:

server.ts
export YUQUE_MCP_HTTP_TOKEN="$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'))")"
npm run start:http                        # binds 127.0.0.1:3099 by default
curl http://127.0.0.1:3099/health         # /health stays public
curl -N "http://127.0.0.1:3099/sse?token=$YUQUE_MCP_HTTP_TOKEN"

Clients that can set headers should send Authorization: Bearer <token> instead of the query parameter (browsers' EventSource cannot set headers, hence the query form). Optional env: HOST (default 127.0.0.1), PORT (default 3099), YUQUE_MCP_CORS_ORIGINS (comma-separated allowlist; empty means no CORS headers), YUQUE_TRUSTED_RESOURCE_HOSTS (host allowlist for resource downloads in yuque_export_resources, default yuque.com,nlark.com,yuque.net). Set DEBUG=1 to log retry attempts to stderr.

Tool Overview

DomainToolsHighlights
doc15CRUD, versions, diff, batch get, import URL/file, cross-book copy, export, resource download
repo8CRUD, batch get, cross-book copy, full export (TOC-structure + INDEX/GRAPH)
toc3Get, update, batch update (createTitle/appendNode/removeNode/moveNode)
search3General search + RAG-enhanced search + Cookie web search
user3User info, heartbeat, group list
group3Member list, role change, delete member
statistic4Group/member/repo/doc statistics
note4CRUD + soft-delete/restore
recycle3List, restore, destroy (Cookie auth)
upload1File upload to Yuque CDN (Cookie auth)
board3Mindmap, flowchart, architecture diagram
mine7Book stacks (⚠️ keep each stack at or under 200 books: the API returns at most 200 per stack — a response window, not a capacity cap, so extras stay in the stack but are neither returned nor shown), editor center, update/sort book stack (Cookie auth)
web_doc8Web API: get/list docs, repos, TOC, move/copy/delete catalog nodes (Cookie auth)
Total65

Auth split: 45 tools use the OpenAPI (X-Auth-Token); 20 are Web API requiring Cookie + x-csrf-token — web_doc (8), mine (7), recycle (3), upload (1), web_search (1).

All 65 Tools

ToolDomainDescription
yuque_hellouser心跳检测,验证 Token 有效性
yuque_get_useruser获取当前 Token 的用户详情
yuque_get_user_groupsuser获取用户所属的团队列表
yuque_searchsearch通用搜索文档/知识库
yuque_rag_searchsearchRAG 检索增强搜索 + 自动获取文档内容
yuque_web_searchsearchCookie 态 Web 搜索,返回完整文档对象 + 精确总数 + 高亮摘要
yuque_get_group_usersgroup获取团队成员列表
yuque_update_group_usergroup变更团队成员角色
yuque_delete_group_usergroup删除团队成员
yuque_list_docsdoc获取知识库文档列表
yuque_create_docdoc创建文档
yuque_get_docdoc获取文档详情(支持 ID 或 slug)
yuque_update_docdoc更新文档
yuque_delete_docdoc删除文档
yuque_batch_get_docsdoc批量获取文档详情(max 20)
yuque_get_doc_versionsdoc获取文档历史版本列表
yuque_get_doc_version_detaildoc获取文档历史版本详情
yuque_diff_doc_versionsdoc对比两个版本的行级差异
yuque_copy_docdoc单文档跨库复制
yuque_export_docdoc导出单篇文档为 Markdown 文件
yuque_export_resourcesdoc下载文档中的图片/附件到本地
yuque_import_urldoc从网页 URL 导入文档
yuque_import_filedoc从本地文件导入文档
yuque_embed_urldoc生成文档嵌入阅读器 URL
yuque_get_toctoc获取知识库目录
yuque_update_toctoc更新知识库目录
yuque_batch_update_toctoc批量更新目录(createTitle/appendNode/removeNode/moveNode/prependDoc)
yuque_list_reposrepo获取知识库列表(用户/团队)
yuque_create_reporepo创建知识库
yuque_get_reporepo获取知识库详情
yuque_update_reporepo更新知识库
yuque_delete_reporepo删除知识库
yuque_batch_get_reposrepo批量获取知识库详情(max 20)
yuque_copy_reporepo批量跨库复制(LLM 分类 + 目录重建)
yuque_export_reporepo批量导出知识库为 Markdown(按 TOC 目录结构)
yuque_get_group_statisticsstatistic获取团队汇总统计数据
yuque_get_member_statisticsstatistic获取团队成员统计数据
yuque_get_book_statisticsstatistic获取团队知识库统计数据
yuque_get_doc_statisticsstatistic获取团队文档统计数据
yuque_list_notesnote获取小记列表
yuque_get_notenote获取小记详情
yuque_create_notenote创建小记
yuque_update_notenote更新小记
yuque_list_recyclesrecycle列出回收站项目(Cookie)
yuque_restore_recyclerecycle恢复回收站项目(Cookie)
yuque_destroy_recyclerecycle彻底删除回收站项目(Cookie)
yuque_upload_attachmentupload上传文件到语雀 CDN(Cookie)
yuque_get_boardboard获取文档中的画板资源
yuque_create_boardboard在文档中创建画板资源
yuque_update_boardboard更新文档中的画板资源
yuque_get_book_stacksmine获取知识库分组(书架)列表(Cookie)
yuque_get_editor_centermine获取个人编辑中心全景数据(Cookie)
yuque_create_book_stackmine创建知识库分组(书架),内部 create 后自动改名(Cookie)
yuque_rename_book_stackmine重命名知识库分组(书架)(Cookie)
yuque_update_book_stackmine移动知识库到指定分组(书架)(Cookie)
yuque_sort_book_stackmine排序知识库分组(书架)(Cookie)
yuque_delete_book_stackmine删除知识库分组(书架),需 confirm='DELETE'(Cookie)
yuque_web_get_docweb_docCookie 态读文档正文(含 body/content),不受会员过期限流;id 支持文档 slug
yuque_web_list_docsweb_docCookie 态列文档列表,更丰富的字段
yuque_web_list_reposweb_docCookie 态列知识库列表,含权限信息
yuque_web_get_tocweb_docCookie 态获取知识库目录 TOC
yuque_web_delete_docweb_docCookie 态删除文档(移入回收站,v2 被限流时的备用通道)
yuque_web_move_catalog_nodeweb_docCookie 态移动目录节点
yuque_web_copy_catalog_nodeweb_docCookie 态复制目录节点
yuque_web_batch_move_catalog_nodesweb_docCookie 态批量移动目录节点

See SKILL.md or yuque-ai-skills for full tool documentation with parameters and examples.

vs Official

FeatureOfficial yuque-mcp-serveryuque-ai-mcp
Tools1965
GranularityCoarseFine-grained (1 tool / endpoint)
Group, Recycle, Upload, Statistics❌✅
Versions, Diff, Cross-book Copy❌✅
Transportstdio onlystdio + HTTP SSE
ConfigEnv varconfig.json (token + cookie)
Skill Layer❌✅ 67 guides

Architecture

server.ts
server/src/
├── common/              # Shared: config, errors, types, format, validate,
│                        # api-client, web-request, register-tools, copy/export common,
│                        # toc-cache (configurable TTL), text-utils
├── user/ search/ group/ doc/ toc/ repo/ statistic/
├── note/ recycle/ upload/ board/ mine/ web-doc/
├── index.ts             # stdio entry
└── http.ts              # HTTP SSE entry (port 3099)

Configuration

config.json
{
  "token": "Your Yuque API Token",
  "api_base": "https://www.yuque.com/api/v2",
  "cookie": "Optional, for recycle/upload features",
  "ctoken": "Optional, extracted from Cookie"
}
  • toc_cache_ttl_minutes: TOC cache TTL in minutes (default 60). Set higher to reduce API calls, lower for fresher data.

Error Handling

Unified error handling with structured responses (HTTP status + message + response summary). All tools share the same error pipeline.

Key errors:

  • book_full — Auto-expands by creating a new repo and appending to the book_id array
  • 401 / 403 — Token/permission issues
  • 429 — Rate limit with automatic retry

See references/api/errors.md for the full error code reference.

Contributing

bash
git clone https://github.com/yehuoshun/yuque-ai-mcp.git
cd yuque-ai-mcp/server
npm install
npm run build

# New tool checklist:
# 1. Create server/src/{domain}/{tool}.ts
# 2. Export in {domain}/index.ts + append to tools array
# 3. npx tsc
# 4. Restart HTTP server + curl health
# 5. Sync yuque-ai-skills
# 6. Update README
# 7. Sync awesome-list entries when tool/domain count changes

Both yuque-ai-mcp and yuque-ai-skills are kept in sync.

Maintenance

This project is listed in these directories. When the tool count or domain count changes, sync the entries (they mention "65 tools" / "13 domains"):

Tech Stack

  • TypeScript + Node.js
  • @modelcontextprotocol/sdk v1.x
  • Zod (validation)
  • Yuque OpenAPI v2 / Web API

License

MIT