@neoline/hostbridge 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/hostbridge.js
CHANGED
|
@@ -19,6 +19,8 @@ if (!existsSync(moduleDir)) {
|
|
|
19
19
|
|
|
20
20
|
const env = { ...process.env };
|
|
21
21
|
env.PYTHONPATH = env.PYTHONPATH ? `${bundledSrc}${delimiter}${env.PYTHONPATH}` : bundledSrc;
|
|
22
|
+
env.HOSTBRIDGE_DEFAULT_MCP_COMMAND = env.HOSTBRIDGE_DEFAULT_MCP_COMMAND || 'npx';
|
|
23
|
+
env.HOSTBRIDGE_DEFAULT_MCP_ARGS = env.HOSTBRIDGE_DEFAULT_MCP_ARGS || JSON.stringify(['-y', '@neoline/hostbridge']);
|
|
22
24
|
|
|
23
25
|
const child = spawn(pythonPath, ['-m', 'server_control_mcp', ...process.argv.slice(2)], {
|
|
24
26
|
stdio: 'inherit',
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -228,12 +228,23 @@ def _looks_like_shell_script(command: str, args: list[str]) -> bool:
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
def _default_mcp_command_args() -> tuple[str, list[str]]:
|
|
231
|
+
env_command = os.environ.get("HOSTBRIDGE_DEFAULT_MCP_COMMAND")
|
|
232
|
+
if env_command:
|
|
233
|
+
raw_args = os.environ.get("HOSTBRIDGE_DEFAULT_MCP_ARGS", "[]")
|
|
234
|
+
try:
|
|
235
|
+
parsed_args = json.loads(raw_args)
|
|
236
|
+
except json.JSONDecodeError:
|
|
237
|
+
parsed_args = []
|
|
238
|
+
if not isinstance(parsed_args, list) or not all(isinstance(arg, str) for arg in parsed_args):
|
|
239
|
+
parsed_args = []
|
|
240
|
+
return env_command, parsed_args
|
|
241
|
+
|
|
231
242
|
repo_root = Path(__file__).resolve().parents[2]
|
|
232
243
|
run_server = repo_root / "run_server.py"
|
|
233
244
|
if run_server.exists():
|
|
234
245
|
return "python3", [str(run_server)]
|
|
235
246
|
command = Path(sys.argv[0]).name or PUBLIC_NAME
|
|
236
|
-
if command in (LEGACY_PUBLIC_NAME, LEGACY_PACKAGE_NAME):
|
|
247
|
+
if command in (LEGACY_PUBLIC_NAME, LEGACY_PACKAGE_NAME, "__main__.py"):
|
|
237
248
|
command = PUBLIC_NAME
|
|
238
249
|
return command, []
|
|
239
250
|
|