README.md•4.06 kB
# Yuque MCP Server
🎉 **语雀MCP服务器**
A Model Context Protocol (MCP) server that provides seamless integration with Yuque (语雀), a popular Chinese documentation platform. Enables AI assistants to manage Yuque content through a standardized MCP interface.
## ✨ Features
### 📚 Knowledge Base Management
- List and create knowledge repositories
- Manage repository settings and visibility
### 📄 Document Operations
- Create, read, update, delete documents
- Support for Markdown, Lake, and HTML formats
- Advanced document search functionality
### 🔍 Search & Discovery
- Global and repository-specific search
- Intelligent query handling
## 📦 Installation
### Global Installation (Recommended)
```bash
npm install -g yuque-mcp-server
```
### Local Installation
```bash
npm install yuque-mcp-server
```
### From Source
```bash
git clone https://github.com/tanis2010/yuque-mcp-server.git
cd yuque-mcp-server
npm install
npm run build
npm link
```
## 🔧 Configuration
### 1. Get Your Yuque API Token
1. 登录语雀 (Log in to Yuque)
2. 进入:账户设置 → 开发者设置 → API Token
(Go to: Account Settings → Developer Settings → API Token)
3. 创建新的Token并复制 (Create new Token and copy it)
### 2. Set Environment Variable
```bash
export YUQUE_TOKEN="your_yuque_api_token_here"
```
## 🤖 Claude Code Integration
This MCP server is specifically designed to work with Claude Code. Here's the simplest way to set it up:
### 🚀 Quick Setup (Recommended)
Use the Claude Code CLI to automatically configure the MCP server:
```bash
# Install the package globally first
npm install -g yuque-mcp-server
# Add to Claude Code with automatic configuration
claude mcp add -s local yuque yuque-mcp-server --env YUQUE_TOKEN=your_yuque_api_token_here
```
That's it! The `claude mcp add` command will:
- Automatically configure the MCP server in your Claude Code settings
- Handle the environment variable securely
- Set up the proper command structure
### Manual Configuration (Alternative)
If you prefer manual configuration, you can edit `~/.claude/settings.json` directly:
```json
{
"mcpServers": {
"yuque": {
"command": "yuque-mcp-server",
"env": {
"YUQUE_TOKEN": "your_yuque_api_token_here"
}
}
}
}
```
### Local Development Setup
For development from source:
```json
{
"mcpServers": {
"yuque": {
"command": "node",
"args": ["path/to/yuque-mcp-server/dist/server.js"],
"env": {
"YUQUE_TOKEN": "your_yuque_api_token_here"
}
}
}
}
```
### Verify Installation
After setup, restart Claude Code and you should see these Yuque tools available:
- `yuque_get_user` - Get current user information
- `yuque_get_repos` - List knowledge repositories
- `yuque_get_docs` - List documents in a repository
- `yuque_get_doc` - Get document details
- `yuque_create_doc` - Create new document
- `yuque_update_doc` - Update existing document
- `yuque_delete_doc` - Delete document
- `yuque_search_docs` - Search documents
## API工具
该MCP服务器提供以下工具:
### yuque_get_user
获取当前用户信息
### yuque_get_repos
获取知识库列表
- `userId` (可选): 用户ID
### yuque_get_docs
获取文档列表
- `repoId` (必需): 知识库ID
- `limit` (可选): 返回数量限制
- `offset` (可选): 偏移量
### yuque_get_doc
获取文档详情
- `docId` (必需): 文档ID
### yuque_create_doc
创建新文档
- `repoId` (必需): 知识库ID
- `title` (必需): 文档标题
- `content` (必需): 文档内容
- `format` (可选): 文档格式 (markdown/lake/html)
### yuque_update_doc
更新文档
- `docId` (必需): 文档ID
- `title` (可选): 文档标题
- `content` (可选): 文档内容
- `format` (可选): 文档格式
### yuque_delete_doc
删除文档
- `docId` (必需): 文档ID
### yuque_search_docs
搜索文档
- `query` (必需): 搜索关键词
- `repoId` (可选): 知识库ID
## 开发
```bash
# 开发模式
npm run dev
# 构建
npm run build
```
## 许可证
MIT