小红书MCP

LarryGuan/xhs-mcp
2 Stars 676 次浏览 更新于 2026-08-23

该项目为小红书提供MCP(微服务控制面板)服务,包括搜索笔记、获取笔记内容和发表评论等功能。它使用JavaScript逆向解析出x-s和x-t,可以直接请求HTTP接口,无需使用笨重的Playwright等工具。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "xhs-mcp": {
      "args": [
        "--directory",
        "/Users/xxx/xhs-mcp",
        "run",
        "main.py"
      ],
      "command": "uv",
      "env": {
        "XHS_COOKIE": "xxxx"
      }
    }
  }
}

该服务需要配置环境变量:XHS_COOKIE

服务介绍

Xiaohongshu MCP Service

smithery badge

Features

  • Uses js to reverse-engineer x-s, x-t, and directly requests HTTP interfaces without the need for the cumbersome playwright.
  • Search for posts
  • Get post content
  • Get comments on a post
  • Post a comment

Features

Quick Start

1. Environment

  • node
  • python 3.12
  • uv (pip install uv)

2. Install Dependencies

sh
git clone git@github.com:jobsonlook/xhs-mcp.git
cd xhs-mcp
uv sync

Open Xiaohongshu Webpage
After logging in, obtain the cookie and configure it into the XHS_COOKIE environment variable as shown in step 4.
Cookie

4. Configure MCP Server

json
{
"mcpServers": {
"xhs-mcp": {
"command": "uv",
"args": [
"--directory",
"/Users/xxx/xhs-mcp",
"run",
"main.py"
],
"env": {
"XHS_COOKIE": "xxxx"
}
}
}
}

Disclaimer

This project is intended solely for learning and communication purposes. It is strictly prohibited from being used for any other purposes, especially those involving commercial profit. Any such use will be at your own risk.

相关 MCP 服务