deveco-mcp-server 0.1.16 → 0.1.17

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.
Files changed (2) hide show
  1. package/index.js +25 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -38,8 +38,30 @@ function isOfficialChannelInvocation() {
38
38
  const forwardTarget = isOfficialChannelInvocation()
39
39
  ? NEW_PACKAGE_LATEST_SPEC
40
40
  : NEW_PACKAGE_BETA_SPEC;
41
- const passthroughArgs = process.argv.slice(2);
41
+ const rawArgs = process.argv.slice(2);
42
42
  const npmExecPath = process.env.npm_execpath;
43
+ const childEnv = { ...process.env };
44
+
45
+ function normalizePassthroughArgs(args) {
46
+ if (args.length === 0) {
47
+ return [];
48
+ }
49
+
50
+ // npm exec may pass its own argv into child bin in some environments.
51
+ // If that happens, forwarding those args causes recursive "npm exec exec ...".
52
+ const hasNestedExecSignature =
53
+ args[0] === 'exec' ||
54
+ args.includes('deveco-mcp-server') ||
55
+ args.some((arg) => /^@deveco-codegenie\/mcp(@|$)/.test(arg));
56
+
57
+ return hasNestedExecSignature ? [] : args;
58
+ }
59
+
60
+ const passthroughArgs = normalizePassthroughArgs(rawArgs);
61
+
62
+ delete childEnv.npm_config_argv;
63
+ delete childEnv.npm_lifecycle_script;
64
+ delete childEnv.npm_config_call;
43
65
 
44
66
  const command = npmExecPath ? process.execPath : npxCommand;
45
67
  const args = npmExecPath
@@ -49,14 +71,13 @@ const args = npmExecPath
49
71
  '--yes',
50
72
  `--package=${forwardTarget}`,
51
73
  NEW_PACKAGE_EXECUTABLE,
52
- '--',
53
- ...passthroughArgs
74
+ ...(passthroughArgs.length > 0 ? ['--', ...passthroughArgs] : [])
54
75
  ]
55
76
  : ['-y', '--package', forwardTarget, NEW_PACKAGE_EXECUTABLE, ...passthroughArgs];
56
77
 
57
78
  const child = spawn(command, args, {
58
79
  stdio: 'inherit',
59
- env: { ...process.env }
80
+ env: childEnv
60
81
  });
61
82
 
62
83
  child.on('error', (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deveco-mcp-server",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "NPM wrapper for deveco-mcp-server - HarmonyOS development MCP server with platform-specific binaries",
5
5
  "keywords": [
6
6
  "mcp",