@phidiassj/aiyoperps-mcp-installer 0.6.9 → 0.7.0
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/aiyoperps-mcp-installer.js +72 -19
- package/package.json +1 -1
|
@@ -194,20 +194,29 @@ async function detectClaudeDesktop(url) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
async function detectOpenClaw(url) {
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
const
|
|
197
|
+
const openclawCli = runCommand('openclaw', ['--version']);
|
|
198
|
+
const mcporterCli = runCommand('mcporter', ['--version']);
|
|
199
|
+
const configPath = resolveMcporterHomeConfigPath();
|
|
200
|
+
const detected = openclawCli.ok || fileExists(resolveOpenClawConfigPath());
|
|
201
|
+
const supported = openclawCli.ok && (mcporterCli.ok || Boolean(resolveExecutablePath(process.platform === 'win32' ? 'npx.cmd' : 'npx')));
|
|
200
202
|
|
|
201
203
|
let installed = false;
|
|
202
|
-
let reason =
|
|
203
|
-
? '
|
|
204
|
-
:
|
|
205
|
-
? 'config
|
|
206
|
-
:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
204
|
+
let reason = !openclawCli.ok
|
|
205
|
+
? 'openclaw not detected'
|
|
206
|
+
: mcporterCli.ok
|
|
207
|
+
? 'mcporter config helpers available'
|
|
208
|
+
: supported
|
|
209
|
+
? 'mcporter will be used via npx'
|
|
210
|
+
: 'mcporter runtime is unavailable';
|
|
211
|
+
|
|
212
|
+
if (fileExists(configPath)) {
|
|
213
|
+
try {
|
|
214
|
+
const payload = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
215
|
+
installed = Boolean(payload?.mcpServers?.[SERVER_NAME]);
|
|
216
|
+
} catch {
|
|
217
|
+
installed = false;
|
|
218
|
+
}
|
|
219
|
+
|
|
211
220
|
if (installed) {
|
|
212
221
|
reason = 'installed';
|
|
213
222
|
}
|
|
@@ -218,10 +227,10 @@ async function detectOpenClaw(url) {
|
|
|
218
227
|
name: 'OpenClaw',
|
|
219
228
|
kind: 'cli',
|
|
220
229
|
detected,
|
|
221
|
-
supported
|
|
230
|
+
supported,
|
|
222
231
|
installed,
|
|
223
232
|
reason,
|
|
224
|
-
path:
|
|
233
|
+
path: '~/.mcporter/mcporter.json (mcporter home config)',
|
|
225
234
|
install: () => installOpenClaw(url),
|
|
226
235
|
uninstall: () => uninstallOpenClaw()
|
|
227
236
|
};
|
|
@@ -541,17 +550,37 @@ function uninstallClaudeCode() {
|
|
|
541
550
|
}
|
|
542
551
|
|
|
543
552
|
function installOpenClaw(url) {
|
|
544
|
-
const
|
|
545
|
-
|
|
553
|
+
const result = runMcporterCommand([
|
|
554
|
+
'config',
|
|
555
|
+
'add',
|
|
556
|
+
SERVER_NAME,
|
|
557
|
+
url,
|
|
558
|
+
'--scope',
|
|
559
|
+
'home'
|
|
560
|
+
]);
|
|
546
561
|
if (!result.ok) {
|
|
547
|
-
throw new Error(result.stderr || '
|
|
562
|
+
throw new Error(result.stderr || 'mcporter config add failed');
|
|
548
563
|
}
|
|
549
564
|
}
|
|
550
565
|
|
|
551
566
|
function uninstallOpenClaw() {
|
|
552
|
-
|
|
567
|
+
if (!fileExists(resolveMcporterHomeConfigPath())) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const result = runMcporterCommand([
|
|
572
|
+
'--config',
|
|
573
|
+
resolveMcporterHomeConfigPath(),
|
|
574
|
+
'config',
|
|
575
|
+
'remove',
|
|
576
|
+
SERVER_NAME
|
|
577
|
+
]);
|
|
578
|
+
if (result.stderr && /does not exist/i.test(result.stderr)) {
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
|
|
553
582
|
if (!result.ok) {
|
|
554
|
-
throw new Error(result.stderr || '
|
|
583
|
+
throw new Error(result.stderr || 'mcporter config remove failed');
|
|
555
584
|
}
|
|
556
585
|
}
|
|
557
586
|
|
|
@@ -1094,6 +1123,30 @@ function resolveOpenClawConfigPath() {
|
|
|
1094
1123
|
return path.join(stateDir, 'openclaw.json');
|
|
1095
1124
|
}
|
|
1096
1125
|
|
|
1126
|
+
function resolveMcporterHomeConfigPath() {
|
|
1127
|
+
return path.join(os.homedir(), '.mcporter', 'mcporter.json');
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
function runMcporterCommand(args) {
|
|
1131
|
+
const mcporter = resolveExecutablePath(process.platform === 'win32' ? 'mcporter.cmd' : 'mcporter');
|
|
1132
|
+
if (mcporter) {
|
|
1133
|
+
return runCommand(mcporter, args);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const npx = resolveExecutablePath(process.platform === 'win32' ? 'npx.cmd' : 'npx');
|
|
1137
|
+
if (!npx) {
|
|
1138
|
+
return {
|
|
1139
|
+
ok: false,
|
|
1140
|
+
status: null,
|
|
1141
|
+
stdout: '',
|
|
1142
|
+
stderr: 'mcporter and npx were not found in PATH',
|
|
1143
|
+
error: null
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
return runCommand(npx, ['-y', 'mcporter', ...args]);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1097
1150
|
function runCommand(command, args) {
|
|
1098
1151
|
const result = spawnSync(command, args, {
|
|
1099
1152
|
encoding: 'utf8',
|