Files
social-mcp/README.md
T

128 lines
2.1 KiB
Markdown

# Social Auto Hub (Monorepo)
[中文文档](./README.zh-CN.md)
This repository is now a **workspace monorepo** with clear visual separation:
- `apps/xhs-mcp`: Xiaohongshu MCP service (`xhs_*` tools)
- `apps/xhh-mcp`: Xiaoheihe MCP service (`xhh_*` tools)
- `packages/core`: shared infrastructure (`browser/config/cookie/server/utils`)
## Workspace Layout
```text
apps/
xhs-mcp/
xhh-mcp/
packages/
core/
```
## Quick Start
### Prerequisites
- Node.js >= 22
- pnpm
### Install
```bash
pnpm install
npx rebrowser-playwright install chromium
```
### Build all packages
```bash
pnpm build
```
### Run XHS service
```bash
pnpm start:xhs
```
Default runtime values:
- `PORT=9527`
- `COOKIE_DIR=~/.social-mcp-xhs`
### Run XHH service
```bash
pnpm start:xhh
```
Default runtime values:
- `PORT=9528`
- `COOKIE_DIR=~/.social-mcp-xhh`
## Compatibility Root Scripts
Root scripts are kept as forwarding wrappers:
- `pnpm build`
- `pnpm lint`
- `pnpm test`
- `pnpm start:xhs`
- `pnpm start:xhh`
- `pnpm dev:xhs`
- `pnpm dev:xhh`
You can also run package-level commands directly:
```bash
pnpm --filter @social/core build
pnpm --filter @social/xhs-mcp start
pnpm --filter @social/xhh-mcp start
```
## MCP Endpoints
- XHS MCP: `http://127.0.0.1:9527/mcp`
- XHH MCP: `http://127.0.0.1:9528/mcp`
## REST Endpoints
- XHS REST: `http://127.0.0.1:9527/api/xhs/*`
- XHH REST: `http://127.0.0.1:9528/api/xhh/*`
Each service uses its own bearer token file under its `COOKIE_DIR`.
## Claude Desktop Example
```json
{
"mcpServers": {
"mcp-xhs": {
"url": "http://127.0.0.1:9527/mcp"
},
"mcp-xhh": {
"url": "http://127.0.0.1:9528/mcp"
}
}
}
```
## Docker
Single Dockerfile supports dual app targets via build arg:
- `APP_NAME=xhs-mcp`
- `APP_NAME=xhh-mcp`
Compose files already define both services:
- `docker-compose.yml`
- `deploy/docker-compose.yml`
## Migration Notes
- Old root runtime entry (`src/index.ts`) is removed.
- Service code now lives inside `apps/*`.
- Shared runtime logic now lives inside `packages/core`.
- Lockfile strategy is pnpm-only (`pnpm-lock.yaml`).