🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

rednote-mcp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rednote-mcp

RedNote MCP implementation for Model Context Protocol

Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
81
-10%
Maintainers
1
Weekly downloads
 
Created
Source

RedNote MCP

English | 简体中文

小红书内容访问的 Model Context Protocol 实现。

https://github.com/user-attachments/assets/06b2c67f-d9ed-4a30-8f1d-9743f3edaa3a

快速开始

NPM 全局安装

# 全局安装
npm install -g rednote-mcp

# 初始化登录
rednote-mcp init

从源码安装

# 克隆项目
git clone https://github.com/ifuryst/rednote-mcp.git
cd rednote-mcp

# 安装依赖
npm install

# 全局安装(可选,方便命令行调用)
npm install -g .

# 初始化登录
npm run dev -- init

功能特性

  • 认证管理(支持 Cookie 持久化)
  • 关键词搜索笔记
  • 通过 URL 访问笔记内容
  • 通过 URL 访问评论内容
  • 命令行初始化工具

使用说明

1. 初始化登录

首次使用需要先进行登录初始化:

rednote-mcp init
# 或者如果是从源码安装:
npm run dev -- init

执行此命令后:

  • 会自动打开浏览器窗口
  • 跳转到小红书登录页面
  • 请手动完成登录操作
  • 登录成功后会自动保存 Cookie 到 cookies.json 文件

2. 在 Cursor 中配置 MCP Server

在 Cursor 的 settings.json 中添加以下配置:

{
  "mcpServers": {
    "RedNote MCP": {
      "command": "rednote-mcp",
      "args": ["--stdio"]
    }
  }
}

或者使用 npx 方式:

{
  "mcpServers": {
    "RedNote MCP": {
      "command": "npx",
      "args": ["rednote-mcp", "--stdio"]
    }
  }
}

配置说明:

  • command: 可以是全局安装后的 rednote-mcp 命令,或使用 npx 直接运行
  • args: 必须包含 --stdio 参数以支持 Cursor 的通信方式

开发指南

环境要求

  • Node.js >= 16
  • npm >= 7

开发流程

# 安装依赖
npm install

# 构建项目
npm run build

# 开发模式运行
npm run dev

# 运行测试
npm test

使用 MCP Inspector 进行调试

MCP Inspector 是一个用于调试 MCP 服务器的工具,可以帮助开发者检查和验证 MCP 服务器的行为。使用以下命令启动:

npx @modelcontextprotocol/inspector npx rednote-mcp --stdio

这个命令会:

  • 启动 MCP Inspector 工具
  • 通过 Inspector 运行 rednote-mcp 服务
  • 提供一个交互式界面来检查请求和响应
  • 帮助调试和验证 MCP 协议的实现

配置

在项目根目录创建 .env 文件,配置以下变量:

# Cookie 存储路径
COOKIE_STORAGE_PATH=./cookies.json

# MCP 服务器配置
PORT=3000
HOST=localhost

项目结构

rednote-mcp/
├── src/              # 源代码目录
│   ├── auth/         # 认证相关
│   │   ├── authManager.ts
│   │   └── cookieManager.ts
│   ├── cli.ts        # 命令行接口
│   └── index.ts      # 主入口
├── docs/             # 文档目录
│   └── README.en.md  # 英文文档
├── tests/            # 测试目录
├── .env              # 环境配置
├── package.json      # 项目配置
└── tsconfig.json     # TypeScript 配置

注意事项

  • 首次使用必须执行 init 命令进行登录
  • Cookie 文件包含敏感信息,请勿泄露
  • 建议定期更新 Cookie,避免失效
  • 确保已正确安装 Node.js 环境

贡献指南

  • Fork 本仓库
  • 创建你的特性分支 (git checkout -b feature/AmazingFeature)
  • 提交你的改动 (git commit -m 'Add some AmazingFeature')
  • 推送到分支 (git push origin feature/AmazingFeature)
  • 开启一个 Pull Request

许可证

MIT License - 详见 LICENSE 文件

Keywords

rednote

FAQs

Package last updated on 10 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts