Uses Express as the HTTP server framework to expose MCP tools via Streamable HTTP transport protocol.
Used for package management and running the MCP server with npm commands.
Mentioned as an alternative headless browser option for automating Xiaohongshu web interactions alongside Playwright.
Referenced in the official MCP SDK examples for implementing Streamable HTTP servers.
Enables publishing content to Xiaohongshu (Little Red Book), including checking login status, uploading images, and creating posts with titles, content, and topic tags through browser automation.
Provides schema validation for tool input parameters, defining the structure and constraints for publishing content to Xiaohongshu.
🦀 拆解 xiaohongshu-mcp
拆解 https://github.com/xpzouying/xiaohongshu-mcp 并用 nodejs 重构 🤿
AI Agent 只负责“想清楚要做什么”,但不能直接“动手操作网页”,是 MCP 提供了这样的能力。
🍕 场景一:“使用 xiaohongshu-mcp 进行 xxx”
claude 是如何知道 xiaohongshu-mcp 这个特定名称的东西呢?
1️⃣ 首先,启动本express项目:
2️⃣ 使用 claude mcp 注册即可
iflow 版本
🚧 什么是 MCP Inspector
调试工具,用于测试 MCP 连接:
MCP Transport Type 一共有 3 种:
STDIO
SSE 已弃用
Streamable HTTP
STDIO 和 SSE、Streamable HTTP 是什么区别?
STDIO | SSE | Streamable HTTP |
/ |
|
|
🧷 Streamable HTTP 最小案例并通过 @modelcontextprotocol/inspector 测试:
Streamable HTTP 官方案例:simpleStreamableHttp.ts
本项目固定写法来自:mcp-streamable-http-typescript-server
最小案例代码 demo.js
inspector 测试截图 ⬇️
🔐 场景二:检查小红书登录状态
如何检查小红书登录状态?
作者通过打开浏览器 https://www.xiaohongshu.com/explore 页面查看指定 DOM 来判断是否登录;
⚠️ 这种方式需要下载 无头浏览器(约 150MB)实现,包括后续也是通过操作 DOM 的方式发布作品。
原仓库用了 github.com/xpzouying/headless_browser 工具,nodejs 可以用 playwright 或者 puppeteer。
题外话:如果是自己内部网页,可以用 OAuth + api 的方式进行
OAuth 的实现过程: terminal open 一个带 token 的链接,本地监听 auth callback。 用户在浏览器通过这个链接登录成功后,terminal 的 auth callback 会把登录信息返回, 这样就实现了无需无头浏览器的 OAuth
📝 场景三:发布内容的 prompt 配置
如何内置 prompt 在 mcp 中?