Content
# Xiaohongshu API MCP Server | 小红书 API 微服务
This is a microservice that wraps the Xiaohongshu API into a RESTful API server. It can be deployed using Docker.
## Features
- RESTful API for Xiaohongshu operations | 小红书操作的 RESTful API
- Multiple client support | 支持多客户端
- Docker containerization | Docker 容器化
- Easy to deploy and scale | 易于部署和扩展
## API Endpoints
The server provides the following endpoints:
- `/clients` - Create and manage Xiaohongshu client instances
- `/clients/{client_id}/note` - Get note by ID
- `/clients/{client_id}/note/html` - Get note from HTML by ID
- `/clients/{client_id}/search/notes` - Search notes by keyword
- `/clients/{client_id}/search/users` - Search users by keyword
- `/clients/{client_id}/user/info` - Get user information by ID
- `/clients/{client_id}/user/notes` - Get user notes
- `/clients/{client_id}/feed/categories` - Get recommended feed categories
- `/clients/{client_id}/feed/{feed_type}` - Get recommended feed by type
- `/health` - Health check endpoint
## Project Structure
```
.
├── xhs_mcp_server/ # Main server directory
│ ├── app/ # Core application
│ ├── xhs/ # Xiaohongshu API module
│ ├── Dockerfile # Docker build file
│ └── requirements.txt # Python dependencies
└── xhs_api.py # API implementation
```
## Quick Start
### Prerequisites
- Docker
- Docker Compose
### Installation and Running
1. Build and start the Docker container:
```bash
cd xhs_mcp_server
docker-compose up -d
```
The service will run at `http://localhost:8000`.
2. Run directly with Python:
```bash
pip install -r xhs_mcp_server/requirements.txt
python xhs_api.py
```
### API Documentation
Once the server is running, you can access the API documentation at:
- Swagger UI: `http://localhost:8000/docs`
- ReDoc: `http://localhost:8000/redoc`
## Usage Examples
1. Create a client:
```bash
curl -X POST "http://localhost:8000/clients" \
-H "Content-Type: application/json" \
-d '{"cookie": "your_cookie_here"}'
```
2. Get note by ID:
```bash
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"}'
```
## License
This project is for educational purposes only. Use at your own risk.
You Might Also Like
OpenWebUI
Open WebUI is an extensible web interface for customizable applications.

NextChat
NextChat is a light and fast AI assistant supporting Claude, DeepSeek, GPT4...

cherry-studio
Cherry Studio is a multilingual project for creative collaboration.

LibreChat
LibreChat is an open-source chat platform for seamless communication.

Continue
Continue is an open-source project for seamless server management.

repomix
Repomix packages your codebase into AI-friendly formats for easy use.