Xiaohongshu MCP Server
Provides tools for automating Xiaohongshu (Little Red Book) operations including account login via QR code scanning, login status checking, and publishing image-text content to the platform.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Xiaohongshu MCP Serverpost a photo of my new coffee setup with the caption 'Morning brew perfection ☕️'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
小红书 MCP Python 项目
这是一个基于 Model Context Protocol (MCP) 的小红书自动化工具,提供登录、状态检查和内容发布功能。
功能特性
登录功能 - 支持扫码登录小红书账号
状态检查 - 快速检查当前登录状态
内容发布 - 自动发布图文内容到小红书
MCP 集成 - 完整的 MCP 服务器实现,可与 AI 客户端(例如 Cursor、Claude Code、Codex)集成
Related MCP server: XiaoHongShu MCP
安装要求
Python >= 3.10
已安装 Chrome 浏览器
uv 包管理器(推荐)
快速开始
安装依赖
# 使用 uv 安装(推荐)
uv sync
# 或使用 pip
pip install -e .安装 Playwright 浏览器
uv run playwright install chromium最简单启动(开发模式)
uv run mcp dev src/xiaohongshu_mcp/server.py等价的生产脚本启动方式:
uv run xiaohongshu-mcp-server使用方式
方式一:独立命令行工具
1. 登录小红书
# 使用有界面模式登录(推荐)
uv run xiaohongshu-login
# 使用无头模式登录
uv run xiaohongshu-login --headless2. 检查登录状态
uv run xiaohongshu-status3. 发布内容
uv run xiaohongshu-publish \
--title "我的标题" \
--content "这是正文内容" \
--images "image1.jpg" "image2.png"方式二:MCP 服务器
启动 MCP 服务器,可与支持 MCP 协议的 AI 客户端(例如 Cursor、Claude Code、Codex)集成:
# 启动开发模式 MCP 服务器
uv run mcp dev src/xiaohongshu_mcp/server.py
# 或使用脚本启动
uv run xiaohongshu-mcp-serverMCP 工具说明
服务器提供三个 MCP 工具:
xiaohongshu_login - 登录小红书账号
headless: bool - 是否使用无头模式(默认:False)
chrome_path: str - Chrome 路径(可选)
xiaohongshu_check_status - 检查登录状态
headless: bool - 是否使用无头模式(默认:True)
chrome_path: str - Chrome 路径(可选)
xiaohongshu_publish - 发布内容
title: str - 标题(必填,<=40字符)
content: str - 正文内容(必填)
image_paths: List[str] - 图片路径列表(必填)
headless: bool - 是否使用无头模式(默认:False)
chrome_path: str - Chrome 路径(可选)
配置说明
登录状态保存
登录状态通过 cookies 保存在:
~/.xiaohongshu_mcp/cookies.json日志配置
MCP 服务器日志保存在:
logs/mcp_server.log支持的图片格式
JPG/JPEG
PNG
GIF
WebP
项目结构
src/xiaohongshu_mcp/
├── browser/ # 浏览器管理模块
│ ├── cookies.py # Cookie 管理
│ └── driver.py # 浏览器驱动
├── xiaohongshu/ # 小红书功能模块
│ ├── login.py # 登录功能
│ └── publish.py # 发布功能
├── server.py # MCP 服务器
├── login.py # 登录命令行工具
├── check_status.py # 状态检查工具
└── publish.py # 发布命令行工具注意事项
发布功能建议使用有界面模式,便于观察发布过程
首次使用需要扫码登录
图片文件必须存在且格式正确
标题长度不能超过 40 个字符
故障排除
常见问题
登录失败
确保网络连接正常
尝试清除 cookies 后重新登录
检查 Chrome 浏览器是否正常安装
发布失败
确认已登录状态
检查图片文件路径和格式
验证标题和内容长度
MCP 服务器启动失败
确保安装了 mcp[cli] 依赖
检查日志文件查看详细错误信息
技术栈
Python 3.10+ - 主要开发语言
Playwright - 浏览器自动化
MCP Python SDK - Model Context Protocol 支持
Loguru - 日志管理
Pydantic - 数据验证
uv - 包管理器
许可证
本项目基于 MIT 许可证开源。
Available Tools
3 toolsxiaohongshu_check_statusC
检查小红书登录状态
Args: headless: 是否使用无头模式,默认True(状态检查可使用无头模式) chrome_path: Chrome浏览器可执行文件路径,可选
Returns: 登录状态信息
| Name | Required | Description | Default |
|---|---|---|---|
| chrome_path | No | ||
| headless | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It implies a read-only operation (checking status) but doesn't disclose behavioral traits such as whether it requires prior login, potential rate limits, error handling, or what specific information is returned. The mention of headless mode adds some context but is insufficient for a mutation-sensitive tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the main purpose first, followed by parameter and return sections. It avoids unnecessary verbosity, though the structure could be slightly improved by integrating parameter notes more seamlessly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, no annotations), the description is somewhat complete but has gaps. It covers the purpose and parameters but lacks usage guidelines and detailed behavioral context. The presence of an output schema reduces the need to explain return values, but more context on tool interaction is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds meaning for both parameters: 'headless' is explained as whether to use headless mode with a default and usage note, and 'chrome_path' is noted as optional. However, it doesn't fully detail parameter constraints or examples, leaving gaps.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as '检查小红书登录状态' (check Xiaohongshu login status), which is a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like 'xiaohongshu_login' (which likely performs login) or 'xiaohongshu_publish' (which likely publishes content), though the function is reasonably distinct by name.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'xiaohongshu_login' for logging in or 'xiaohongshu_publish' for publishing. It mentions that headless mode can be used for status checks, but this is more of a parameter hint than usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
xiaohongshu_loginC
登录小红书账号
Args: headless: 是否使用无头模式,默认False(建议使用有界面模式进行扫码) chrome_path: Chrome浏览器可执行文件路径,可选
Returns: 登录结果消息
| Name | Required | Description | Default |
|---|---|---|---|
| chrome_path | No | ||
| headless | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions logging in and implies browser automation (via headless mode and Chrome path), but lacks critical details: what authentication method is used (e.g., QR code scanning as hinted, password input), whether it requires user interaction, potential side effects (e.g., session creation, cookies), error handling, or rate limits. This is a significant gap for a login tool with zero annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the main purpose first, followed by parameter details. It uses minimal sentences that earn their place by explaining the tool and parameters. However, the structure could be slightly improved by integrating the parameter explanations more seamlessly, but it remains efficient with zero waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (login operation with browser automation), no annotations, and an output schema exists (implied by 'Returns: 登录结果消息'), the description is partially complete. It covers the basic purpose and parameters but lacks behavioral context (e.g., how login works, session management) and doesn't leverage the output schema to explain return values. For a tool with 2 parameters and no annotations, it should do more to be fully helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds meaning for both parameters: 'headless' is explained as controlling headless mode with a default and suggestion, and 'chrome_path' as an optional Chrome executable path. However, it doesn't cover parameter interactions (e.g., if headless=true affects chrome_path usage) or provide examples, leaving some ambiguity. With 2 parameters partially documented, this meets the baseline for low coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as '登录小红书账号' (login to Xiaohongshu account), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'xiaohongshu_check_status' (which likely checks login status) or 'xiaohongshu_publish' (which likely posts content), though the login function is reasonably distinct by nature.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether an account is needed), when to use it relative to siblings (e.g., login before publishing), or any exclusions. The only contextual note is a suggestion for headless mode, which is parameter-specific, not usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
xiaohongshu_publishC
发布小红书内容
Args: title: 标题(必填,不超过40个字符) content: 正文内容(必填) image_paths: 图片路径列表(必填,支持jpg/jpeg/png/gif/webp格式) headless: 是否使用无头模式,默认False(建议使用有界面模式观察发布过程) chrome_path: Chrome浏览器可执行文件路径,可选
Returns: 发布结果消息
| Name | Required | Description | Default |
|---|---|---|---|
| chrome_path | No | ||
| content | Yes | ||
| headless | No | ||
| image_paths | Yes | ||
| title | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool publishes content and suggests using interface mode for observation, but lacks critical behavioral details: authentication requirements, error handling, rate limits, whether it's idempotent, or what happens on failure. The description doesn't contradict annotations (none exist), but provides minimal behavioral context for a publishing operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections for Args and Returns, and each sentence adds value. The Chinese text is concise and to the point. However, the single-line purpose statement could be slightly more descriptive, and the parameter explanations could be more efficiently integrated rather than listed separately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a content publishing tool with 5 parameters, 0% schema coverage, no annotations, but with an output schema, the description provides basic operational context but lacks important details. The output schema handles return values, but the description doesn't cover authentication requirements, error conditions, or how this tool relates to its siblings. It's minimally adequate but has clear gaps for a publishing operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description adds meaningful parameter context: it clarifies that 'title' is required and has a 40-character limit, 'content' and 'image_paths' are required, image formats supported, and provides guidance on 'headless' mode. However, it doesn't fully compensate for the schema gap - 'chrome_path' gets minimal explanation, and there's no detail on parameter interactions or validation rules beyond basic requirements.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as '发布小红书内容' (publish Xiaohongshu content), which is a specific verb+resource combination. It distinguishes itself from sibling tools like 'xiaohongshu_check_status' and 'xiaohongshu_login' by focusing on content publishing rather than status checking or authentication. However, it doesn't explicitly mention how it differs from those siblings beyond the basic function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings. While it mentions '建议使用有界面模式观察发布过程' (suggest using interface mode to observe the publishing process), this is a technical implementation detail rather than usage context. There's no mention of prerequisites (e.g., whether login is required first) or alternatives for different publishing scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose: check_status verifies login state, login performs authentication, and publish creates content. There is no overlap in functionality, and the descriptions clearly differentiate their roles in the Xiaohongshu workflow.
All tools follow a consistent 'xiaohongshu_verb' pattern with snake_case naming: xiaohongshu_check_status, xiaohongshu_login, and xiaohongshu_publish. This uniformity makes the tool set predictable and easy to understand.
With only 3 tools, the server feels thin for a social media platform like Xiaohongshu. It covers basic login and posting but lacks essential operations such as reading, updating, deleting content, or interacting with other users, limiting its utility for comprehensive agent workflows.
The tool set is severely incomplete for the Xiaohongshu domain. It only supports login and publishing, missing core CRUD operations like retrieving posts, editing content, deleting posts, browsing feeds, or managing interactions (e.g., likes, comments). This will cause significant agent failures in typical social media tasks.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
搜索笔记、浏览首页推荐、查看笔记内容与评论,并发表你的评论。直接在工作流中与小红书内容互动,高效跟进话题。
XHS note/product search/detail, suggestions, comments/replies; PGY 20pts success, failures uncharged
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables interaction with Xiaohongshu (Little Red Book) platform through automated browser operations. Supports authentication, content publishing, search, discovery, and commenting using Puppeteer-based automation.38054MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to publish content to XiaoHongShu (Little Red Book) social platform, including checking login status and posting with titles, content, images, and hashtags through browser automation.4
- FlicenseNot gradedqualityDmaintenanceEnables automated interaction with Xiaohongshu (Little Red Book) platform including searching posts, retrieving content and comments, and posting AI-generated comments with persistent login support.448
- FlicenseNot gradedqualityDmaintenanceEnables automated interaction with Xiaohongshu (Little Red Book) to search for notes, retrieve content or comments, and post targeted smart comments. It utilizes Playwright to manage browser-based tasks such as secure login and automated engagement.123
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/muhenan/xiaohongshu-mcp-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server