xhs-mcp

xhs-mcp is a skill for Claude Code from DuckWu/xhs-claude-skills. It costs 24 tokens per session (3,161 once invoked), scanned B, original, MIT.

A tool for extracting Xiaohongshu posts and saving their content while also requesting highly liked comments through a RedNote service connection.

In plain words
What is it for?
Use it with a Xiaohongshu link to collect the post and, when configured and logged in, its highly liked comments. It needs browser cookies for the post and an optional RedNote connection for comments.
Why use it?
It can add audience reactions to the saved post, while still allowing the note to be created if the comment connection is unavailable.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths.

Part of the rednote-to-obsidian plugin — 5 skills shipped together

Good fit Use it with a Xiaohongshu link to collect the post and, when configured and logged in, its highly liked comments. It needs browser cookies for the post and an optional RedNote connection for comments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/duckwu/xhs-claude-skills/xhs-mcp
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add DuckWu/xhs-claude-skills --skill xhs-mcp
Clone the repo
git clone --depth 1 https://github.com/DuckWu/xhs-claude-skills

Made for: Claude Code.

Or install rednote-to-obsidian, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for xhs-mcp

README.md
[![agentmods](https://agentmods.dev/badge/skills/duckwu/xhs-claude-skills/xhs-mcp/github.svg)](https://agentmods.dev/skills/duckwu/xhs-claude-skills/xhs-mcp)
Your own site
<a href="https://agentmods.dev/skills/duckwu/xhs-claude-skills/xhs-mcp"><img src="https://agentmods.dev/badge/skills/duckwu/xhs-claude-skills/xhs-mcp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for xhs-mcp

Your own site · 80×15
<a href="https://agentmods.dev/skills/duckwu/xhs-claude-skills/xhs-mcp"><img src="https://agentmods.dev/badge/skills/duckwu/xhs-claude-skills/xhs-mcp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,161 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.03161
Opus 5 $0.00012 $0.01580
Sonnet 5 $0.00005 $0.00632
Haiku 4.5 $0.00002 $0.00316

Measured 12d ago against content hash c27a8f285891, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

xhs-mcp scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- Linux: `sudo apt install ffmpeg`

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

import json, urllib.request, ssl, re
skills/xhs-mcp/SKILL.md · 268 lines

How it starts

The opening of the file, as written. The whole thing — 268 lines — stays where its author put it; the contents beside it link to each section on GitHub.

用户希望提取小红书帖子内容,并同时获取高赞评论(通过 rednote MCP)。请按以下步骤处理:

前置条件: 此命令依赖 rednote MCP 获取评论。如果 MCP 未配置或未登录,评论步骤自动跳过,笔记仍正常保存。

常量定义

  • Cookies 文件: ~/cookies.json(从 Chrome 导出的小红书 cookies)
  • Obsidian 保存目录: ~/Documents/Obsidian Vault/xhs
    • 若路径不存在,自动检测 Obsidian vault 位置(搜索 ~/Documents/Obsidian~/Documents/Obsidian Vault 等常见路径)
    • Windows 用户常见路径: ~/Documents/Obsidian/ 或自定义位置,请按实际情况修改
  • Whisper 模型:
    • macOS: mlx-community/whisper-large-v3-turbo(使用 mlx-whisper)
    • Windows/Linux: large-v3(使用 openai-whisper)

输入

用户提供的小红书链接: $ARGUMENTS

提取流程

步骤 0:检查 Cookies

  1. 检查 ~/cookies.json 是否存在
  2. 如果不存在,告知用户需要从 Chrome 导出 cookies:
    • 在 Chrome 打开 xiaohongshu.com 并确认已登录
    • 打开 DevTools Console,运行以下代码将 cookies 复制到剪贴板:
    copy(JSON.stringify(document.cookie.split('; ').map(c => {
      const [name, ...rest] = c.split('=');
      return { name, value: rest.join('='), domain: '.xiaohongshu.com', path: '/',
        expires: Date.now()/1000 + 86400*30, size: name.length + rest.join('=').length,
        httpOnly: false, secure: false, session: false, priority: 'Medium',
        sameParty: false, sourceScheme: 'Secure', sourcePort: 443 };
    })))
    
    • 将剪贴板内容保存到 ~/cookies.json
    • 然后终止流程,等用户完成后重新运行

步骤 1:解析链接

从 URL 中提取帖子 ID(24 位十六进制字符串)和 xsec_token 参数。

步骤 2:获取帖子内容

使用 Python 脚本,通过 Cookies 请求帖子页面 HTML,从 window.__INITIAL_STATE__ 解析全部帖子数据:

import json, urllib.request, ssl, re

with open('<Cookies 文件>') as f:
    cookies = json.load(f)
cookie_str = '; '.join(f"{c['name']}={c['value']}" for c in cookies)

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

req = urllib.request.Request('<帖子URL>')
req.add_header('Cookie', cookie_str)
req.add_header('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36')

resp = urllib.request.urlopen(req, timeout=15, context=ctx)
html = resp.read().decode('utf-8', errors='ignore')

m = re.search(r'window\.__INITIAL_STATE__\s*=\s*(\{.+?\})\s*</script>', html, re.DOTALL)
raw = m.group(1).replace('undefined', 'null')
data = json.loads(raw)

# 帖子数据在: data['note']['noteDetailMap'][<key>]['note']
# 包含: title, desc, type, time, user, imageList, video, interactInfo, ipLocation

Read the full file on GitHub · 268 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 268 lines · 24 tokens per session scan B c27a8f285891

Subscribe to this mod's changes

xhs-mcp is a skill published in the GitHub repository DuckWu/xhs-claude-skills (5 stars, last pushed 3mo ago), licensed MIT. It adds 24 tokens to every session and 3,161 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens