xhs-mcp-cdp

Automates 图文 post publishing to 小红书 via Chrome DevTools Protocol.

2|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/MushroomDAO/blog --skill xhs-mcp-cdp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xhs-mcp-cdp
Source: https://github.com/MushroomDAO/blog/tree/main/.agents/skills/xhs-mcp-cdp
Command: npx skills add https://github.com/MushroomDAO/blog --skill xhs-mcp-cdp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of repeatedly performing manual 小红书图文发布 through the web UI by providing a local MCP HTTP service that drives an already-logged-in Chrome session to publish content reliably.

Core Features & Use Cases

  • CDP Tab Reuse to Avoid WAF: Reuses an existing creator.xiaohongshu.com tab in the same Chrome Profile instead of creating a new one, reducing the chance of being redirected to /login.
  • Page-level WebSocket Click Injection: Sends page-level Input.dispatchMouseEvent over the page’s WebSocket to produce isTrusted=true events so Vue SPA UI responds correctly.
  • Robust Element Waiting with Timeout: Wraps element queries with goroutine + channel + time.After to prevent indefinite WebSocket blocking and provide predictable timeouts.
  • Use Cases: Automating 图文发布 (title/content/tags/images), remote health checks, and debugging a publish flow end-to-end on macOS (Mac Mini 24h service or MacBook temporary local mode).

Quick Start

Start the CDP mode by running the xhs cdp 模式 trigger to launch the MCP server on :18060 and then publish via POST /api/v1/publish with your title, content, tags, and image paths.

Frequently Asked Questions about xhs-mcp-cdp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate publishing posts to Xiaohongshu without triggering WAF blocks?

Automating Xiaohongshu publishing without triggering WAF blocks requires reusing an existing, already-authenticated creator.xiaohongshu.com Chrome tab via the DevTools Protocol. This approach drives the active browser session to bypass login redirects and publish content reliably.

Why does my automated click fail on the Xiaohongshu Vue SPA publish interface?

Automated clicks fail on the Xiaohongshu Vue SPA because standard DOM events are untrusted. Injecting page-level Input.dispatchMouseEvent over WebSocket generates isTrusted=true events, ensuring the publishing UI responds correctly to the interaction.

Can I use Chrome CDP to publish Xiaohongshu posts on a macOS local service?

Yes, you can use Chrome CDP to publish Xiaohongshu posts on a macOS local service. The Skill operates by connecting to a running Chrome instance, exposing an MCP HTTP API on port 18060 to handle the publishing workflow.

How do I prevent indefinite WebSocket blocking when waiting for page elements?

To prevent indefinite WebSocket blocking when waiting for page elements, wrap your element queries with a goroutine, channel, and time.After. This enforces predictable timeout protections, ensuring the automation fails gracefully instead of hanging.

What is the best way to reuse a specific Xiaohongshu creator tab for publishing?

The best way to reuse a specific Xiaohongshu creator tab is connecting to a running Chrome session through the DevTools Protocol. This targets the existing tab within the same Chrome Profile, avoiding new tab creation and preventing WAF login redirects.

How to publish Xiaohongshu 图文 posts via an MCP HTTP API?

To publish Xiaohongshu 图文 posts via an MCP HTTP API, start the CDP mode to launch the server on port 18060. Send a POST request to the /api/v1/publish endpoint with your title, content, tags, and image paths.