mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +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
41
tests/test_mcp_env_defaults.py
Normal file
41
tests/test_mcp_env_defaults.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"""MCP subprocess env: env_schema defaults from registry (Cursor mcpServers.env import)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from runtime.tools.mcp.runtime import McpProcessRuntime
|
||||
|
||||
|
||||
class McpEnvDefaultsTests(unittest.TestCase):
|
||||
@patch("runtime.operations.mcp_env.mcp_local_env_merged", return_value={})
|
||||
def test_env_schema_default_used_when_not_in_os_environ(self, _mock: object) -> None:
|
||||
os.environ.pop("NETX_API_URL", None)
|
||||
try:
|
||||
env = McpProcessRuntime._build_runtime_env(
|
||||
["NETX_API_URL"],
|
||||
{"NETX_API_URL": "http://10.0.0.5:8890"},
|
||||
)
|
||||
assert env is not None
|
||||
self.assertEqual(env.get("NETX_API_URL"), "http://10.0.0.5:8890")
|
||||
finally:
|
||||
pass
|
||||
|
||||
@patch("runtime.operations.mcp_env.mcp_local_env_merged", return_value={})
|
||||
def test_mcp_local_and_os_environ_override_schema_default(self, _mock: object) -> None:
|
||||
os.environ["NETX_API_URL"] = "http://from-host:8890"
|
||||
try:
|
||||
env = McpProcessRuntime._build_runtime_env(
|
||||
["NETX_API_URL"],
|
||||
{"NETX_API_URL": "http://from-schema:8890"},
|
||||
)
|
||||
assert env is not None
|
||||
self.assertEqual(env.get("NETX_API_URL"), "http://from-host:8890")
|
||||
finally:
|
||||
os.environ.pop("NETX_API_URL", None)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue