Content
<p align="left">
English | <a href="./README.en.md">English</a>
</p>
<p align="center">
<img src="assets/icon.png" width="168" alt="Baidu Netdisk Knowledge MCP icon" />
</p>
<h1 align="center">Baidu Netdisk Knowledge MCP</h1>
<p align="center">
<strong>Baidu Netdisk Knowledge MCP</strong><br />
Let AI understand your Baidu Netdisk files, help you summarize, extract, categorize, and organize.
</p>
<p align="center">
<img alt="MCP server" src="https://img.shields.io/badge/MCP-server-0A66FF" />
<img alt="Baidu Netdisk" src="https://img.shields.io/badge/Baidu%20Netdisk-knowledge%20base-1677FF" />
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript&logoColor=white" />
<img alt="Tests" src="https://img.shields.io/badge/tests-32%20passing-brightgreen" />
<img alt="License" src="https://img.shields.io/badge/license-MIT-green" />
</p>
---
Many people's Baidu Netdisk accounts have a pile of files: PDFs, course materials, collected articles, project documents, e-books, notes, screenshots, and compressed packages. As the files accumulate, it becomes increasingly difficult to find, read, and organize them.
**Baidu Netdisk Knowledge MCP** aims to simplify this process by connecting Baidu Netdisk to AI clients that support MCP, allowing AI to safely read selected files, generate summaries, key points, to-do lists, tags, and organization suggestions.
This tool is suitable for you if you want to:
* Let AI help you read Baidu Netdisk files, such as PDFs, documents, notes, and course materials.
* Extract key points, questions, and action items from a collection of files.
* Organize Netdisk files into a personal knowledge base structure.
* Review organization plans before deciding whether to move files.
* Apply different processing rules to different files, such as course notes, paper reading, and book summaries.
## It's Not an Ordinary Netdisk Tool
This project is not a "upload/download API wrapper" or a new Netdisk client.
It's more like an **AI file assistant interface**:
1. You authorize Baidu Netdisk access via a QR code.
2. You instruct AI to search or browse files.
3. You select one or more files.
4. AI reads the content, generates notes, summaries, and organization suggestions.
5. If you want to organize files, AI provides a dry-run plan without making changes.
## A Typical Scenario
You can instruct AI as follows:
> Help me find MCP-related files in Baidu Netdisk, select the latest documents, read their content, summarize them into knowledge notes, and suggest which folder they should be placed in.
AI will:
* Search Baidu Netdisk files.
* Return a numbered file list.
* Generate a `selectionId` based on your selection.
* Download and parse selected files.
* Output structured notes and organization suggestions.
The output may include:
```json
{
"title": "MCP Getting Started Materials",
"category": "AI",
"tags": ["MCP", "Knowledge Management"],
"summary": "This set of materials introduces MCP tool invocation, context protocol, and client integration.",
"keyPoints": ["MCP allows AI to call external tools", "Suitable for building a personal knowledge base"],
"questions": ["Which clients support MCP?"],
"actionItems": ["Organize common MCP server list"],
"suggestedFolder": "/apps/Knowledge Base/AI/MCP"
}
```
## Core Features
| Capability | Description |
| --- | --- |
| QR Code Login | Generates Baidu OAuth authorization link, terminal QR code, and PNG QR code |
| File Selection | Supports search result numbering, path, `fs_id`, recursive directory, and file type filtering |
| Content Reading | Supports `.txt`, `.md`, `.json`, `.csv`, `.pdf`, `.docx` |
| Long Text Chunking | Splits long files into chunks to avoid overwhelming context |
| Knowledge Analysis | Summary, key points, questions, to-do lists, tags, value judgment, and suggested directory |
| Custom Skill | Write your own file processing templates using Markdown/YAML |
| Safe Organization | Only generates dry-run plans; actual moving/deleting requires confirmation |
| Audit Log | Write operation records to local JSONL log |
## Built-in Processing Templates
The project includes 5 built-in skills:
* `knowledge-notes`: Organizes scattered files into structured knowledge notes.
* `course-notes`: Organizes course materials, concepts, assignments, and review clues.
* `paper-reader`: Reads papers, extracts questions, methods, conclusions, and evidence.
* `book-summary`: Summarizes books, long articles, and reading materials.
* `cleanup-organizer`: Generates cleaning, archiving, and categorization suggestions.
You can also add your own Markdown/YAML skills without modifying the code.
## Security Principles
This project defaults to a conservative approach:
* Does not automatically move or delete Netdisk files.
* Organization tools only generate dry-run plans.
* Deleting files requires explicit `confirm: "DELETE"` transmission.
* Tokens are stored in the user's home directory, not in the project directory.
* Local file access is restricted to `BAIDU_LOCAL_ROOT`.
* Write operations are limited to `/apps/<appName>`.
## Suitable for
* Those who use Baidu Netdisk to store learning materials, papers, e-books, project documents.
* Those who want to turn Netdisk files into AI-readable knowledge bases.
* Those who want to let Codex, Claude Desktop, ChatGPT, and other MCP clients read Netdisk files.
* Those who want to manage personal knowledge but don't want to manually download, open, and copy files.
## Not Suitable for
* Those who want a complete Netdisk app with an interface.
* Those who only need ordinary upload, download, and synchronization functions.
* Those who don't want to configure Baidu Open Platform applications.
* Those who don't use MCP-supported AI clients.
## Quick Start
Clone the repository and install dependencies:
```bash
git clone https://github.com/capwitf/baidu-netdisk-knowledge-mcp.git
cd baidu-netdisk-knowledge-mcp
npm install
npm run build
```
Prepare Baidu Open Platform configuration:
```bash
BAIDU_APP_KEY=Your AppKey
BAIDU_SECRET_KEY=Your SecretKey
```
Start locally:
```bash
node dist/cli.js
```
## MCP Client Configuration
Replace the path with your local repository path:
```json
{
"mcpServers": {
"baidu-netdisk-knowledge": {
"command": "node",
"args": ["C:/path/to/baidu-netdisk-knowledge-mcp/dist/cli.js"],
"env": {
"BAIDU_APP_KEY": "Your AppKey",
"BAIDU_SECRET_KEY": "Your SecretKey",
"BAIDU_REDIRECT_URI": "oob",
"BAIDU_LOCAL_ROOT": "C:/path/to/baidu-netdisk-knowledge-mcp"
}
}
}
}
```
## First-Time Authorization
1. Open [Baidu Netdisk Open Platform](https://pan.baidu.com/union/home) and create an application.
2. Record the application's `AppKey` and `SecretKey`.
3. Call `baidu_auth_qrcode` in the MCP client.
4. Scan the QR code to authorize, then transmit the callback `code` to `baidu_auth_exchange_code`.
5. Subsequent tokens will be automatically saved and refreshed.
## Common Workflows
Searching for files:
```json
{
"tool": "baidu_search_selectable_files",
"args": {
"key": "MCP",
"dir": "/apps/Knowledge Base",
"recursion": true
}
}
```
Selecting files by number:
```json
{
"tool": "baidu_select_files",
"args": {
"resultId": "res_xxx",
"select": "1,3,5-9"
}
}
```
Reading and analyzing:
```json
{ "tool": "baidu_read_selection", "args": { "selectionId": "sel_xxx" } }
{ "tool": "baidu_analyze_selection", "args": { "selectionId": "sel_xxx" } }
{ "tool": "baidu_run_skill", "args": { "selectionId": "sel_xxx", "skill": "knowledge-notes" } }
```
Generating organization plans:
```json
{
"tool": "baidu_plan_organize_selection",
"args": {
"selectionId": "sel_xxx",
"targetRoot": "/apps/Knowledge Base"
}
}
```
`baidu_plan_organize_selection` only returns plans, without moving files. When `BAIDU_STRICT_APP_PATHS=true`, `targetRoot` must be under `/apps/<appName>`.
## Tool List
<details>
<summary>Authorization Tools</summary>
* `baidu_auth_status`
* `baidu_auth_url`
* `baidu_auth_qrcode_url`
* `baidu_auth_qrcode`
* `baidu_auth_exchange_code`
* `baidu_auth_refresh`
</details>
<details>
<summary>Browse and Select Tools</summary>
* `baidu_quota`
* `baidu_list_files`
* `baidu_list_all_files`
* `baidu_search_files`
* `baidu_search_selectable_files`
* `baidu_list_selectable_files`
* `baidu_select_files`
* `baidu_file_metas`
</details>
<details>
<summary>Knowledge Base Tools</summary>
* `baidu_read_selection`
* `baidu_analyze_selection`
* `baidu_list_skills`
* `baidu_run_skill`
* `baidu_plan_organize_selection`
</details>
<details>
<summary>File Operation Tools</summary>
* `baidu_create_folder`
* `baidu_rename_file`
* `baidu_copy_file`
* `baidu_move_file`
* `baidu_delete_file`
* `baidu_upload_file`
* `baidu_download_file`
* `baidu_operation_log`
</details>
## Custom Skills
Place `.md`, `.markdown`, `.yaml`, or `.yml` files in the directory pointed to by `BAIDU_SKILLS_DIR`.
Markdown example:
```markdown
---
name: my-research-note
description: Research note extractor
category: research
outputSchema: knowledge-note
---
Extract thesis, evidence, questions, and follow-up tasks.
```
Then use:
* `baidu_list_skills` to view available skills
* `baidu_run_skill` to run a specified skill
## Configuration Items
`.env.example` lists common configurations:
| Variable | Description | Default Value |
| --- | --- | --- |
| `BAIDU_APP_KEY` | Baidu Open Platform AppKey | Required |
| `BAIDU_SECRET_KEY` | Baidu Open Platform SecretKey | Required |
| `BAIDU_REDIRECT_URI` | OAuth callback address | `oob` |
| `BAIDU_SCOPE` | OAuth scope | `basic,netdisk` |
| `BAIDU_TOKEN_STORE` | Token file | `~/.baidu-netdisk-mcp/tokens.json` |
| `BAIDU_OPERATION_LOG` | Write operation audit log | `~/.baidu-netdisk-mcp/operations.jsonl` |
| `BAIDU_SELECTION_STORE` | SelectionId storage | `~/.baidu-netdisk-mcp/selections.json` |
| `BAIDU_CACHE_ROOT` | Local cache | `~/.baidu-netdisk-mcp/cache` |
| `BAIDU_SKILLS_DIR` | Custom skill directory | `~/.baidu-netdisk-mcp/skills` |
| `BAIDU_LOCAL_ROOT` | Local file access root directory | Startup directory |
| `BAIDU_STRICT_APP_PATHS` | Write operation restricted to `/apps/<appName>` | `true` |
| `BAIDU_UPLOAD_CHUNK_SIZE_BYTES` | Upload chunk size | `4194304` |
| `BAIDU_TRANSFER_MAX_RETRIES` | Upload/download retry times | `3` |
## Development
```bash
npm run check
```
This command runs TypeScript compilation and Vitest tests.
## Related Keywords
`Baidu Netdisk MCP`, `Baidu Netdisk Knowledge MCP`, `Baidu Netdisk Knowledge Base`, `AI Knowledge Base`, `MCP server`, `Personal Knowledge Management`, `AI File Organization`, `Knowledge Base MCP`
## References
* [Baidu Netdisk Authorization Introduction](https://pan.baidu.com/union/doc/ol0rsap9s)
* [Get File List](https://pan.baidu.com/union/doc/nksg0sat9)
* [Query File Information](https://pan.baidu.com/union/doc/Fksg0sbcm)
* [Download](https://pan.baidu.com/union/doc/pkuo3snyp)
* [Upload Capability Description](https://pan.baidu.com/union/doc/3ksg0s9ye)
* [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
## License
MIT
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available