Xiaohongshu API MCP Server | 小红书 API 微服务
About
Xiaohongshu API MCP Server is a microservice that wraps Xiaohongshu (Little Red Book) API into a RESTful API server, deployable via Docker. It is intended for developers who need programmatic access to Xiaohongshu data.
Details
- Author
- proerror77
- GitHub stars
- 18
- Downloads
- 517
- Categories
- AI
Jump to
- RESTful API for Xiaohongshu operations
- Multiple client instance support
- Docker containerization for easy deployment
- Endpoints for notes, users, search, feeds, and health check
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Xiaohongshu API MCP Server | 小红书 API 微服务Command (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Build and start the Docker container with docker-compose up -d in the xhs_mcp_server directory, then access the service at http://localhost:8000. Alternatively, run directly with Python after installing dependencies from requirements.txt and executing python xhs_api.py. API documentation is available at /docs (Swagger) or /redoc.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"xiaohongshu api mcp server | \u5c0f\u7ea2\u4e66 api \u5fae\u670d\u52a1": {
"xhs_mcp_agent": {
"command": "python",
"args": [
"xhs_api.py"
]
}
}
}
}
McpServers
{
"xhs_mcp_agent": {
"command": "python",
"args": [
"xhs_api.py"
]
}
}
Xiaohongshu API MCP Server | 小红书 API 微服务
这是一个将小红书 API 封装成 RESTful API 服务器的微服务。可以使用 Docker 进行部署。
功能特点
- RESTful API for Xiaohongshu operations | 小红书操作的 RESTful API
- Multiple client support | 支持多客户端
- Docker containerization | Docker 容器化
- Easy to deploy and scale | 易于部署和扩展
API 端点
服务器提供以下端点:
- /clients - 创建和管理小红书客户端实例
- /clients/{client_id}/note - 通过 ID 获取笔记
- /clients/{client_id}/note/html - 从 HTML 通过 ID 获取笔记
- /clients/{client_id}/search/notes - 通过关键词搜索笔记
- /clients/{client_id}/search/users - 通过关键词搜索用户
- /clients/{client_id}/user/info - 通过 ID 获取用户信息
- /clients/{client_id}/user/notes - 获取用户笔记
- /clients/{client_id}/feed/categories - 获取推荐流分类
- /clients/{client_id}/feed/{feed_type} - 通过类型获取推荐流
- /health - 健康检查端点
项目结构
.
├── xhs_mcp_server/ # 主服务器目录
│ ├── app/ # 应用程序核心
│ ├── xhs/ # 小红书API模块
│ ├── Dockerfile # Docker构建文件
│ └── requirements.txt # Python依赖
└── xhs_api.py # API实现
快速开始
前提条件
- Docker
- Docker Compose
安装和运行
1. 构建并启动 Docker 容器:
cd xhs_mcp_server
docker-compose up -d
服务将在 http://localhost:8000 运行。
2. 通过Python直接运行:
pip install -r xhs_mcp_server/requirements.txt
python xhs_api.py
API 文档
服务器运行后,您可以在以下位置访问 API 文档:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
使用示例
1. 创建客户端:
curl -X POST "http://localhost:8000/clients" \
-H "Content-Type: application/json" \
-d '{"cookie": "your_cookie_here"}'
2. 通过 ID 获取笔记:
curl -X POST "http://localhost:8000/clients/client_1/note" \
-H "Content-Type: application/json" \
-d '{"note_id": "your_note_id", "xsec_token": "your_xsec_token"}'
许可证
本项目仅用于教育目的。使用风险自负。
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
