自动化小红书MCP服务器
这是一个基于MCP的小红书内容创作和管理工具,可以帮助你自动化小红书内容平台的操作,包括搜索笔记、发布笔记、评论等功能。
功能特点
- 🔍 搜索小红书笔记内容
- 📝 发布图文/视频笔记
- 💬 自动评论笔记
- 🏠 获取首页推荐内容
- 🔐 支持账号登录与验证
快速开始
1. 环境要求
- node.js
- python 3.12
- uv (pip install uv)
2. 安装依赖
git clone https://github.com/fancyboi999/xhs-auto-mcp.git
cd xhs-auto-mcp
uv venv
source .venv/bin/activate
uv pip install -e .
3. 获取小红书的cookie
打开网页端小红书
登录后,获取内容平台的cookie,将cookie配置到MCP服务的 XHS_COOKIE 环境变量中
4. 配置MCP服务
有两种方式可以配置和启动MCP服务,环境变量JSON_PATH 是用于存储创作平台token与cookie,因此请填写绝对路径:
方式一:使用stdio协议(直接连接)
在Claude配置中添加以下内容:
{
"mcpServers": {
"xhs-auto-mcp": {
"command": "uvx",
"args": ["xhs-auto-mcp", "--transport", "stdio"],
"env": {
"XHS_COOKIE": "xxxx",
"JSON_PATH": "your_token_save_path"
}
}
}
}
方式二:使用HTTP协议
- 启动HTTP服务:
env XHS_COOKIE=xxxx JSON_PATH=your_token_save_path uvx xhs-auto-mcp --transport http --port 8080
- 在Claude配置中添加以下内容:
{
"mcpServers": {
"xhs-auto-mcp": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
}
工具使用说明
本项目提供了多种工具来操作小红书平台:
内容平台工具
- 检查cookie有效性: 验证当前cookie是否有效
- 获取首页推荐笔记: 获取小红书首页推荐内容
- 搜索笔记: 根据关键词搜索笔记
- 获取笔记内容: 获取指定笔记的详细内容
- 获取笔记评论: 获取指定笔记的评论
- 发表评论: 对指定笔记发表评论
创作平台工具
- 登录: 通过手机号和验证码登录小红书创作平台
- 发布图文笔记: 创建并发布包含图片的笔记
- 发布视频笔记: 创建并发布包含视频的笔记
示例视频
查看演示视频了解如何使用本工具:演示视频
免责声明
本项目仅用于学习交流,禁止用于其他用途,任何涉及商业盈利目的均不得使用,否则风险自负。
Metadata
Release files for xhs-auto-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| xhs_auto_mcp-0.1.1.tar.gz | 74.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xhs_auto_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 148.4 kB
Release files / xhs_auto_mcp-0.1.1.tar.gz
| Download URL | xhs_auto_mcp-0.1.1.tar.gz |
|---|---|
| Size | 74.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52116f3dceb9cde56826722d9043380ce864911d3f6e31fc2903363dbb797781
|
|
BLAKE2b-256 checksum How to use checksums |
8d57900184c7fd18583bcbbdfb8cbdd7d7c17271d35f2df6da5c48d4c3ca0961
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logRelease files / xhs_auto_mcp-0.1.1-py3-none-any.whl
| Download URL | xhs_auto_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 74.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96cf0c81f3e08972adee8abf8431c520c8ca7e9f41cfdc0f5dd53a6ea039c1f5
|
|
BLAKE2b-256 checksum How to use checksums |
ce1efabec76f4b4d0ee275c2533f1733743ff87c96b3a98dce8e665354509bba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logSecurity for xhs-auto-mcp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for xhs_auto_mcp-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.