Content
# Tool List
This repository provides two [MCP](https://modelcontextprotocol.io/):
- **Baidu Netdisk MCP**: Operate Baidu Netdisk
- **Xianyu MCP**: Operate Xianyu (goofish.com) webpage
Can be used in agents like Cursor / Claude / Grok with natural language.
| MCP | Directory | Function | Can be used alone |
|-----|------|------|----------------|
| **Baidu Netdisk MCP** | `baidu-netdisk-mcp/` | List directory, search, manage, capacity, share, etc. | ✅ Can be used alone |
| **Xianyu MCP** | `xianyu-mcp/` | Login, search market, draft, publish, manage in sale | ✅ **Can be used alone without Baidu Netdisk** |
The two MCPs do not depend on each other. If you only want to practice Xianyu publishing, you can just configure `xianyu-mcp`.
## ⚠️ Usage Notes (Please Read)
### 1. For Learning and Personal Automation Only
The code and documentation in this repository are **for learning exchange, technical verification, and personal automation only**.
- **Not** an official operational tool, and no long-term stability is guaranteed.
- Xianyu side uses **browser automation (Playwright)** to simulate webpage operations, which may fail due to page changes, risk control, or login state expiration.
- Please comply with [Baidu Netdisk Open Platform](https://pan.baidu.com/union/console/applist), Xianyu / Alibaba ecosystem user agreements, and local laws and regulations.
- **Prohibited** to use this project for harassment, bulk illegal listing, infringement of others' rights, or other illegal purposes.
- You are responsible for all consequences of using this project; the author and contributors do not bear any liability.
By downloading and using this repository, you indicate that you have read and agreed to the above instructions.
### 2. Automation-Related Boundaries
| Item | Description |
|----|------|
| Xianyu = Webpage Automation | Will launch a browser; Cookie exists in local `.cache/`, **do not submit to git** |
| Irreversible Publishing | `publish_item` will truly click "Publish", make sure to `draft_item` and check the screenshot before confirming |
| Daily Browser ≠ MCP Browser | Logging in to Xianyu on Chrome does not mean Playwright session is logged in |
| Netdisk = Open Platform API | Requires your own Access Token; permissions are based on your application and authorization |
| Frequency and Risk Control | Please control the call frequency to avoid triggering platform restrictions within a short time |
### 3. Keys and Privacy
- **All keys should only be placed in local `.env` or MCP configuration `env`, prohibited from submitting to git.**
- The repository provides `.env.example`; the actual file name is `.env` (ignored by `.gitignore`).
- **Do not** publicly disclose: Access Token, AppKey/SecretKey, Xianyu Cookie, personal netdisk directory export (e.g., `inventory/`).
- If a key has appeared in chat records or screenshots, please **rotate Token / reset key** before publicly releasing the repository.
## Repository Structure
```text
baidu-netdisk-xianyu/
├── baidu-netdisk-mcp/ # Baidu Netdisk MCP(stdio)
│ ├── server.py
│ └── pyproject.toml
├── xianyu-mcp/ # Xianyu MCP(stdio)
│ ├── server.py
│ ├── tools/
│ └── .env.example
├── scripts/ # Optional: local registration / verification scripts
├── docs/ # Detailed agent integration instructions
├── .env.example # Netdisk side environment variable template
├── .gitignore
└── README.md
```
## Environment Requirements
- macOS / Linux (Windows requires self-modification of paths)
- Python **3.12** (not recommended for 3.14)
- [uv](https://docs.astral.sh/uv/) (recommended)
- MCP-supported clients: Cursor / Claude Desktop / Grok, etc.
```bash
# Check
python3.12 --version
uv --version
```
## Solution A: Using Xianyu MCP Only (Recommended)
**No Baidu Netdisk or Access Token required.**
### 1. Install Dependencies
```bash
cd xianyu-mcp
uv sync
uv run playwright install chromium
```
### 2. Environment Variables (Optional)
Configure model keys for text/AI image generation when needed; **handwritten text + local image path can be used without keys**:
```bash
cp .env.example .env
# Edit as needed: AGENT_LLM_API_KEY, etc.
```
### 3. Connect to MCP Client (Cursor example)
`~/.cursor/mcp.json` or project `.cursor/mcp.json`:
```json
{
"mcpServers": {
"xianyu": {
"command": "uv",
"args": [
"--directory",
"/path/to/repo/xianyu-mcp",
"run",
"python",
"server.py"
],
"env": {
"PLAYWRIGHT_HEADLESS": "false",
"UV_PYTHON": "python3.12"
}
}
}
}
```
Grok example:
```bash
grok mcp add xianyu \
-e "PLAYWRIGHT_HEADLESS=false" \
-e "UV_PYTHON=python3.12" \
-- uv --directory /path/to/repo/xianyu-mcp run python server.py
```
### 4. Minimal Usage Flow
1. Let Agent call **`login`** → scan QR code in the **popped browser**
2. **`draft_item`**: `image` = local image absolute path, `description` = text, `price` = price
3. View returned draft screenshot
4. Confirm and then **`publish_item`** (real publishing, cautious)
5. **`get_selling_items`** to view items on sale
Common tools: `login` / `search_market` / `draft_item` / `publish_item` / `get_selling_items` / `manage_item` / `get_page_content` / `restart_browser`
See detailed instructions in [`xianyu-mcp/README.md`](xianyu-mcp/README.md).
## Solution B: Using Baidu Netdisk MCP Only
**No Xianyu required.**
### 1. Obtain Access Token
1. Open [Baidu Netdisk Open Platform · My Applications](https://pan.baidu.com/union/console/applist) to create an application
2. Complete OAuth authorization and copy `access_token` from the return URL
3. Write to project root directory `.env` (**do not submit**):
```bash
cp .env.example .env
# Edit:
# BAIDU_NETDISK_ACCESS_TOKEN=your token
```
> MCP uses **Access Token**, not App Key. App Key is only for authorization.
### 2. Install Baidu Netdisk MCP
```bash
cd baidu-netdisk-mcp
UV_PYTHON=python3.12 uv sync
```
### 3. Client Configuration Example
**Method 1: Official Remote SSE** (some clients support)
```json
{
"mcpServers": {
"baidu-netdisk": {
"url": "https://mcp-pan.baidu.com/sse?access_token=YourAccessToken"
}
}
}
```
**Method 2: Baidu Netdisk MCP (stdio)** (more stable for Grok, etc.)
```json
{
"mcpServers": {
"baidu-netdisk": {
"command": "uv",
"args": [
"--directory",
"/path/to/repo/baidu-netdisk-mcp",
"run",
"python",
"server.py"
],
"env": {
"BAIDU_NETDISK_ACCESS_TOKEN": "your token",
"UV_PYTHON": "python3.12"
}
}
}
}
```
Verification: Let Agent execute "check netdisk capacity" and "list root directory".
Baidu Netdisk MCP common tools: `user_info` / `get_quota` / `file_list` / `file_keyword_search` / file management / `file_sharelink_set`, etc.
See detailed instructions in [`docs/MCP_INTEGRATION_FOR_AGENTS.md`](docs/MCP_INTEGRATION_FOR_AGENTS.md).
## Solution C: Using Both MCPs (Optional)
Connect to netdisk to list directories → material falls to local path → then call Xianyu `draft_item` to publish.
**Xianyu uploading cover requires local file path or image URL**, generally cannot directly transmit netdisk `fs_id`.
Dialogue example:
```text
1. List /some directory with Baidu Netdisk MCP
2. Prepare cover image to ~/Desktop/cover.png (local path)
3. Xianyu login
4. draft_item(image=..., description=..., price=...)
5. Confirm screenshot and then publish_item
```
The two MCPs can be configured in parallel in the client, with custom names.
## Where to Put Keys
| Content | Where to put | Whether to enter git |
|------|------|------------|
| Baidu Access Token / AppKey / Secret | Project root `.env` or MCP `env` | ❌ No |
| Xianyu Cookie | `xianyu-mcp/.cache/` (generated automatically after running) | ❌ No |
| Template | `.env.example`, `xianyu-mcp/.env.example` | ✅ Yes |
| Personal netdisk export list | Local self-use, do not submit | ❌ No |
```bash
# Clone and
cp .env.example .env
cp xianyu-mcp/.env.example xianyu-mcp/.env
# Fill in only what you need
```
## FAQs
**Q: Do not want to connect Baidu, only publish Xianyu?**
A: Yes. Configure `xianyu-mcp` only and ignore `baidu-netdisk-mcp` and netdisk Token.
**Q: Do not want to connect Xianyu, only manage netdisk with Agent?**
A: Yes. Configure **Baidu Netdisk MCP** only (directory `baidu-netdisk-mcp/`).
**Q: Token / login always fails?**
A: Netdisk → re-authorize and change Token; Xianyu → scan QR code in Playwright pop-up window, or `restart_browser` and then `login`.
**Q: Official SSE handshake 405?**
A: Use **Baidu Netdisk MCP** stdio mode (directory `baidu-netdisk-mcp/`).
**Q: Python dependencies cannot be installed?**
A: Use 3.12: `UV_PYTHON=python3.12 uv sync`.
## Disclaimer (Summary)
This project is **for learning and personal automation research only**, and no operational guarantee is provided.
Users should ensure that their operations comply with platform rules and laws and regulations; any losses caused by abuse, violation, key leakage, or account ban are borne by the users themselves.
The `xianyu-mcp` in this repository **references and draws inspiration from** [FishClaw_MCP](https://github.com/TnoobT/FishClaw_MCP) (Xianyu Playwright automation MCP). When using Xianyu-related capabilities, please also read its upstream instructions and disclaimer; see [`xianyu-mcp/README.md`](xianyu-mcp/README.md) for details.
## References
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [Baidu Netdisk Open Platform · Application List](https://pan.baidu.com/union/console/applist)
- [Baidu Netdisk Official MCP Instructions (GitHub)](https://github.com/baidu-netdisk/mcp)
- [FishClaw_MCP](https://github.com/TnoobT/FishClaw_MCP) — Xianyu Automation MCP (`xianyu-mcp` reference source)
- This repository's Agent integration details: [`docs/MCP_INTEGRATION_FOR_AGENTS.md`](docs/MCP_INTEGRATION_FOR_AGENTS.md)
## License
[MIT](./LICENSE) © 2026 mousepotato
Please confirm you understand the "learning / personal automation" boundary before contributing code, and do not package this project into tools for illegal purposes.