Available MCP Tools in xiaohongshu-mcp: Complete 13-Function Reference and Usage Guide

The xiaohongshu-mcp repository exposes 13 Model Context Protocol (MCP) tools that enable automated authentication, content publishing, feed discovery, social interactions, and user profile retrieval through the XiaoHongShu (RED) platform.

The xiaohongshu-mcp project implements a complete MCP server that bridges AI assistants with XiaoHongShu's social media ecosystem. All available MCP tools in xiaohongshu-mcp are declared in the registerTools function within mcp_server.go and backed by corresponding handler implementations in mcp_handlers.go, providing programmatic access to both consumer browsing and creator publishing features.

Authentication and Session Management Tools

These three tools handle the login flow and session state for the XiaoHongShu integration.

check_login_status

Function: Validates the current browser session and returns login state.

This tool queries the existing cookie store and browser instance to determine if the session is authenticated. According to the source description "检查小红书登录状态", it returns boolean status and associated user metadata when logged in. The handler is implemented in mcp_handlers.go as handleCheckLoginStatus.

{}

get_login_qrcode

Function: Generates a Base64-encoded QR code for user authentication.

When invoked, this tool initializes a new login flow and returns a QR code image (Base64 format) along with timeout parameters. The source description reads "获取登录二维码(返回 Base64 图片和超时时间)", indicating it handles the initial authentication handshake for headless or automated setups.

{}

delete_cookies

Function: Forces a complete session reset by clearing stored credentials.

This tool removes the local cookies file, effectively logging out the current session. The description "删除 cookies 文件,重置登录状态。删除后需要重新登录。" confirms that subsequent API calls will require fresh authentication via get_login_qrcode.

{}

Content Creation Tools

These tools support both image-text posts and video uploads through the XiaoHongShu creator interface.

publish_content

Function: Publishes image-plus-text (图文) content to the platform.

As described in the source "发布小红书图文内容", this tool accepts structured arguments including title, content body, local image file paths, tags, scheduling parameters, originality flags, visibility settings, and optional product keywords. The corresponding PublishContentArgs struct in mcp_server.go defines the JSON schema for these parameters.

{
  "title": "My Travel",
  "content": "Enjoy the scenery!",
  "images": ["/Users/me/pic1.jpg", "/Users/me/pic2.jpg"],
  "tags": ["旅行", "风景"],
  "schedule_at": "2024-05-01T10:00:00+08:00",
  "is_original": true,
  "visibility": "公开可见",
  "products": ["防晒霜"]
}

publish_with_video

Function: Uploads and publishes single video content.

This tool handles video post creation as specified by "发布小红书视频内容(仅支持本地单个视频文件)". It accepts a local video file path, title, description, tags, and visibility controls. Note that the implementation currently supports only single local video files, not remote URLs or multi-video uploads.

{
  "title": "My Vlog",
  "content": "Check this out",
  "video": "/Users/me/video.mp4",
  "tags": ["vlog"],
  "schedule_at": "",
  "visibility": "公开可见",
  "products": []
}

Feed Discovery and Search Tools

These tools enable content consumption through the home feed, search functionality, and detailed note retrieval.

list_feeds

Function: Retrieves the personalized home page feed.

This tool fetches the main content stream for the authenticated user. The description "获取首页 Feeds 列表" indicates it returns recent posts from followed accounts and algorithmic recommendations without requiring additional parameters.

{}

search_feeds

Function: Executes keyword-based content searches with filtering.

As noted in "搜索小红书内容(需要已登录)", this tool requires authentication and supports complex query filters including sort order, note type (图文 vs video), publish time range, search scope, and geolocation parameters. The handler processes these through the underlying XiaoHongShu SDK search interface.

{
  "keyword": "咖啡",
  "filters": {
    "sort_by": "最新",
    "note_type": "图文",
    "publish_time": "一天内"
  }
}

get_feed_detail

Function: Returns comprehensive note metadata, media, and comments.

This is the most data-rich retrieval tool, described as "获取小红书笔记详情,返回笔记内容、图片、作者信息、互动数据(点赞/收藏/分享数)及评论列表". It accepts a feed_id and optional xsec_token, returning content body, image URLs, author statistics, engagement metrics (likes, favorites, shares), and hierarchical comment threads. Setting load_all_comments=true paginates through nested replies beyond the default 10 top-level comments.

{
  "feed_id": "1234567890",
  "xsec_token": "abcdef",
  "load_all_comments": true,
  "limit": 50,
  "click_more_replies": true,
  "reply_limit": 20,
  "scroll_speed": "normal"
}

Social Interaction Tools

These four tools enable engagement actions including commenting, replying, liking, and favoriting content.

post_comment_to_feed

Function: Creates top-level comments on existing notes.

This tool publishes user-generated comments to specific posts using the "发表评论到小红书笔记" endpoint. It requires the target feed_id, optional xsec_token for anti-bot validation, and the comment text content.

{
  "feed_id": "1234567890",
  "xsec_token": "abcdef",
  "content": "Great post!"
}

reply_comment_in_feed

Function: Posts threaded replies to existing comments.

Distinct from top-level commenting, this tool handles nested conversation threads as described in "回复小红书笔记下的指定评论". It accepts either a comment_id or user_id to target the specific comment for the reply.

{
  "feed_id": "1234567890",
  "xsec_token": "abcdef",
  "comment_id": "cmt123",
  "content": "I agree!"
}

like_feed

Function: Toggles like status on specific notes.

This tool manages engagement through the "为指定笔记点赞或取消点赞" endpoint. The implementation includes idempotency checks: if the note is already liked and unlike is false, it skips the action; similarly, it avoids unliking already unliked content. The unlike boolean parameter controls the direction of the toggle.

{
  "feed_id": "1234567890",
  "xsec_token": "abcdef",
  "unlike": false
}

favorite_feed

Function: Manages user favorites/collections.

Operating similarly to the like tool, this endpoint "收藏指定笔记或取消收藏" adds or removes notes from the user's collection. It checks current state before executing to prevent redundant API calls, using the unfavorite boolean to determine the desired end state.

{
  "feed_id": "1234567890",
  "xsec_token": "abcdef",
  "unfavorite": false
}

User Profile Retrieval

user_profile

Function: Fetches public user statistics and recent content.

This tool retrieves comprehensive profile data for any specified user ID, as described in "获取指定的小红书用户主页,返回用户基本信息,关注、粉丝、获赞量及其笔记内容". It returns follower counts, following counts, total likes received, and metadata for recent posts.

{
  "user_id": "987654321",
  "xsec_token": "ghijkl"
}

Implementation Architecture

The tool registration occurs in mcp_server.go within the registerTools function, where each tool name is mapped to its corresponding handler in mcp_handlers.go (e.g., handleCheckLoginStatus, handlePublishContent). The server uses panic-recovery wrappers to ensure stability, and the AppServer type in app_server.go maintains shared state including the browser instance, cookie storage, and logger across all tool invocations.

Each tool's input parameters are defined as Go structs with JSON tags (e.g., json:"title", json:"feed_id") in mcp_server.go, enabling automatic unmarshalling of client JSON payloads into typed arguments before passing to the handlers.

Summary

The xiaohongshu-mcp repository provides a complete MCP-based automation interface for XiaoHongShu through 13 distinct tools:

  • Authentication: check_login_status, get_login_qrcode, delete_cookies
  • Content Creation: publish_content (image-text), publish_with_video (video)
  • Feed Discovery: list_feeds, search_feeds, get_feed_detail
  • Social Interaction: post_comment_to_feed, reply_comment_in_feed, like_feed, favorite_feed
  • User Data: user_profile

All tools are registered in mcp_server.go and implemented in mcp_handlers.go, supporting both read operations and state-modifying actions through the official XiaoHongShu Go SDK integration.

Frequently Asked Questions

How does the MCP server handle XiaoHongShu authentication?

The server implements a three-step authentication flow. First, get_login_qrcode generates a Base64-encoded QR code for mobile scanning. After the user scans and confirms, check_login_status verifies the session cookies stored by the browser automation layer. If sessions expire or require reset, delete_cookies clears the local storage to force re-authentication, as implemented in the handler functions within mcp_handlers.go.

What content formats can I publish using these MCP tools?

The repository supports two primary content formats. The publish_content tool handles 图文 (image-plus-text) posts accepting multiple local image paths and rich text formatting. The publish_with_video tool manages single video file uploads with accompanying metadata. Both tools support scheduling via ISO 8601 timestamps, visibility controls (public/private), and product tagging for e-commerce integration.

How are the MCP tools registered and wired to their handlers?

Tool registration occurs centrally in the registerTools method of mcp_server.go, where each tool name and description string (in Chinese) is associated with a specific handler function from mcp_handlers.go. The server wraps each handler with panic recovery and JSON marshalling logic, ensuring that incoming MCP requests are routed to handleCheckLoginStatus, handlePublishContent, or their respective counterparts while maintaining type safety through the defined Args structs.

Can I retrieve all comments and nested replies from a specific post?

Yes, the get_feed_detail tool supports deep comment retrieval. By setting load_all_comments to true, the handler paginates through the comment tree beyond the default 10 top-level entries. Additional parameters like click_more_replies and reply_limit control the depth and breadth of nested reply extraction, returning full interaction data including author information, timestamps, and like counts for each comment node.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →