Skip to main content
Glama

Yuque MCP Tool

一个基于 Session Cookie 的语雀 MCP (Model Context Protocol) 服务器,让你可以在 Claude Desktop、Cursor、WorkBuddy 等 AI 客户端中直接读取语雀文档。

A Model Context Protocol (MCP) server for reading Yuque documents via session cookie, compatible with Claude Desktop, Cursor, WorkBuddy, and other MCP clients.


中文文档

功能特性

提供 3 个 MCP 工具:

工具

说明

yuque_read

读取语雀文档,返回渲染后的文本内容。

yuque_read_markdown

推荐。读取语雀 Lake/API 源内容并转换为可读 Markdown,保留表格、PlantUML/Mermaid 图表、代码块、图片、链接和画板摘要。

yuque_list_docs

列出知识库中的所有文档。

技术栈:aiohttp + Playwright(可选渲染)+ BeautifulSoup4

快速开始

1. 安装

pip install yuque-mcp-tool

# 如果需要 Playwright 渲染功能(推荐)
python -m playwright install chromium

或者从源码安装:

git clone https://github.com/andy8663/yuque-mcp-tool.git
cd yuque-mcp-tool
pip install -e .

方法一:Application 面板(推荐)

  1. 登录 语雀

  2. F12 打开浏览器开发者工具

  3. 切换到 Application(应用)面板

  4. 左侧展开 Cookies → 点击 https://www.yuque.com

  5. 在 Cookie 列表中找到 _yuque_session,复制其 Value 列的值

方法二:Console 命令

  1. 登录 语雀

  2. F12 打开浏览器开发者工具

  3. Console 中输入:

    document.cookie.split('; ').find(c => c.startsWith('_yuque_session=')).split('=')[1]
  4. 复制输出的值

⚠️ 如果 _yuque_session 被标记为 HttpOnly,方法二将无法读取,请使用方法一。

Session Cookie 有效期约 30 天,过期后需重新获取。

3. 配置 MCP 客户端

根据你使用的客户端,选择对应的配置方式(见下方配置示例)。

配置示例

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows):

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

Cursor

编辑项目根目录下的 .cursor/mcp.json

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

WorkBuddy

在 WorkBuddy 的 MCP 配置文件中添加:

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

通用 MCP 客户端

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

如果未通过 pip install 安装,也可以使用 python -m yuque_mcp 作为 commandargs 留空。

环境变量

变量名

必填

默认值

说明

YUQUE_SESSION

语雀 Session Cookie(_yuque_session 的值)

YUQUE_HOST

https://www.yuque.com

默认语雀主机地址,用于补全短路径 URL

YUQUE_BROWSER_CHANNEL

Playwright 浏览器通道,如 chrome

YUQUE_CHROMIUM_EXECUTABLE

Chromium/Chrome 可执行文件的绝对路径

YUQUE_RENDER_MODE

auto

渲染模式:auto(自动)、off(关闭)、force(强制使用 Playwright)

常见问题

Session 无效 / 读取失败

重新登录语雀网站,获取新的 _yuque_session 值并更新配置。

Playwright 渲染失败

如果系统已安装 Chrome,可以设置 YUQUE_BROWSER_CHANNEL=chrome 以使用系统 Chrome,无需额外安装 Playwright 自带 Chromium。

Python 找不到

在配置中使用 Python 的完整路径作为 command,例如:

  • macOS: /usr/bin/python3

  • Windows: C:/Users/你的用户名/AppData/Local/Programs/Python/Python312/python.exe

团队/空间子域名

如果文档位于团队子域名下(如 ogtd9v.yuque.com),可以将 YUQUE_HOST 设为常用子域名;也可以直接传完整文档 URL,工具会从 URL 推导实际 host。

License

MIT License — 详见 LICENSE


Related MCP server: Yuque MCP Server

English Documentation

Features

Provides 3 MCP tools:

Tool

Description

yuque_read

Read a Yuque document and return the rendered text content.

yuque_read_markdown

Recommended. Read the Yuque Lake/API source content and convert it to readable Markdown, preserving tables, PlantUML/Mermaid diagrams, code blocks, images, links, and board summaries.

yuque_list_docs

List all documents in a Yuque knowledge base.

Tech stack: aiohttp + Playwright (optional rendering) + BeautifulSoup4

Quick Start

1. Installation

pip install yuque-mcp-tool

# If you need Playwright rendering (recommended)
python -m playwright install chromium

Or install from source:

git clone https://github.com/andy8663/yuque-mcp-tool.git
cd yuque-mcp-tool
pip install -e .

Method 1: Application Panel (Recommended)

  1. Log in to Yuque

  2. Press F12 to open browser DevTools

  3. Switch to the Application tab

  4. Expand Cookies in the left sidebar → click https://www.yuque.com

  5. Find _yuque_session in the cookie list and copy its Value

Method 2: Console Command

  1. Log in to Yuque

  2. Press F12 to open browser DevTools

  3. In the Console, run:

    document.cookie.split('; ').find(c => c.startsWith('_yuque_session=')).split('=')[1]
  4. Copy the output value

⚠️ If _yuque_session is marked as HttpOnly, Method 2 will not work — use Method 1 instead.

The session cookie is valid for approximately 30 days.

3. Configure Your MCP Client

Choose the configuration for your client below.

Configuration Examples

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

Cursor

Edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

WorkBuddy

Add to your WorkBuddy MCP configuration:

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

Generic MCP Client

