npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xiaohongshu-mcp

v0.0.1

Published

小红书 Model Context Protocol (MCP) 工具集

Readme

小红书 MCP

一个基于 Model Context Protocol (MCP) 的小红书自动化工具,使用 Playwright 实现。此工具可以让 LLM 通过结构化的方式与小红书网页进行交互。

安装

npm install xiaohongshu-mcp
# 或者
yarn add xiaohongshu-mcp

主要特点

  • 快速轻量: 使用 Playwright 的无障碍树,无需基于像素的输入
  • LLM 友好: 不需要视觉模型,纯结构化数据操作
  • 确定性工具应用: 避免基于截图方法常见的歧义

使用场景

  • 小红书内容自动化获取
  • 数据结构化提取
  • LLM 驱动的自动化测试
  • 通用浏览器交互自动化

配置示例

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "npx",
      "args": [
        "xiaohongshu-mcp@latest"
      ]
    }
  }
}

无头浏览器模式

此模式适用于后台或批处理操作:

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "npx",
      "args": [
        "xiaohongshu-mcp@latest",
        "--headless"
      ]
    }
  }
}

Linux 无显示器环境下运行

当在无显示器系统或 IDE 的工作进程中运行时,你可以使用 Playwright 的客户端-服务器模式。 首先在有显示器的环境中运行 Playwright 服务器:

npx playwright run-server

然后在 MCP 配置中添加以下环境变量:

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "npx",
      "args": [
        "xiaohongshu-mcp@latest"
      ],
      "env": {
        // 使用上面服务器输出的端点
        "PLAYWRIGHT_WS_ENDPOINT": "ws://localhost:<port>/"
      }
    }
  }
}

工具模式

工具提供两种模式:

  1. 快照模式 (默认): 使用无障碍快照以获得更好的性能和可靠性
  2. 视觉模式: 使用截图进行基于视觉的交互

要使用视觉模式,在启动服务器时添加 --vision 标志:

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "npx",
      "args": [
        "xiaohongshu-mcp@latest",
        "--vision"
      ]
    }
  }
}

视觉模式最适合能够基于提供的截图使用 X Y 坐标空间与元素交互的计算机使用模型。

可用工具

小红书 MCP 提供了一套用于浏览器自动化的工具。以下是所有可用工具:

  • xiaohongshu-mcp_navigate

    • 描述: 导航到指定 URL
    • 参数:
      • url (string): 要导航到的 URL
  • xiaohongshu-mcp_is_login

    • 描述: 检查用户是否已登录
    • 参数: 无
  • xiaohongshu-mcp_get_cookie

    • 描述: 获取小红书的 cookie
    • 参数: 无
  • xiaohongshu-mcp_get_qr_code

    • 描述: 获取二维码,用户需要扫描二维码登录
    • 参数: 无
  • xiaohongshu-mcp_click

    • 描述: 在网页上执行点击
    • 参数:
      • element (string): 用于获取与元素交互权限的人类可读元素描述
      • x (number): X 坐标
      • y (number): Y 坐标
  • xiaohongshu-mcp_type

    • 描述: 在可编辑元素中输入文本
    • 参数:
      • text (string): 要输入的文本
      • submit (boolean): 是否提交输入的文本(之后按回车)
  • xiaohongshu-mcp_press_key

    • 描述: 按下键盘按键
    • 参数:
      • key (string): 要按下的键名或要生成的字符,如 ArrowLeft 或 `