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-steve

v1.1.2

Published

Xiaohongshu MCP server for searching posts and comments

Readme

Xiaohongshu MCP Server

一个基于 Model Context Protocol (MCP) 的小红书搜索服务,支持搜索笔记和获取评论。

功能特性

  • 🔍 搜索小红书笔记
  • 💬 获取笔记评论
  • 🚀 同时搜索笔记和评论
  • 📄 基于 MCP 标准协议
  • 🔌 支持 stdio 传输

安装

npm install -g @dengpengfei/xiaohongshu-mcp

或者使用 npx 直接运行:

npx @dengpengfei/xiaohongshu-mcp

使用前准备

获取 Cookie

  1. 打开浏览器并登录小红书网页版
  2. 打开开发者工具(F12)
  3. 切换到 Network(网络)标签
  4. 刷新页面或进行任意操作
  5. 找到任意一个对 xiaohongshu.com 的请求
  6. 在请求头中找到 Cookie 字段,复制整个值

设置环境变量

export XIAOHONGSHU_COOKIE="your_cookie_here"

使用方法

作为 MCP 服务器运行

XIAOHONGSHU_COOKIE="your_cookie" npx @dengpengfei/xiaohongshu-mcp

在 Claude Desktop 中使用

  1. 编辑 Claude Desktop 配置文件:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. 添加配置:

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "npx",
      "args": ["@dengpengfei/xiaohongshu-mcp"],
      "env": {
        "XIAOHONGSHU_COOKIE": "your_cookie_here"
      }
    }
  }
}
  1. 重启 Claude Desktop

可用工具

search_notes

搜索小红书笔记

参数:

  • keyword (必需): 搜索关键词
  • page: 页码(默认 1)
  • page_size: 每页数量(默认 20)
  • sort: 排序方式
    • general: 综合排序(默认)
    • time_descending: 最新发布
    • popularity_descending: 最热门

get_note_comments

获取指定笔记的评论

参数:

  • note_id (必需): 笔记ID
  • cursor: 分页游标(默认空)

search_notes_with_comments

搜索笔记并同时获取每个笔记的评论

参数:

  • keyword (必需): 搜索关键词
  • page: 页码(默认 1)
  • page_size: 每页数量(默认 5)
  • max_comments_per_note: 每个笔记获取的最大评论数(默认 10)
  • sort: 排序方式

注意事项

  1. 请求频率限制:API 要求每次调用间隔 3-5 秒,频繁调用可能导致封禁
  2. Cookie 有效期:Cookie 可能会过期,需要定期更新
  3. 数据量限制:搜索笔记并获取评论时,建议 page_size 不要设置太大,避免请求过多

开发

本地开发

# 克隆仓库
git clone https://github.com/dengpengfei/xiaohongshu-mcp.git
cd xiaohongshu-mcp

# 安装依赖
npm install

# 构建
npm run build

# 开发模式运行
npm run dev

项目结构

xiaohongshu-mcp/
├── src/
│   ├── index.ts           # MCP 服务器主文件
│   └── xiaohongshu-client.ts # 小红书 API 客户端
├── package.json
├── tsconfig.json
└── README.md

License

MIT

作者

Deng Pengfei

贡献

欢迎提交 Issues 和 Pull Requests!

免责声明

本项目仅供学习和研究使用,请遵守小红书的服务条款和相关法律法规。使用本项目产生的任何后果由使用者自行承担。