{
  "mcpServers": {
    "yuque": {
      "command": "yuque-mcp",
      "env": {
        "YUQUE_SESSION": "YOUR_YUQUE_SESSION",
        "YUQUE_HOST": "https://www.yuque.com"
      }
    }
  }
}

If you haven't installed via pip install, you can use python -m yuque_mcp as the command instead.

Environment Variables

Variable

Required

Default

Description

YUQUE_SESSION

Yes

Yuque session cookie (_yuque_session value)

YUQUE_HOST

No

https://www.yuque.com

Default Yuque host for short-path URL completion

YUQUE_BROWSER_CHANNEL

No

Playwright browser channel, e.g. chrome

YUQUE_CHROMIUM_EXECUTABLE

No

Absolute path to a Chromium/Chrome executable

YUQUE_RENDER_MODE

No

auto

Rendering mode: auto, off, or force

FAQ

Invalid Session / Read Failure

Re-log in to Yuque, obtain a new _yuque_session value, and update your configuration.

Playwright Rendering Failure

If Chrome is installed on your system, set YUQUE_BROWSER_CHANNEL=chrome to use the system Chrome without installing Playwright's bundled Chromium.

Python Not Found

Use the full path to your Python executable as the command in your configuration:

  • macOS: /usr/bin/python3

  • Windows: C:/Users/your-username/AppData/Local/Programs/Python/Python312/python.exe

Team / Workspace Subdomains

If your documents are on a team subdomain (e.g. ogtd9v.yuque.com), set YUQUE_HOST to your common subdomain. You can also pass full document URLs directly — the tool derives the actual host from the URL.

License

MIT License — see LICENSE.

Available Tools

3 tools
yuque_list_docsB

List all documents in a Yuque repository

ParametersJSON Schema
NameRequiredDescriptionDefault
repo_slugYesThe repository slug or full repository URL (e.g., cc9c0g/rebell or https://example.yuque.com/cc9c0g/rebell)
hostNoOptional Yuque host to use when repo_slug is not a full URL

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must disclose behavior. It only mentions 'list all documents', failing to note that it's a read-only operation, any authentication needs, or potential pagination. No side effects or limitations are mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded with the action and resource. No redundancy, but might be too brief for complete understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, so the description should compensate by explaining return values (e.g., list of document titles, IDs). It doesn't. Also missing details on pagination, sorting, or filtering, which are common for list operations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds no additional meaning beyond what the schema already describes for repo_slug and host.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'list' and the resource 'documents' scoped to a 'Yuque repository', effectively distinguishing it from sibling tools that read individual documents.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like yuque_read or yuque_read_markdown. The description merely states what it does without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yuque_readA

Read a Yuque document by URL. Returns the full rendered content.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe Yuque document URL to read

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description indicates a read operation returning content, but does not explicitly state read-only nature, access requirements, or potential side effects. Given no annotations, description carries full burden; it is adequate but not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, no unnecessary words. Every sentence adds value: action, method, and return type. Highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool with one parameter and no output schema, the description adequately covers what it does and returns. Could mention error cases or format, but minimal gaps for this low complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Parameter schema has 100% coverage with a clear description. The tool description merely restates the parameter usage ('by URL') without adding new meaning beyond what the schema provides. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb ('Read') and resource ('Yuque document') and specifies return type ('full rendered content'). Differentiates from siblings by focusing on rendered content vs markdown (yuque_read_markdown) or listing (yuque_list_docs).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies when to use: when you have a document URL and want the full rendered content. Does not explicitly state when not to use or mention alternatives, but context of sibling tools provides some guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yuque_read_markdownA

Read a Yuque document by URL using Yuque Lake/API source content and convert it to readable Markdown with tables, PlantUML, Mermaid, code blocks, images, links, and board summaries.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe Yuque document URL to read
include_statsNoWhether to include Markdown conversion statistics

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It describes the read and conversion operation but does not explicitly state it is read-only, nor does it disclose auth needs, rate limits, or error behavior. Adequate but lacks safety disclaimers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that efficiently conveys the tool's functionality. It is concise and front-loaded, though it could be restructured for clarity by splitting into two sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (2 parameters, no output schema, no annotations), the description sufficiently covers the tool's purpose and output (specific Markdown elements). It is complete enough for an agent to understand what the tool does and when to use it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for both parameters. The description adds general context about the conversion but does not provide additional details beyond the schema, such as format or constraints for the parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it reads a Yuque document by URL and converts to Markdown with specific elements. It distinguishes from siblings: yuque_list_docs (listing) and yuque_read (likely raw reading), making the tool's specific purpose clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for converting Yuque documents to Markdown but does not explicitly state when to use this tool versus alternatives like yuque_read or yuque_list_docs, nor does it provide exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv1.0.0
    • First observedyuque_list_docs
    • First observedyuque_read
    • First observedyuque_read_markdown

TDQS

B3.2/5.0

Scored across 3 tools

Disambiguation4/5

The three tools are distinct: one lists documents, and two read documents in different formats. However, the two read tools have overlapping purposes (both read a document by URL), which could cause minor confusion.

Naming Consistency4/5

All tools share a 'yuque_' prefix and use verb_noun for most, but 'yuque_read' lacks a noun suffix, creating slight inconsistency with 'yuque_list_docs' and 'yuque_read_markdown'.

Tool Count2/5

With only 3 tools, the server is severely under-scoped for a platform like Yuque, which typically requires many more operations (create, update, delete, etc.).

Completeness1/5

The server only provides read and list functionality, missing essential CRUD operations. It is extremely incomplete for the Yuque domain.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers