mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 04:10:44 +08:00
feat(mcp): integrate netx via netx_mcp and improve MCP install
- Gate builtin netx tools; ops docs/skills use mcp__netx__* - Import Cursor mcpServers JSON; pass env_schema defaults to subprocess - Allow source_type=local; UTF-8 MCP stdio on Windows Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
bbd7b0300f
commit
a0a3f4b65f
17 changed files with 408 additions and 536 deletions
|
|
@ -61,6 +61,8 @@ def _install_command(manifest: McpServerManifest) -> list[str]:
|
|||
if manifest.source_type == "pypi":
|
||||
pkg = manifest.source_ref + (f"=={manifest.version}" if manifest.version else "")
|
||||
return [sys.executable, "-m", "pip", "install", pkg]
|
||||
if manifest.source_type == "local":
|
||||
return []
|
||||
raise ValueError(f"unsupported_source_type:{manifest.source_type}")
|
||||
|
||||
|
||||
|
|
@ -85,6 +87,8 @@ def _uninstall_command(manifest: McpServerManifest) -> list[str]:
|
|||
return [sys.executable, "-m", "pip", "uninstall", "-y", str(manifest.source_ref or "").strip()]
|
||||
if manifest.source_type == "github":
|
||||
return []
|
||||
if manifest.source_type == "local":
|
||||
return []
|
||||
raise ValueError(f"unsupported_source_type:{manifest.source_type}")
|
||||
|
||||
|
||||
|
|
@ -93,6 +97,12 @@ def install_mcp_server(manifest: McpServerManifest, *, dry_run: bool = False) ->
|
|||
cmd = _install_command(manifest)
|
||||
except Exception as exc:
|
||||
return McpInstallResult(ok=False, error_code="mcp_invalid_source", error=str(exc))
|
||||
if manifest.source_type == "local" and not cmd:
|
||||
return McpInstallResult(
|
||||
ok=True,
|
||||
install_command="",
|
||||
details={"skipped": True, "reason": "local_source_no_package_install"},
|
||||
)
|
||||
cmd_text = " ".join(cmd)
|
||||
if dry_run:
|
||||
return McpInstallResult(ok=True, install_command=cmd_text, details={"dry_run": True})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue