git clone <repo>
cp .env.example .env && vi .env # 填 NAS 连接信息
./start.sh deps # pip install -r requirements.txt参见 README.md 的「文件路由」节。
- 找到对应域的文件:
zspace/mcp_server/tools/<domain>.py - 加
@mcp.tool()装饰的 async 函数 - 调
_main.nas.post("/nas/endpoint", {...}) - 用
_to_json()序列化返回 - 提交前验证:
./start.sh mcp启动看X tools registered数字 +1
# zspace/mcp_server/tools/example.py
from zspace.mcp_server import main as _main
from zspace.mcp_server.main import mcp
from zspace.mcp_server.perf import _to_json
@mcp.tool()
async def my_new_tool(param: str) -> str:
"""Tool 描述(给 LLM 看,决定何时调)。"""
return _to_json(await _main.nas.post("/your/endpoint", {"key": param}))- 创建
skills/<name>/SKILL.md(frontmatter 含name+description触发词) - (可选)加 Python 脚本做机械活,写操作统一走 MCP tool
- 参考
label-manager或media-organizer的格式
- SSH 进 NAS,找 openresty 配置:
/zspace/applications/services/openresty/nginx/conf/vhost/ - scp pcweb JS bundle 到本地,grep 端点路径
- 用
NasClient探活:POST + form body,调/new/endpoint - 记录到
API.md对应节
feat:新功能(MCP tool / skill / API)fix:修 bugrefactor:重构(不动行为)docs:文档chore:工具/配置
本机冒烟测试(需要 .env 有效):
./start.sh mcp-cfg # 验证 MCP server 能启动
python -c "from zspace.mcp_server import mcp; print(len(mcp._tool_manager._tools))" # 应为 90
curl http://localhost:15050/healthz # 验证 dashboard- 新增 tool 有 docstring(LLM 根据它决定何时调)
- 写 tool 有安全门(fail-closed)
- 没有硬编码敏感信息(device_id/手机号/密码)
- 新 API 端点已记录到
API.md -
./start.sh mcp启动无报错
MIT License。贡献即表示你同意在此许可证下授权你的代码。