[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77YSDP7XV40MGJQTZRJQ30A":3,"skill-same:01M77YSDP7XV40MGJQTZRJQ30A":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M77YSDP7XV40MGJQTZRJQ30A","xhs-mcp-installer",null,"一键安装并启动小红书 MCP 服务（xiaohongshu-mcp）。当用户说\"帮我安装小红书MCP\"、\"安装 xhs-mcp\"、\"配置小红书 MCP\"、\"帮我搞个小红书\"、或提供 GitHub 链接 https:\u002F\u002Fgithub.com\u002Fxpzouying\u002Fxiaohongshu-mcp 时触发。自动检测系统、下载二进制、配置开机自启、启动服务。","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fx\u002Fxhs-mcp-installer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: xhs-mcp-installer\ndescription: 一键安装并启动小红书 MCP 服务（xiaohongshu-mcp）。当用户说\"帮我安装小红书MCP\"、\"安装 xhs-mcp\"、\"配置小红书 MCP\"、\"帮我搞个小红书\"、或提供 GitHub 链接 https:\u002F\u002Fgithub.com\u002Fxpzouying\u002Fxiaohongshu-mcp 时触发。自动检测系统、下载二进制、配置开机自启、启动服务。\nmetadata: {\"openclaw\": {\"emoji\": \"📕\", \"requires\": {\"bins\": [\"curl\"]}}}\n---\n\n# 📕 小红书 MCP 一键安装器\n\n自动完成以下工作：\n1. 检测系统（macOS \u002F Linux）并选择对应二进制\n2. 下载 xhs-mcp 到 `~\u002Fxiaohongshu-mcp\u002F`\n3. 配置为后台服务（macOS: launchd，Linux: systemd）\n4. 启动服务并验证健康状态\n\n---\n\n## 一、安装前检查\n\n```bash\n# 检查是否已安装\nlsof -i :18060 2>\u002Fdev\u002Fnull | grep LISTEN && echo \"✅ 已在运行\" || echo \"❌ 未运行\"\n\n# 检查二进制是否存在\n[ -f ~\u002Fxiaohongshu-mcp\u002Fxhs-mcp ] && echo \"✅ 已下载\" || echo \"❌ 未下载\"\n```\n\n---\n\n## 二、自动安装流程\n\n### 2.1 检测系统\n\n```bash\nOS=\"$(uname -s)\"\nARCH=\"$(uname -m)\"\necho \"系统: $OS, 架构: $ARCH\"\n```\n\n| 系统 | 架构 | 二进制名 |\n|------|------|----------|\n| Darwin (macOS) | x86_64 | xhs-mcp-darwin-amd64 |\n| Darwin (macOS) | arm64 | xhs-mcp-darwin-arm64 |\n| Linux | x86_64 | xhs-mcp-linux-amd64 |\n| Linux | aarch64 | xhs-mcp-linux-arm64 |\n\n### 2.2 下载二进制\n\n```bash\nmkdir -p ~\u002Fxiaohongshu-mcp\ncd ~\u002Fxiaohongshu-mcp\n\n# 自动识别架构\ncase \"$(uname -s)-$(uname -m)\" in\n  Darwin-x86_64)  BINARY=\"xhs-mcp-darwin-amd64\" ;;\n  Darwin-arm64)    BINARY=\"xhs-mcp-darwin-arm64\" ;;\n  Linux-x86_64)   BINARY=\"xhs-mcp-linux-amd64\" ;;\n  Linux-aarch64)  BINARY=\"xhs-mcp-linux-arm64\" ;;\n  *) echo \"❌ 不支持的平台: $(uname -s) $(uname -m)\"; exit 1 ;;\nesac\n\necho \"下载 $BINARY ...\"\ncurl -L \"https:\u002F\u002Fgithub.com\u002Fxpzouying\u002Fxiaohongshu-mcp\u002Freleases\u002Flatest\u002Fdownload\u002F${BINARY}\" \\\n  -o .\u002Fxhs-mcp --progress-bar\nchmod +x .\u002Fxhs-mcp\n```\n\n### 2.3 启动服务（手动测试）\n\n```bash\ncd ~\u002Fxiaohongshu-mcp\n\n# 杀掉旧进程\nlsof -ti :18060 | xargs kill -9 2>\u002Fdev\u002Fnull\nsleep 1\n\n# 启动\nnohup .\u002Fxhs-mcp server --port 18060 > ~\u002Fxiaohongshu-mcp\u002Fmcp.log 2>&1 &\nsleep 3\n\n# 验证\nif lsof -i :18060 | grep LISTEN > \u002Fdev\u002Fnull; then\n  echo \"✅ 服务启动成功，端口 18060 监听中\"\nelse\n  echo \"❌ 启动失败，查看日志：tail ~\u002Fxiaohongshu-mcp\u002Fmcp.log\"\n  tail -20 ~\u002Fxiaohongshu-mcp\u002Fmcp.log\nfi\n```\n\n### 2.4 配置开机自启\n\n#### macOS — launchd plist\n\n```bash\nXHS_PLIST=\"$HOME\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\"\nmkdir -p \"$HOME\u002FLibrary\u002FLaunchAgents\"\n\ncat > \"$XHS_PLIST\" \u003C\u003C 'EOFPLIST'\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE plist PUBLIC \"-\u002F\u002FApple\u002F\u002FDTD PLIST 1.0\u002F\u002FEN\" \"http:\u002F\u002Fwww.apple.com\u002FDTDs\u002FPropertyList-1.0.dtd\">\n\u003Cplist version=\"1.0\">\n\u003Cdict>\n    \u003Ckey>Label\u003C\u002Fkey>\n    \u003Cstring>com.openclaw.xhs-mcp\u003C\u002Fstring>\n    \u003Ckey>ProgramArguments\u003C\u002Fkey>\n    \u003Carray>\n        \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fxhs-mcp\u003C\u002Fstring>\n        \u003Cstring>server\u003C\u002Fstring>\n        \u003Cstring>--port\u003C\u002Fstring>\n        \u003Cstring>18060\u003C\u002Fstring>\n    \u003C\u002Farray>\n    \u003Ckey>WorkingDirectory\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u003C\u002Fstring>\n    \u003Ckey>RunAtLoad\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>KeepAlive\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>StandardOutPath\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fmcp.log\u003C\u002Fstring>\n    \u003Ckey>StandardErrorPath\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fmcp.log\u003C\u002Fstring>\n    \u003Ckey>EnvironmentVariables\u003C\u002Fkey>\n    \u003Cdict\u002F>\n\u003C\u002Fdict>\n\u003C\u002Fplist>\nEOFPLIST\n\n# 加载服务\nlaunchctl unload \"$XHS_PLIST\" 2>\u002Fdev\u002Fnull\nlaunchctl load \"$XHS_PLIST\"\necho \"✅ launchd 服务已加载\"\n```\n\n#### Linux — systemd\n\n```bash\nsudo tee \u002Fetc\u002Fsystemd\u002Fsystem\u002Fxhs-mcp.service > \u002Fdev\u002Fnull \u003C\u003C 'EOFSYSTEMD'\n[Unit]\nDescription=Xiaohongshu MCP Service\nAfter=network.target\n\n[Service]\nWorkingDirectory=\u002Froot\u002Fxiaohongshu-mcp\nExecStart=\u002Froot\u002Fxiaohongshu-mcp\u002Fxhs-mcp server --port 18060\nRestart=always\nRestartSec=5\nStandardOutput=append:\u002Froot\u002Fxiaohongshu-mcp\u002Fmcp.log\nStandardError=append:\u002Froot\u002Fxiaohongshu-mcp\u002Fmcp.log\n\n[Install]\nWantedBy=multi-user.target\nEOFSYSTEMD\n\nsudo systemctl daemon-reload\nsudo systemctl enable xhs-mcp\nsudo systemctl start xhs-mcp\necho \"✅ systemd 服务已启动\"\n```\n\n### 2.5 创建看门狗脚本（自动恢复崩溃）\n\n```bash\ncat > ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh \u003C\u003C 'EOFWATCHDOG'\n#!\u002Fbin\u002Fbash\n# xhs-mcp 看门狗：服务崩溃后自动重启\nPORT=18060\nLOG=~\u002Fxiaohongshu-mcp\u002Fwatchdog.log\n\ncheck() {\n    curl -s --max-time 3 http:\u002F\u002Flocalhost:$PORT\u002Fhealth > \u002Fdev\u002Fnull 2>&1\n}\n\nrestart() {\n    echo \"$(date '+%Y-%m-%d %H:%M:%S') 重启服务...\" >> \"$LOG\"\n    lsof -ti :$PORT | xargs kill -9 2>\u002Fdev\u002Fnull\n    sleep 2\n    cd ~\u002Fxiaohongshu-mcp\n    nohup .\u002Fxhs-mcp server --port $PORT >> ~\u002Fxiaohongshu-mcp\u002Fmcp.log 2>&1 &\n    sleep 3\n    if check; then\n        echo \"$(date '+%Y-%m-%d %H:%M:%S') 重启成功\" >> \"$LOG\"\n    fi\n}\n\nif ! check; then\n    restart\nfi\nEOFWATCHDOG\nchmod +x ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh\n\n# macOS: 添加定期检查到 crontab\n(crontab -l 2>\u002Fdev\u002Fnull | grep -v watchdog; echo \"*\u002F5 * * * * ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh\") | crontab -\necho \"✅ 看门狗已配置（每5分钟检查一次）\"\n```\n\n---\n\n## 三、验证安装\n\n### 3.1 服务健康检查\n\n```bash\n# 检查进程\nps aux | grep -i xhs-mcp | grep -v grep\n\n# 检查端口\nlsof -i :18060 | grep LISTEN\n\n# 检查登录状态（调用 MCP）\nMCP_URL=\"http:\u002F\u002Flocalhost:18060\u002Fmcp\"\nSESSION_ID=$(curl -s -D \u002Ftmp\u002Fxhs_check -X POST \"$MCP_URL\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"openclaw\",\"version\":\"1.0\"}},\"id\":1}' > \u002Fdev\u002Fnull \\\n  && grep -i 'Mcp-Session-Id' \u002Ftmp\u002Fxhs_check | tr -d '\\r' | awk '{print $2}')\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Finitialized\",\"params\":{}}' > \u002Fdev\u002Fnull\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools\u002Fcall\",\"params\":{\"name\":\"check_login_status\",\"arguments\":{}},\"id\":2}'\n```\n\n### 3.2 判断结果\n\n| 输出 | 含义 | 操作 |\n|------|------|------|\n| `✅ 已在运行` + `✅ 已下载` | 已安装，跳过 | 静默完成 |\n| 服务启动成功 + 登录状态正常 | 全新安装完成 | 告知用户 |\n| 服务启动成功 + `❌ 未登录` | 需扫码登录 | 进入登录流程 |\n| ❌ 启动失败 | 下载或权限问题 | 查看日志排查 |\n\n---\n\n## 四、扫码登录（如需要）\n\n### 方式一：直接获取二维码（推荐）\n\n```bash\nMCP_URL=\"http:\u002F\u002Flocalhost:18060\u002Fmcp\"\nSESSION_ID=$(curl -s -D \u002Ftmp\u002Fxhs_qr_h -X POST \"$MCP_URL\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"openclaw\",\"version\":\"1.0\"}},\"id\":1}' > \u002Fdev\u002Fnull \\\n  && grep -i 'Mcp-Session-Id' \u002Ftmp\u002Fxhs_qr_h | tr -d '\\r' | awk '{print $2}')\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Finitialized\",\"params\":{}}' > \u002Fdev\u002Fnull\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools\u002Fcall\",\"params\":{\"name\":\"get_login_qrcode\",\"arguments\":{}},\"id\":2}' | \\\n  python3 -c \"\nimport sys,json\nd=json.load(sys.stdin)\ntext=d.get('result',{}).get('content',[{}])[0].get('text','')\n# 提取base64图片\nimport re\nm=re.search(r'data:image\u002Fpng;base64,([A-Za-z0-9+\u002F=]+)', text)\nif m:\n    open('\u002Ftmp\u002Fxhs_qr.png','wb').write(__import__('base64').b64decode(m.group(1)))\n    print('二维码已保存到 \u002Ftmp\u002Fxhs_qr.png')\nelse:\n    print(text)\n\"\n```\n\n### 方式二：Cookie 导入（无需扫码）\n\n用户提供浏览器 Cookie 字符串后，转换为 JSON 保存：\n\n```bash\npython3 -c \"\nimport json, sys\ncookie_str = sys.argv[1].strip()\ncookies = []\nfor pair in cookie_str.split(';'):\n    pair = pair.strip()\n    if '=' not in pair: continue\n    name, value = pair.split('=', 1)\n    cookies.append({\n        'name': name.strip(),\n        'value': value.strip(),\n        'domain': '.xiaohongshu.com',\n        'path': '\u002F',\n        'expires': -1,\n        'httpOnly': name.strip() in ('web_session', 'id_token', 'acw_tc'),\n        'secure': name.strip() in ('web_session', 'id_token'),\n        'session': False,\n        'priority': 'Medium',\n        'sameParty': False,\n        'sourceScheme': 'Secure',\n        'sourcePort': 443\n    })\nwith open('$HOME\u002Fxiaohongshu-mcp\u002Fcookies.json', 'w') as f:\n    json.dump(cookies, f, ensure_ascii=False)\nprint(f'已保存 {len(cookies)} 个 Cookie')\n\" '用户粘贴的cookie字符串'\n```\n\n---\n\n## 五、故障排查\n\n```bash\n# 服务状态\nps aux | grep xhs-mcp | grep -v grep\nlsof -i :18060\n\n# 查看日志\ntail -30 ~\u002Fxiaohongshu-mcp\u002Fmcp.log\n\n# 重启服务（macOS）\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\n\n# 重启服务（Linux）\nsudo systemctl restart xhs-mcp\n\n# 卸载服务\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist 2>\u002Fdev\u002Fnull\nsudo systemctl disable xhs-mcp 2>\u002Fdev\u002Fnull\n```\n\n---\n\n## 六、安装完成告知模板\n\n安装成功后，告知用户：\n\n> ✅ **小红书 MCP 安装完成！**\n>\n> 🐹 服务已就绪，后台运行中\n> 📍 端口：18060\n> 🔄 开机自启：已配置\n> 🐕 看门狗：每5分钟自动检查\n>\n> 📌 下一步：用小红书APP扫码登录（告诉我就行，我会发二维码给你）\n","# 📕 小红书 MCP 一键安装器\n\n自动完成以下工作：\n1. 检测系统（macOS \u002F Linux）并选择对应二进制\n2. 下载 xhs-mcp 到 `~\u002Fxiaohongshu-mcp\u002F`\n3. 配置为后台服务（macOS: launchd，Linux: systemd）\n4. 启动服务并验证健康状态\n\n---\n\n## 一、安装前检查\n\n```bash\n# 检查是否已安装\nlsof -i :18060 2>\u002Fdev\u002Fnull | grep LISTEN && echo \"✅ 已在运行\" || echo \"❌ 未运行\"\n\n# 检查二进制是否存在\n[ -f ~\u002Fxiaohongshu-mcp\u002Fxhs-mcp ] && echo \"✅ 已下载\" || echo \"❌ 未下载\"\n```\n\n---\n\n## 二、自动安装流程\n\n### 2.1 检测系统\n\n```bash\nOS=\"$(uname -s)\"\nARCH=\"$(uname -m)\"\necho \"系统: $OS, 架构: $ARCH\"\n```\n\n| 系统 | 架构 | 二进制名 |\n|------|------|----------|\n| Darwin (macOS) | x86_64 | xhs-mcp-darwin-amd64 |\n| Darwin (macOS) | arm64 | xhs-mcp-darwin-arm64 |\n| Linux | x86_64 | xhs-mcp-linux-amd64 |\n| Linux | aarch64 | xhs-mcp-linux-arm64 |\n\n### 2.2 下载二进制\n\n```bash\nmkdir -p ~\u002Fxiaohongshu-mcp\ncd ~\u002Fxiaohongshu-mcp\n\n# 自动识别架构\ncase \"$(uname -s)-$(uname -m)\" in\n  Darwin-x86_64)  BINARY=\"xhs-mcp-darwin-amd64\" ;;\n  Darwin-arm64)    BINARY=\"xhs-mcp-darwin-arm64\" ;;\n  Linux-x86_64)   BINARY=\"xhs-mcp-linux-amd64\" ;;\n  Linux-aarch64)  BINARY=\"xhs-mcp-linux-arm64\" ;;\n  *) echo \"❌ 不支持的平台: $(uname -s) $(uname -m)\"; exit 1 ;;\nesac\n\necho \"下载 $BINARY ...\"\ncurl -L \"https:\u002F\u002Fgithub.com\u002Fxpzouying\u002Fxiaohongshu-mcp\u002Freleases\u002Flatest\u002Fdownload\u002F${BINARY}\" \\\n  -o .\u002Fxhs-mcp --progress-bar\nchmod +x .\u002Fxhs-mcp\n```\n\n### 2.3 启动服务（手动测试）\n\n```bash\ncd ~\u002Fxiaohongshu-mcp\n\n# 杀掉旧进程\nlsof -ti :18060 | xargs kill -9 2>\u002Fdev\u002Fnull\nsleep 1\n\n# 启动\nnohup .\u002Fxhs-mcp server --port 18060 > ~\u002Fxiaohongshu-mcp\u002Fmcp.log 2>&1 &\nsleep 3\n\n# 验证\nif lsof -i :18060 | grep LISTEN > \u002Fdev\u002Fnull; then\n  echo \"✅ 服务启动成功，端口 18060 监听中\"\nelse\n  echo \"❌ 启动失败，查看日志：tail ~\u002Fxiaohongshu-mcp\u002Fmcp.log\"\n  tail -20 ~\u002Fxiaohongshu-mcp\u002Fmcp.log\nfi\n```\n\n### 2.4 配置开机自启\n\n#### macOS — launchd plist\n\n```bash\nXHS_PLIST=\"$HOME\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\"\nmkdir -p \"$HOME\u002FLibrary\u002FLaunchAgents\"\n\ncat > \"$XHS_PLIST\" \u003C\u003C 'EOFPLIST'\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE plist PUBLIC \"-\u002F\u002FApple\u002F\u002FDTD PLIST 1.0\u002F\u002FEN\" \"http:\u002F\u002Fwww.apple.com\u002FDTDs\u002FPropertyList-1.0.dtd\">\n\u003Cplist version=\"1.0\">\n\u003Cdict>\n    \u003Ckey>Label\u003C\u002Fkey>\n    \u003Cstring>com.openclaw.xhs-mcp\u003C\u002Fstring>\n    \u003Ckey>ProgramArguments\u003C\u002Fkey>\n    \u003Carray>\n        \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fxhs-mcp\u003C\u002Fstring>\n        \u003Cstring>server\u003C\u002Fstring>\n        \u003Cstring>--port\u003C\u002Fstring>\n        \u003Cstring>18060\u003C\u002Fstring>\n    \u003C\u002Farray>\n    \u003Ckey>WorkingDirectory\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u003C\u002Fstring>\n    \u003Ckey>RunAtLoad\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>KeepAlive\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n    \u003Ckey>StandardOutPath\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fmcp.log\u003C\u002Fstring>\n    \u003Ckey>StandardErrorPath\u003C\u002Fkey>\n    \u003Cstring>\u002FUsers\u002F$(whoami)\u002Fxiaohongshu-mcp\u002Fmcp.log\u003C\u002Fstring>\n    \u003Ckey>EnvironmentVariables\u003C\u002Fkey>\n    \u003Cdict\u002F>\n\u003C\u002Fdict>\n\u003C\u002Fplist>\nEOFPLIST\n\n# 加载服务\nlaunchctl unload \"$XHS_PLIST\" 2>\u002Fdev\u002Fnull\nlaunchctl load \"$XHS_PLIST\"\necho \"✅ launchd 服务已加载\"\n```\n\n#### Linux — systemd\n\n```bash\nsudo tee \u002Fetc\u002Fsystemd\u002Fsystem\u002Fxhs-mcp.service > \u002Fdev\u002Fnull \u003C\u003C 'EOFSYSTEMD'\n[Unit]\nDescription=Xiaohongshu MCP Service\nAfter=network.target\n\n[Service]\nWorkingDirectory=\u002Froot\u002Fxiaohongshu-mcp\nExecStart=\u002Froot\u002Fxiaohongshu-mcp\u002Fxhs-mcp server --port 18060\nRestart=always\nRestartSec=5\nStandardOutput=append:\u002Froot\u002Fxiaohongshu-mcp\u002Fmcp.log\nStandardError=append:\u002Froot\u002Fxiaohongshu-mcp\u002Fmcp.log\n\n[Install]\nWantedBy=multi-user.target\nEOFSYSTEMD\n\nsudo systemctl daemon-reload\nsudo systemctl enable xhs-mcp\nsudo systemctl start xhs-mcp\necho \"✅ systemd 服务已启动\"\n```\n\n### 2.5 创建看门狗脚本（自动恢复崩溃）\n\n```bash\ncat > ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh \u003C\u003C 'EOFWATCHDOG'\n#!\u002Fbin\u002Fbash\n# xhs-mcp 看门狗：服务崩溃后自动重启\nPORT=18060\nLOG=~\u002Fxiaohongshu-mcp\u002Fwatchdog.log\n\ncheck() {\n    curl -s --max-time 3 http:\u002F\u002Flocalhost:$PORT\u002Fhealth > \u002Fdev\u002Fnull 2>&1\n}\n\nrestart() {\n    echo \"$(date '+%Y-%m-%d %H:%M:%S') 重启服务...\" >> \"$LOG\"\n    lsof -ti :$PORT | xargs kill -9 2>\u002Fdev\u002Fnull\n    sleep 2\n    cd ~\u002Fxiaohongshu-mcp\n    nohup .\u002Fxhs-mcp server --port $PORT >> ~\u002Fxiaohongshu-mcp\u002Fmcp.log 2>&1 &\n    sleep 3\n    if check; then\n        echo \"$(date '+%Y-%m-%d %H:%M:%S') 重启成功\" >> \"$LOG\"\n    fi\n}\n\nif ! check; then\n    restart\nfi\nEOFWATCHDOG\nchmod +x ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh\n\n# macOS: 添加定期检查到 crontab\n(crontab -l 2>\u002Fdev\u002Fnull | grep -v watchdog; echo \"*\u002F5 * * * * ~\u002Fxiaohongshu-mcp\u002Fwatchdog.sh\") | crontab -\necho \"✅ 看门狗已配置（每5分钟检查一次）\"\n```\n\n---\n\n## 三、验证安装\n\n### 3.1 服务健康检查\n\n```bash\n# 检查进程\nps aux | grep -i xhs-mcp | grep -v grep\n\n# 检查端口\nlsof -i :18060 | grep LISTEN\n\n# 检查登录状态（调用 MCP）\nMCP_URL=\"http:\u002F\u002Flocalhost:18060\u002Fmcp\"\nSESSION_ID=$(curl -s -D \u002Ftmp\u002Fxhs_check -X POST \"$MCP_URL\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"openclaw\",\"version\":\"1.0\"}},\"id\":1}' > \u002Fdev\u002Fnull \\\n  && grep -i 'Mcp-Session-Id' \u002Ftmp\u002Fxhs_check | tr -d '\\r' | awk '{print $2}')\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Finitialized\",\"params\":{}}' > \u002Fdev\u002Fnull\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools\u002Fcall\",\"params\":{\"name\":\"check_login_status\",\"arguments\":{}},\"id\":2}'\n```\n\n### 3.2 判断结果\n\n| 输出 | 含义 | 操作 |\n|------|------|------|\n| `✅ 已在运行` + `✅ 已下载` | 已安装，跳过 | 静默完成 |\n| 服务启动成功 + 登录状态正常 | 全新安装完成 | 告知用户 |\n| 服务启动成功 + `❌ 未登录` | 需扫码登录 | 进入登录流程 |\n| ❌ 启动失败 | 下载或权限问题 | 查看日志排查 |\n\n---\n\n## 四、扫码登录（如需要）\n\n### 方式一：直接获取二维码（推荐）\n\n```bash\nMCP_URL=\"http:\u002F\u002Flocalhost:18060\u002Fmcp\"\nSESSION_ID=$(curl -s -D \u002Ftmp\u002Fxhs_qr_h -X POST \"$MCP_URL\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"openclaw\",\"version\":\"1.0\"}},\"id\":1}' > \u002Fdev\u002Fnull \\\n  && grep -i 'Mcp-Session-Id' \u002Ftmp\u002Fxhs_qr_h | tr -d '\\r' | awk '{print $2}')\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"notifications\u002Finitialized\",\"params\":{}}' > \u002Fdev\u002Fnull\ncurl -s -X POST \"$MCP_URL\" -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Mcp-Session-Id: $SESSION_ID\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools\u002Fcall\",\"params\":{\"name\":\"get_login_qrcode\",\"arguments\":{}},\"id\":2}' | \\\n  python3 -c \"\nimport sys,json\nd=json.load(sys.stdin)\ntext=d.get('result',{}).get('content',[{}])[0].get('text','')\n# 提取base64图片\nimport re\nm=re.search(r'data:image\u002Fpng;base64,([A-Za-z0-9+\u002F=]+)', text)\nif m:\n    open('\u002Ftmp\u002Fxhs_qr.png','wb').write(__import__('base64').b64decode(m.group(1)))\n    print('二维码已保存到 \u002Ftmp\u002Fxhs_qr.png')\nelse:\n    print(text)\n\"\n```\n\n### 方式二：Cookie 导入（无需扫码）\n\n用户提供浏览器 Cookie 字符串后，转换为 JSON 保存：\n\n```bash\npython3 -c \"\nimport json, sys\ncookie_str = sys.argv[1].strip()\ncookies = []\nfor pair in cookie_str.split(';'):\n    pair = pair.strip()\n    if '=' not in pair: continue\n    name, value = pair.split('=', 1)\n    cookies.append({\n        'name': name.strip(),\n        'value': value.strip(),\n        'domain': '.xiaohongshu.com',\n        'path': '\u002F',\n        'expires': -1,\n        'httpOnly': name.strip() in ('web_session', 'id_token', 'acw_tc'),\n        'secure': name.strip() in ('web_session', 'id_token'),\n        'session': False,\n        'priority': 'Medium',\n        'sameParty': False,\n        'sourceScheme': 'Secure',\n        'sourcePort': 443\n    })\nwith open('$HOME\u002Fxiaohongshu-mcp\u002Fcookies.json', 'w') as f:\n    json.dump(cookies, f, ensure_ascii=False)\nprint(f'已保存 {len(cookies)} 个 Cookie')\n\" '用户粘贴的cookie字符串'\n```\n\n---\n\n## 五、故障排查\n\n```bash\n# 服务状态\nps aux | grep xhs-mcp | grep -v grep\nlsof -i :18060\n\n# 查看日志\ntail -30 ~\u002Fxiaohongshu-mcp\u002Fmcp.log\n\n# 重启服务（macOS）\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\nlaunchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist\n\n# 重启服务（Linux）\nsudo systemctl restart xhs-mcp\n\n# 卸载服务\nlaunchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fcom.openclaw.xhs-mcp.plist 2>\u002Fdev\u002Fnull\nsudo systemctl disable xhs-mcp 2>\u002Fdev\u002Fnull\n```\n\n---\n\n## 六、安装完成告知模板\n\n安装成功后，告知用户：\n\n> ✅ **小红书 MCP 安装完成！**\n>\n> 🐹 服务已就绪，后台运行中\n> 📍 端口：18060\n> 🔄 开机自启：已配置\n> 🐕 看门狗：每5分钟自动检查\n>\n> 📌 下一步：用小红书APP扫码登录（告诉我就行，我会发二维码给你）\n",{"name":5,"metadata":24,"description":7},{"openclaw":25},{"emoji":26,"requires":27},"📕",{"bins":28},[29],"curl","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fx\u002Fxhs-mcp-installer",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill xhs-mcp-installer",{"tool":45,"command":46},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill xhs-mcp-installer",{"tool":48,"command":49},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill xhs-mcp-installer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fx\u002Fxhs-mcp-installer\u002FSKILL.md",true,[],[54,61,68,75,82,89],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]