Skip to main content
Glama
blbl147

xhs-mcp

by blbl147

小红书MCP服务

特点

  • 采用js逆向出x-s,x-t,直接请求http接口,无须笨重的playwright

  • 搜索笔记

  • 获取笔记内容

  • 获取笔记的评论

  • 发表评论

特性

Related MCP server: Xiaohongshu API MCP Server

快速开始

1. 环境

  • node

  • python 3.12

  • uv (pip install uv)

2. 安装依赖


git clone git@github.com:jobsonlook/xhs-mcp.git

cd xhs-mcp
uv sync 

打开web小红书 登录后,获取cookie,将cookie配置到第4步的 XHS_COOKIE 环境变量中 cookie

4. 配置mcp server

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

免责声明

本项目仅用于学习交流,禁止用于其他用途,任何涉及商业盈利目的均不得使用,否则风险自负。

Available Tools

6 tools
get_note_commentsCInspect

获取笔记评论,参数url要带上xsec_token

Args:
    url: 笔记 url
ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

TDQS

C2.9/5.0
Behavior2/5

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 disclosure. It mentions the xsec_token requirement but does not disclose any other behavioral aspects such as return format, pagination, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, consisting of a single sentence plus an Args section. It is well-structured and to the point, with no unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of a one-parameter getter, the description covers the basic purpose and a key prerequisite. However, it lacks details about the response structure or error handling, and there is no output schema to compensate, leaving some gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning to the url parameter by specifying that it must include xsec_token, which is not in the schema. However, it does not explain the format or provide examples, leaving room for interpretation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose clearly: '获取笔记评论' means 'get note comments', which is a specific verb+resource. It does not explicitly distinguish from siblings like get_note_content, but the name and action are unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The only usage note is the prerequisite that the url must include xsec_token, which is a technical requirement rather than a selection guideline.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_note_contentAInspect

获取笔记内容,参数url要带上xsec_token

Args:
    url: 笔记 url
ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It only notes the xsec_token requirement, omitting authentication needs (especially given sibling check_cookie), return format, and error behaviors. This is a significant transparency gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise, with no filler. It communicates the action and a critical parameter requirement in just a few words, earning full marks for succinctness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema, the description is incomplete. It omits authentication requirements (relevant given sibling check_cookie), response structure, and edge cases. The xsec_token note is helpful but insufficient for reliable autonomous use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds crucial meaning to the parameter beyond the bare schema: it specifies that the url must contain xsec_token. Since schema coverage is 0%, this compensation is valuable, though it does not cover other potential parameter nuances.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves note content ('获取笔记内容'), using a specific verb and resource. It is distinguishable from siblings like get_note_comments, which focus on comments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a critical usage prerequisite: the URL must include xsec_token. However, it does not explicitly mention alternatives or when to choose this tool over siblings; usage context is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

home_feedBInspect

获取首页推荐笔记

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

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 does not mention whether authentication is required, whether the tool is read-only, what the response format is, or any rate limits or side effects. The single sentence offers no behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence with no wasted words. It is appropriately sized for the tool's simplicity and immediately front-loads the core function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema and no parameter schema, so the description must compensate by explaining what the response looks like or any operational context. It does not mention return value structure, pagination, or authentication requirements, leaving the agent with insufficient information to predict the tool's full behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no properties, and the description covers the tool's purpose. With 0 parameters, the description does not need to explain parameter semantics, so the baseline of 4 applies. It adds no parameter-specific information, but none is required.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取首页推荐笔记' clearly states a specific action (获取/get) and resource (首页推荐笔记/homepage recommended notes). It distinguishes itself from siblings like search_notes and get_note_content by focusing on the home feed specifically, though it could be more explicit about returning a list of recommended notes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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, no exclusions, and no context about prerequisites (e.g., authentication via check_cookie). It simply states the action without any usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

post_commentAInspect

发布评论到指定笔记

Args:
    note_id: 笔记 note_id
    comment: 要发布的评论内容
ParametersJSON Schema
NameRequiredDescriptionDefault
commentYes
note_idYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It indicates a write operation ('发布') but lacks details on auth requirements, rate limits, side effects, or error behavior. Minimal transparency but no contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single purpose sentence and two parameter lines. There is no fluff; every element contributes to understanding the tool. It is front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter write tool, the description covers the basic action and arguments. However, it omits potential context like authentication (relevant given the check_cookie sibling), expected response, or error conditions. Adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates by explaining both parameters: note_id as the target note and comment as the content to publish. This adds clear meaning beyond the bare schema names and types, though it could benefit from examples or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('发布评论' = post a comment) and the target resource ('指定笔记' = specified note). This distinguishes it from sibling tools that are primarily read-focused (get_note_comments, home_feed, search_notes) or authentication-related (check_cookie).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, nor any prerequisites such as authentication. While the action is implied, there is no explicit when/when-not or contextual advice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_notesCInspect

根据关键词搜索笔记

    Args:
        keywords: 搜索关键词
ParametersJSON Schema
NameRequiredDescriptionDefault
keywordsYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral disclosure burden, but it only says 'search' without detailing return format, pagination, or whether it searches title/content. This is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short and front-loaded, but the Args repetition adds no value. It is appropriately sized but not information-dense.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool, the description lacks information about search scope (e.g., title vs content) and result format, making it incomplete for an agent to confidently invoke.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has zero description coverage, and the description merely restates 'keywords: search keyword', adding no new semantics beyond the parameter name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (search) and resource (notes) with a keyword criterion. It distinguishes itself from siblings like get_note_content and home_feed by the 'search' verb.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage context is provided. It does not mention when to prefer search_notes over home_feed or get_note_content, nor any prerequisites or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.1.0
    • First observedcheck_cookie
    • First observedget_note_comments
    • First observedget_note_content
    • First observedhome_feed
    • First observedpost_comment
    • First observedsearch_notes

TDQS

A3.6/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct resource and action: comments retrieval, comment posting, cookie validation, feed browsing, note search, and note content retrieval. No two tools overlap in purpose.

Naming Consistency5/5

Names follow a consistent verb_noun pattern: get_note_comments, post_comment, check_cookie, search_notes, get_note_content. home_feed is the only slight deviation but still reads as a noun phrase and is predictable.

Tool Count5/5

Six tools is well-scoped for a XiaoHongShu focused server, covering browsing, searching, reading content, and commenting without unnecessary bloat.

Completeness4/5

The core workflows are covered: read notes, search notes, view comments, post comments, and check session validity. Minor gap: no ability to update or delete comments, but this is not essential for typical consumption use cases.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A server that enables access to Xiaohongshu (Little Red Book) content, allowing users to search for notes and retrieve content via URLs with authentication management and cookie persistence.
    52 npm
    7
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables automated interaction with Xiaohongshu (Little Red Book) platform including searching posts, retrieving content and comments, and posting AI-generated comments with persistent login support.
    453
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    124
    -