diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..8ecc6f6 --- /dev/null +++ b/README.en.md @@ -0,0 +1,160 @@ +# rednote-mcp — Xiaohongshu (小红书 / REDNOTE) MCP server (Node.js) + +[![npm](https://img.shields.io/npm/v/@sykuang/rednote-mcp.svg)](https://www.npmjs.com/package/@sykuang/rednote-mcp) + +[繁體中文](./README.md) | English + +**Xiaohongshu / rednote / 小红书 MCP server** that lets Claude Desktop, Cursor, Codex and any other MCP/AI agent search, read, comment, like and publish notes on rednote.com (Xiaohongshu's overseas site) through natural language. + +This project is the **Node.js + TypeScript + Playwright port** of [xpzouying/xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) (Go, targets the China site xiaohongshu.com), targeting **rednote.com** (overseas REDNOTE) and installable directly via `npx` — no compilation required. + +**Keywords**: xiaohongshu mcp · rednote mcp · xiaohongshu-mcp · 小红书 mcp · Claude Desktop · Cursor · AI agent · MCP server + +## Features + +Provides 13 MCP tools: + +| Tool | Description | +|------|-------------| +| `check_login_status` | Check login status | +| `get_login_qrcode` | Get login QR code | +| `delete_cookies` | Delete cookies and reset login | +| `list_feeds` | Fetch home feeds | +| `search_feeds` | Search notes (with filters) | +| `get_feed_detail` | Fetch note detail + comments | +| `user_profile` | Fetch a user's profile page | +| `post_comment_to_feed` | Post a comment | +| `reply_comment_in_feed` | Reply to a comment | +| `like_feed` / `favorite_feed` | Like / favorite | +| `publish_content` | Publish image post | +| `publish_with_video` | Publish video post | + +It also exposes an HTTP API (`/api/v1/*`) and MCP Streamable HTTP (`/mcp`). + +## Installation + +### Option 1: Run with npx (recommended) + +```bash +# stdio mode (for MCP clients) +npx -y @sykuang/rednote-mcp --stdio + +# HTTP mode +npx -y @sykuang/rednote-mcp --port :18060 + +# All options +npx -y @sykuang/rednote-mcp --help +``` + +The first run will automatically download Chromium (~170MB, one-time). + +#### Claude Desktop / Cursor config example + +```json +{ + "mcpServers": { + "rednote": { + "command": "npx", + "args": ["-y", "@sykuang/rednote-mcp", "--stdio"] + } + } +} +``` + +### Option 2: Global install + +```bash +npm install -g @sykuang/rednote-mcp +rednote-mcp --stdio +``` + +### Option 3: From source + +```bash +git clone https://github.com/sykuang/rednote-mcp.git +cd rednote-mcp +npm install +npm run build +node dist/main.js --stdio +``` + +## Usage + +HTTP mode (defaults to `:18060`): + +```bash +npx @sykuang/rednote-mcp --port :18060 +# or from source: node dist/main.js --port :18060 +``` + +stdio mode (for Claude Desktop / Cursor and other MCP clients): + +```bash +npx @sykuang/rednote-mcp --stdio +# or +MCP_STDIO=1 node dist/main.js +``` + +CLI flags: +- `--headless` true/false (default: true) +- `--bin /path/to/chromium` (or use the `ROD_BROWSER_BIN` env var) +- `--port :18060` +- `--stdio` + +Environment variables: +- `MCP_STDIO=1` — enable stdio mode +- `ROD_BROWSER_BIN` — path to a Chromium executable +- `COOKIES_PATH` — cookies file path (falls back to `/tmp/cookies.json`, then `./cookies.json`) +- `XHS_PROXY` — HTTP/HTTPS proxy URL + +## Development + +```bash +npm run dev # run with tsx +npm run build # compile to dist/ +npm run format # prettier +npm run lint # tsc --noEmit +``` + +## Docker + +### Use the prebuilt image (GHCR) + +```bash +docker run -d --name rednote-mcp \ + -p 18060:18060 \ + -v $(pwd)/cookies.json:/app/cookies.json \ + --shm-size=1g \ + ghcr.io/sykuang/rednote-mcp:latest +``` + +### docker compose + +```bash +# After obtaining cookies.json (see the login flow below), start with: +docker compose up -d +docker compose logs -f +``` + +The bundled `docker-compose.yml` includes: +- Prebuilt GHCR image (`ghcr.io/sykuang/rednote-mcp:latest`) +- Persistent `cookies.json` mount +- `shm_size: 1gb` (required by Chromium subprocess) + +### Build from source + +```bash +docker build -t rednote-mcp-node . +docker run -p 18060:18060 -v $(pwd)/cookies.json:/app/cookies.json rednote-mcp-node +``` + +## Differences from the Go version + +This project is a port of [xpzouying/xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) (Xiaohongshu China site, written in Go) targeting the **overseas REDNOTE site**: + +- **Target site**: original targets `xiaohongshu.com` (China); this port targets `rednote.com` (overseas) +- **Language**: Go → **Node.js / TypeScript** (no compilation needed for `npx` users, cross-platform) +- Uses **Playwright** in place of go-rod; XHR interception via `page.on('response')` instead of CDP +- HTTP framework: **Fastify** instead of Gin +- MCP via the official **`@modelcontextprotocol/sdk`** +- Business logic, HTTP endpoints and MCP tool schemas remain aligned with the original diff --git a/README.md b/README.md index 3979ea3..af73ff2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ -# rednote-mcp (Node.js) +# rednote-mcp — Xiaohongshu (小红书 / REDNOTE) MCP server (Node.js) [![npm](https://img.shields.io/npm/v/@sykuang/rednote-mcp.svg)](https://www.npmjs.com/package/@sykuang/rednote-mcp) -rednote.com(小紅書海外版 / REDNOTE)MCP server。 +繁體中文 | [English](./README.en.md) -本專案為 [xpzouying/xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) 的**海外版(REDNOTE)實作**,改用 Node.js + TypeScript + Playwright,方便使用者透過 `npx` 直接安裝使用,無需自行編譯。 +**小紅書 / rednote / REDNOTE MCP server**,讓 Claude Desktop、Cursor、Codex 等 MCP/AI agent 透過自然語言搜尋、瀏覽、留言、按讚與發布筆記。 + +本專案為 [xpzouying/xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp)(Go 版,目標中國站 xiaohongshu.com)的 **Node.js + TypeScript + Playwright 海外版(rednote.com)port**,可直接 `npx` 安裝使用,無需自行編譯。 + +**關鍵字**:xiaohongshu mcp · rednote mcp · 小红书 mcp · xiaohongshu-mcp · Claude Desktop · Cursor · AI agent · MCP server ## 功能 diff --git a/package.json b/package.json index 370946e..0312847 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@sykuang/rednote-mcp", "version": "1.0.0", - "description": "rednote.com (xiaohongshu overseas) MCP server + HTTP API, Node.js port of rednote-mcp-go", + "description": "Xiaohongshu (rednote / 小红书) MCP server for Claude Desktop, Cursor and AI agents — search, read, comment, like and publish notes via npx. Node.js + Playwright port of xiaohongshu-mcp.", "license": "MIT", "type": "module", "main": "dist/main.js", @@ -11,6 +11,7 @@ "files": [ "dist", "README.md", + "README.en.md", "LICENSE" ], "publishConfig": { @@ -21,12 +22,25 @@ }, "keywords": [ "rednote", + "rednote-mcp", "xiaohongshu", + "xiaohongshu-mcp", "xhs", + "小红书", "mcp", + "mcp-server", "model-context-protocol", - "playwright" + "claude", + "claude-desktop", + "cursor", + "ai-agent", + "playwright", + "npx" ], + "homepage": "https://github.com/sykuang/rednote-mcp#readme", + "bugs": { + "url": "https://github.com/sykuang/rednote-mcp/issues" + }, "repository": { "type": "git", "url": "git+https://github.com/sykuang/rednote-mcp.git"