diff --git a/agent/manifest.json b/agent/manifest.json index e0a8a0d..5583f2f 100644 --- a/agent/manifest.json +++ b/agent/manifest.json @@ -4,8 +4,8 @@ "mcp": true, "files": { "agent/profile.json": "c0051a351c446d4135642cda3af37d302bc83b9c74ddfafc1dc68545e41249d6", - "skills/oneclickvirt-backtrace/SKILL.md": "6627224a6ddd3637291d3cb03793ae29fe798561d38462674baa075940738213", - "skills/oneclickvirt-backtrace/SKILL_ZH.md": "88e3e6d9561f17c53e1b7af0d601c9c7878341a8c4f54256b56da92087c15472", - "agent/server.py": "c54981973f8d98e6eada6e0442f3d7e5c9296947706c2c5d33b80b7f9a1c9b5b" + "skills/oneclickvirt-backtrace/SKILL.md": "c077e85bc032b2acd2aaff9163aa6df541d9013ab5a41a7986aabc8875148b32", + "skills/oneclickvirt-backtrace/SKILL_ZH.md": "4734522f932f22d713fa9d80b701d709b0df8bc00333862ec2866eb5103b7302", + "agent/server.py": "f4fe673f355a9b8ab06b4f8c1f90251e0ad79e1d9324ee4d62eff5e12ac45b74" } } diff --git a/agent/server.py b/agent/server.py index 3e26e0a..4ae2c2a 100644 --- a/agent/server.py +++ b/agent/server.py @@ -80,7 +80,7 @@ def execute(argv, timeout=30, cwd=None, parse_json=True): stdout, stderr = out.read(LIMIT + 1), err.read(16385) if proc.returncode: raise ValueError("Command failed (exit %s): %s" % ( - proc.returncode, stderr[:16384].decode("utf-8", "replace"))) + proc.returncode, (stderr[:16384] or stdout[:16384]).decode("utf-8", "replace"))) if len(stdout) > LIMIT: raise ValueError("Command result exceeds 1 MiB; narrow the request") text = stdout.decode("utf-8", "replace").strip() diff --git a/scripts/install_agent.py b/scripts/install_agent.py index 784b9bc..37454f4 100644 --- a/scripts/install_agent.py +++ b/scripts/install_agent.py @@ -177,6 +177,15 @@ def install(manifest, payload, skill_dir, mcp_dir, record, skill_only=False, bin config = {"mcpServers": {SKILL_NAME: {"command": sys.executable, "args": [str(mcp_dir / "server.py")], "env": env}}} writes[skill_dir / "mcp.example.json"] = (json.dumps(config, ensure_ascii=False, indent=2) + "\n").encode() + writes[skill_dir / "mcp.claude.json"] = writes[skill_dir / "mcp.example.json"] + server = dict(config["mcpServers"][SKILL_NAME], requestTimeoutMs=180000) + writes[skill_dir / "mcp.openclaw.json"] = (json.dumps({"mcp": {"servers": {SKILL_NAME: server}}}, ensure_ascii=False, indent=2) + "\n").encode() + toml = "[mcp_servers." + SKILL_NAME + "]\ncommand = " + json.dumps(sys.executable, ensure_ascii=False) + toml += "\nargs = " + json.dumps([str(mcp_dir / "server.py")], ensure_ascii=False) + "\ntool_timeout_sec = 180\n" + if env: + toml += "\n[mcp_servers." + SKILL_NAME + ".env]\n" + toml += "".join(key + " = " + json.dumps(value, ensure_ascii=False) + "\n" for key, value in env.items()) + writes[skill_dir / "mcp.codex.toml"] = toml.encode("utf-8") record = dict(record, repository=REPOSITORY, skill_name=SKILL_NAME, mcp_installed=bool(has_mcp), files=manifest["files"]) writes[skill_dir / "install.json"] = (json.dumps(record, indent=2) + "\n").encode() @@ -239,7 +248,8 @@ def main(): args.skill_only, binary, binary_content) print(json.dumps(result, ensure_ascii=False, indent=2)) if result["mcp_installed"]: - print("Merge mcp.example.json into your client's MCP settings. Existing settings and tokens were not modified.") + filename = {"codex": "mcp.codex.toml", "claude": "mcp.claude.json", "openclaw": "mcp.openclaw.json"}[args.client] + print("Merge " + filename + " into your client's MCP settings. Existing settings and tokens were not modified.") else: print("Installed Skill files. This repository does not install an MCP server in this mode.") diff --git a/skills/oneclickvirt-backtrace/SKILL.md b/skills/oneclickvirt-backtrace/SKILL.md index 13e7cc6..219fd1c 100644 --- a/skills/oneclickvirt-backtrace/SKILL.md +++ b/skills/oneclickvirt-backtrace/SKILL.md @@ -29,7 +29,7 @@ Use `--client claude` or `--client openclaw` for another client. Download and ru ## MCP -Requires Python 3.9+. The adapter uses existing local commands and their existing permissions; it does not install a virtualization runtime. Merge the installed `mcp.example.json` into the client configuration. For a remote host, run its adapter over noninteractive SSH. +Requires Python 3.9+. The adapter uses existing local commands and their existing permissions; it does not install a virtualization runtime. Merge the generated `mcp.codex.toml`, `mcp.claude.json`, or `mcp.openclaw.json` into that client's existing configuration. For a remote host, run its adapter over noninteractive SSH. ```bash python3 install_agent.py --client codex --install-binary diff --git a/skills/oneclickvirt-backtrace/SKILL_ZH.md b/skills/oneclickvirt-backtrace/SKILL_ZH.md index 325687d..2a96abd 100644 --- a/skills/oneclickvirt-backtrace/SKILL_ZH.md +++ b/skills/oneclickvirt-backtrace/SKILL_ZH.md @@ -29,7 +29,7 @@ python3 install_agent.py --client codex ## MCP -运行需要 Python 3.9 以上版本;MCP 使用本机已有程序及其权限,不自动安装虚拟化环境。将安装目录内 `mcp.example.json` 合并到客户端配置。远端宿主机应通过无交互 SSH 运行该主机上的适配器。 +运行需要 Python 3.9 以上版本;MCP 使用本机已有程序及其权限,不自动安装虚拟化环境。将安装目录内对应客户端的 `mcp.codex.toml`、`mcp.claude.json` 或 `mcp.openclaw.json` 合并到已有配置。远端宿主机应通过无交互 SSH 运行该主机上的适配器。 ```bash python3 install_agent.py --client codex --install-binary