Merge pull request #45 from Panniantong/fix/xiaohongshu-arm64-support
fix: ARM64/Apple Silicon support for xiaohongshu-mcp Docker setup
This commit is contained in:
@@ -1,11 +1,33 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""XiaoHongShu — check if mcporter + xiaohongshu MCP is available."""
|
"""XiaoHongShu -- check if mcporter + xiaohongshu MCP is available."""
|
||||||
|
|
||||||
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from .base import Channel
|
from .base import Channel
|
||||||
|
|
||||||
|
|
||||||
|
def _is_arm64() -> bool:
|
||||||
|
"""Detect ARM64 architecture (e.g. Apple Silicon)."""
|
||||||
|
machine = platform.machine().lower()
|
||||||
|
return machine in ("arm64", "aarch64")
|
||||||
|
|
||||||
|
|
||||||
|
def _docker_run_hint() -> str:
|
||||||
|
"""Return the docker run command, with --platform flag for ARM64."""
|
||||||
|
if _is_arm64():
|
||||||
|
return (
|
||||||
|
" docker run -d --name xiaohongshu-mcp -p 18060:18060 "
|
||||||
|
"--platform linux/amd64 xpzouying/xiaohongshu-mcp\n"
|
||||||
|
" # ARM64 also: build from source: "
|
||||||
|
"https://github.com/xpzouying/xiaohongshu-mcp"
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
" docker run -d --name xiaohongshu-mcp -p 18060:18060 "
|
||||||
|
"xpzouying/xiaohongshu-mcp"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class XiaoHongShuChannel(Channel):
|
class XiaoHongShuChannel(Channel):
|
||||||
name = "xiaohongshu"
|
name = "xiaohongshu"
|
||||||
description = "小红书笔记"
|
description = "小红书笔记"
|
||||||
@@ -22,7 +44,7 @@ class XiaoHongShuChannel(Channel):
|
|||||||
return "off", (
|
return "off", (
|
||||||
"需要 mcporter + xiaohongshu-mcp。安装步骤:\n"
|
"需要 mcporter + xiaohongshu-mcp。安装步骤:\n"
|
||||||
" 1. npm install -g mcporter\n"
|
" 1. npm install -g mcporter\n"
|
||||||
" 2. docker run -d --name xiaohongshu-mcp -p 18060:18060 xpzouying/xiaohongshu-mcp\n"
|
" 2. " + _docker_run_hint().strip() + "\n"
|
||||||
" 3. mcporter config add xiaohongshu http://localhost:18060/mcp\n"
|
" 3. mcporter config add xiaohongshu http://localhost:18060/mcp\n"
|
||||||
" 详见 https://github.com/xpzouying/xiaohongshu-mcp"
|
" 详见 https://github.com/xpzouying/xiaohongshu-mcp"
|
||||||
)
|
)
|
||||||
@@ -33,7 +55,7 @@ class XiaoHongShuChannel(Channel):
|
|||||||
if "xiaohongshu" not in r.stdout:
|
if "xiaohongshu" not in r.stdout:
|
||||||
return "off", (
|
return "off", (
|
||||||
"mcporter 已装但小红书 MCP 未配置。运行:\n"
|
"mcporter 已装但小红书 MCP 未配置。运行:\n"
|
||||||
" docker run -d --name xiaohongshu-mcp -p 18060:18060 xpzouying/xiaohongshu-mcp\n"
|
+ _docker_run_hint() + "\n"
|
||||||
" mcporter config add xiaohongshu http://localhost:18060/mcp"
|
" mcporter config add xiaohongshu http://localhost:18060/mcp"
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -67,5 +67,25 @@ docker run -d \
|
|||||||
**Q: 服务器上小红书提示 IP 风险?**
|
**Q: 服务器上小红书提示 IP 风险?**
|
||||||
A: 加代理参数 `-e XHS_PROXY=http://user:pass@ip:port`,推荐住宅代理。
|
A: 加代理参数 `-e XHS_PROXY=http://user:pass@ip:port`,推荐住宅代理。
|
||||||
|
|
||||||
|
**Q: Docker 镜像不支持 ARM64 / Apple Silicon?**
|
||||||
|
A: 上游镜像暂无 ARM64 版本,两种解决办法:
|
||||||
|
|
||||||
|
方法一:使用 Rosetta 模拟运行(推荐,最简单)
|
||||||
|
```bash
|
||||||
|
docker run -d \
|
||||||
|
--name xiaohongshu-mcp \
|
||||||
|
-p 18060:18060 \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
xpzouying/xiaohongshu-mcp
|
||||||
|
```
|
||||||
|
|
||||||
|
方法二:从源码编译原生 ARM64 版本
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/xpzouying/xiaohongshu-mcp
|
||||||
|
cd xiaohongshu-mcp
|
||||||
|
docker build -t xiaohongshu-mcp .
|
||||||
|
docker run -d --name xiaohongshu-mcp -p 18060:18060 xiaohongshu-mcp
|
||||||
|
```
|
||||||
|
|
||||||
**Q: 我不想用 Docker?**
|
**Q: 我不想用 Docker?**
|
||||||
A: 可以从源码编译:https://github.com/xpzouying/xiaohongshu-mcp
|
A: 可以从源码编译:https://github.com/xpzouying/xiaohongshu-mcp
|
||||||
|
|||||||
Reference in New Issue
Block a user