@kwonye/mcpx 0.1.93 → 0.1.95
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/dist/adapters/claude-desktop.d.ts.map +1 -1
- package/dist/adapters/claude.d.ts +2 -1
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/cline.d.ts +3 -1
- package/dist/adapters/cline.d.ts.map +1 -1
- package/dist/adapters/codex.d.ts +2 -1
- package/dist/adapters/codex.d.ts.map +1 -1
- package/dist/adapters/cursor.d.ts +2 -1
- package/dist/adapters/cursor.d.ts.map +1 -1
- package/dist/adapters/hermes.d.ts +11 -0
- package/dist/adapters/hermes.d.ts.map +1 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/kiro.d.ts.map +1 -1
- package/dist/adapters/openclaw.d.ts +11 -0
- package/dist/adapters/openclaw.d.ts.map +1 -0
- package/dist/adapters/opencode.d.ts +2 -1
- package/dist/adapters/opencode.d.ts.map +1 -1
- package/dist/adapters/qwen.d.ts.map +1 -1
- package/dist/adapters/utils/index.d.ts +18 -4
- package/dist/adapters/utils/index.d.ts.map +1 -1
- package/dist/adapters/vscode.d.ts +2 -1
- package/dist/adapters/vscode.d.ts.map +1 -1
- package/dist/{cli-y7ba5qvr.js → cli-28fsxhe3.js} +430 -156
- package/dist/{cli-qvkpwy9w.js → cli-njtbb11m.js} +138 -43
- package/dist/{cli-8vxva0cb.js → cli-tk8bggg5.js} +81 -8
- package/dist/{cli-np0wwh6m.js → cli-v27bt25d.js} +157 -11
- package/dist/{cli-kwyp9ywh.js → cli-wxw1t3rr.js} +941 -303
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +388 -77
- package/dist/compat/hermes.d.ts +7 -0
- package/dist/compat/hermes.d.ts.map +1 -0
- package/dist/compat/index.d.ts.map +1 -1
- package/dist/compat/openclaw.d.ts +7 -0
- package/dist/compat/openclaw.d.ts.map +1 -0
- package/dist/{config-2s5nsm2g.js → config-5p08cb0c.js} +6 -2
- package/dist/core/add-command.d.ts.map +1 -1
- package/dist/core/config-repair.d.ts.map +1 -1
- package/dist/core/config-store.d.ts +33 -0
- package/dist/core/config-store.d.ts.map +1 -0
- package/dist/core/config.d.ts +13 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/daemon.d.ts +5 -1
- package/dist/core/daemon.d.ts.map +1 -1
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +30 -6
- package/dist/core/managed-index-lock.d.ts +2 -0
- package/dist/core/managed-index-lock.d.ts.map +1 -0
- package/dist/core/oauth.d.ts.map +1 -1
- package/dist/core/plugin-host.d.ts +2 -0
- package/dist/core/plugin-host.d.ts.map +1 -0
- package/dist/core/plugin-manager.d.ts +19 -6
- package/dist/core/plugin-manager.d.ts.map +1 -1
- package/dist/core/plugin-parse.d.ts.map +1 -1
- package/dist/core/plugin-projections.d.ts +6 -2
- package/dist/core/plugin-projections.d.ts.map +1 -1
- package/dist/core/registry.d.ts +4 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/secrets.d.ts.map +1 -1
- package/dist/core/server-auth.d.ts.map +1 -1
- package/dist/core/skill-projections.d.ts +3 -0
- package/dist/core/skill-projections.d.ts.map +1 -0
- package/dist/core/status.d.ts +1 -0
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/sync.d.ts +19 -2
- package/dist/core/sync.d.ts.map +1 -1
- package/dist/core/update-manager.d.ts.map +1 -1
- package/dist/gateway/server.d.ts +4 -1
- package/dist/gateway/server.d.ts.map +1 -1
- package/dist/plugin-host-954a7tf7.js +129 -0
- package/dist/{plugin-manager-1sc4b6am.js → plugin-manager-m8ar2271.js} +12 -4
- package/dist/{registry-mztfy0cz.js → registry-n12thgf2.js} +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/cli-m2645syd.js +0 -2199
|
@@ -94,6 +94,12 @@ function parseCliAddCommand(command) {
|
|
|
94
94
|
if (parts[0] === "code" && parts[1] === "--add-mcp") {
|
|
95
95
|
return parseVSCodeAdd(parts[2]);
|
|
96
96
|
}
|
|
97
|
+
if (parts[0] === "openclaw" && parts[1] === "mcp" && parts[2] === "add") {
|
|
98
|
+
return parseOpenClawAdd(parts.slice(3));
|
|
99
|
+
}
|
|
100
|
+
if (parts[0] === "hermes" && parts[1] === "mcp" && parts[2] === "add") {
|
|
101
|
+
return parseHermesAdd(parts.slice(3));
|
|
102
|
+
}
|
|
97
103
|
if (parts[0] === "add") {
|
|
98
104
|
return parseStandardAdd(parts.slice(1));
|
|
99
105
|
}
|
|
@@ -211,6 +217,48 @@ function parseVSCodeAdd(jsonPayload) {
|
|
|
211
217
|
}
|
|
212
218
|
throw new Error("JSON payload must include 'url' or 'command'");
|
|
213
219
|
}
|
|
220
|
+
function parseOpenClawAdd(args) {
|
|
221
|
+
const header = [];
|
|
222
|
+
const env = [];
|
|
223
|
+
let cwd;
|
|
224
|
+
const values = [];
|
|
225
|
+
for (let i = 0;i < args.length; i++) {
|
|
226
|
+
const arg = args[i];
|
|
227
|
+
if (arg === "--header") {
|
|
228
|
+
header.push(args[++i]);
|
|
229
|
+
} else if (arg === "--env") {
|
|
230
|
+
env.push(args[++i]);
|
|
231
|
+
} else if (arg === "--cwd" || arg === "--workingDirectory") {
|
|
232
|
+
cwd = args[++i];
|
|
233
|
+
} else if (arg === "--arg") {
|
|
234
|
+
values.push(args[++i]);
|
|
235
|
+
} else if (arg === "--transport" || arg === "--auth" || arg === "--scope") {
|
|
236
|
+
i++;
|
|
237
|
+
} else {
|
|
238
|
+
values.push(arg);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return buildServerSpec(values, { header, env, cwd });
|
|
242
|
+
}
|
|
243
|
+
function parseHermesAdd(args) {
|
|
244
|
+
const env = [];
|
|
245
|
+
const values = [];
|
|
246
|
+
for (let i = 0;i < args.length; i++) {
|
|
247
|
+
const arg = args[i];
|
|
248
|
+
if (arg === "--env") {
|
|
249
|
+
env.push(args[++i]);
|
|
250
|
+
} else if (arg === "--args") {
|
|
251
|
+
while (i + 1 < args.length && !args[i + 1].startsWith("--")) {
|
|
252
|
+
values.push(args[++i]);
|
|
253
|
+
}
|
|
254
|
+
} else if (arg === "--auth") {
|
|
255
|
+
i++;
|
|
256
|
+
} else {
|
|
257
|
+
values.push(arg);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return buildServerSpec(values, { header: [], env });
|
|
261
|
+
}
|
|
214
262
|
function buildServerSpec(values, options) {
|
|
215
263
|
if (values.length < 2) {
|
|
216
264
|
throw new Error("Usage: add [--transport auto|http|stdio] <name> <url|command> [args...]");
|
|
@@ -317,6 +365,14 @@ function repairConfig(config) {
|
|
|
317
365
|
servers[name] = repaired;
|
|
318
366
|
}
|
|
319
367
|
}
|
|
368
|
+
const existingNames = new Set(Object.keys(servers));
|
|
369
|
+
if (config.projects) {
|
|
370
|
+
for (const project of Object.values(config.projects)) {
|
|
371
|
+
if (project.disabledServers) {
|
|
372
|
+
project.disabledServers = project.disabledServers.filter((s) => existingNames.has(s));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
320
376
|
return {
|
|
321
377
|
...config,
|
|
322
378
|
servers
|
|
@@ -324,6 +380,17 @@ function repairConfig(config) {
|
|
|
324
380
|
}
|
|
325
381
|
|
|
326
382
|
// src/core/config.ts
|
|
383
|
+
class ConfigLoadError extends Error {
|
|
384
|
+
configPath;
|
|
385
|
+
backupPath;
|
|
386
|
+
issues;
|
|
387
|
+
constructor(configPath, message, issues) {
|
|
388
|
+
super(message);
|
|
389
|
+
this.name = "ConfigLoadError";
|
|
390
|
+
this.configPath = configPath;
|
|
391
|
+
this.issues = issues;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
327
394
|
var clientStateSchema = z.object({
|
|
328
395
|
status: z.enum(["SYNCED", "UNSUPPORTED_HTTP", "ERROR", "SKIPPED"]),
|
|
329
396
|
lastSyncAt: z.string().optional(),
|
|
@@ -436,14 +503,34 @@ function defaultConfig() {
|
|
|
436
503
|
};
|
|
437
504
|
}
|
|
438
505
|
function loadConfig(configPath = getConfigPath()) {
|
|
439
|
-
|
|
506
|
+
if (!fs.existsSync(configPath)) {
|
|
507
|
+
return defaultConfig();
|
|
508
|
+
}
|
|
509
|
+
let raw;
|
|
510
|
+
try {
|
|
511
|
+
const content = fs.readFileSync(configPath, "utf8");
|
|
512
|
+
raw = JSON.parse(content);
|
|
513
|
+
} catch (err) {
|
|
514
|
+
const backupPath = `${configPath}.invalid-${Date.now()}`;
|
|
515
|
+
try {
|
|
516
|
+
fs.copyFileSync(configPath, backupPath);
|
|
517
|
+
} catch {}
|
|
518
|
+
const message = `Failed to parse config file at ${configPath}.`;
|
|
519
|
+
throw new ConfigLoadError(configPath, `${message} Backed up to ${backupPath}.`, [`JSON parse error: ${err.message}`]);
|
|
520
|
+
}
|
|
440
521
|
const parsed = configSchema.safeParse(raw);
|
|
441
522
|
if (!parsed.success) {
|
|
442
|
-
|
|
523
|
+
const backupPath = `${configPath}.invalid-${Date.now()}`;
|
|
524
|
+
try {
|
|
525
|
+
fs.copyFileSync(configPath, backupPath);
|
|
526
|
+
} catch {}
|
|
527
|
+
const issues = parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
|
|
528
|
+
const message = `Config file at ${configPath} has validation errors.`;
|
|
529
|
+
throw new ConfigLoadError(configPath, `${message} Backed up to ${backupPath}.`, issues);
|
|
443
530
|
}
|
|
444
531
|
const clientEntries = {};
|
|
445
532
|
for (const [key, value] of Object.entries(parsed.data.clients)) {
|
|
446
|
-
if (["claude", "claude-desktop", "codex", "cursor", "cline", "opencode", "kiro", "vscode", "qwen"].includes(key)) {
|
|
533
|
+
if (["claude", "claude-desktop", "codex", "cursor", "cline", "opencode", "kiro", "vscode", "qwen", "openclaw", "hermes"].includes(key)) {
|
|
447
534
|
clientEntries[key] = value;
|
|
448
535
|
}
|
|
449
536
|
}
|
|
@@ -461,7 +548,18 @@ function saveConfig(config, configPath = getConfigPath()) {
|
|
|
461
548
|
config.servers = Object.fromEntries(Object.entries(config.servers).map(([name, spec]) => [name, normalizeServerSpecEnabled(spec)]));
|
|
462
549
|
writeJsonAtomic(configPath, config);
|
|
463
550
|
}
|
|
464
|
-
function loadProjectConfig(projectConfigPath) {
|
|
551
|
+
function loadProjectConfig(projectConfigPath, options) {
|
|
552
|
+
if (options?.strict) {
|
|
553
|
+
const raw2 = readJsonFile(projectConfigPath, null);
|
|
554
|
+
if (raw2 === null) {
|
|
555
|
+
return { servers: {} };
|
|
556
|
+
}
|
|
557
|
+
const parsed2 = projectConfigSchema.safeParse(raw2);
|
|
558
|
+
if (!parsed2.success) {
|
|
559
|
+
throw new ConfigLoadError(projectConfigPath, `Project config at ${projectConfigPath} has validation errors.`, parsed2.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`));
|
|
560
|
+
}
|
|
561
|
+
return parsed2.data;
|
|
562
|
+
}
|
|
465
563
|
const raw = readJsonFile(projectConfigPath, { servers: {} });
|
|
466
564
|
const parsed = projectConfigSchema.safeParse(raw);
|
|
467
565
|
if (!parsed.success) {
|
|
@@ -498,28 +596,76 @@ function loadMergedConfig(configPath = getConfigPath()) {
|
|
|
498
596
|
}
|
|
499
597
|
return config;
|
|
500
598
|
}
|
|
599
|
+
function migrateProjectServers(config, projectPath) {
|
|
600
|
+
const localConfigPath = path.join(projectPath, ".mcpx.json");
|
|
601
|
+
if (!fs.existsSync(localConfigPath)) {
|
|
602
|
+
return { migrated: [], conflicts: [] };
|
|
603
|
+
}
|
|
604
|
+
const migrated = [];
|
|
605
|
+
const conflicts = [];
|
|
606
|
+
try {
|
|
607
|
+
const localConfig = loadProjectConfig(localConfigPath);
|
|
608
|
+
for (const [serverName, spec] of Object.entries(localConfig.servers)) {
|
|
609
|
+
if (config.servers[serverName]) {
|
|
610
|
+
conflicts.push(serverName);
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
const normalized = normalizeServerSpecEnabled(spec);
|
|
614
|
+
if (normalized.transport === "stdio" && !normalized.cwd) {
|
|
615
|
+
normalized.cwd = projectPath;
|
|
616
|
+
}
|
|
617
|
+
config.servers[serverName] = normalized;
|
|
618
|
+
migrated.push(serverName);
|
|
619
|
+
}
|
|
620
|
+
} catch {}
|
|
621
|
+
return { migrated, conflicts };
|
|
622
|
+
}
|
|
501
623
|
function resolveActiveConfig(options = {}) {
|
|
502
624
|
const globalPath = getConfigPath();
|
|
503
|
-
const
|
|
625
|
+
const globalConfig = loadConfig(globalPath);
|
|
504
626
|
if (!options.global) {
|
|
505
627
|
const projectConfigPath = findProjectConfigPath();
|
|
506
|
-
if (options.local
|
|
628
|
+
if (options.local) {
|
|
507
629
|
const projectPath = projectConfigPath ? path.dirname(projectConfigPath) : process.cwd();
|
|
630
|
+
const localPath = path.join(projectPath, ".mcpx.json");
|
|
631
|
+
const projectConfig = loadProjectConfig(localPath);
|
|
632
|
+
const mergedConfig = {
|
|
633
|
+
...globalConfig,
|
|
634
|
+
servers: { ...globalConfig.servers, ...projectConfig.servers }
|
|
635
|
+
};
|
|
636
|
+
return {
|
|
637
|
+
type: "project",
|
|
638
|
+
configPath: localPath,
|
|
639
|
+
projectPath,
|
|
640
|
+
config: mergedConfig,
|
|
641
|
+
save: () => {
|
|
642
|
+
const localServers = {};
|
|
643
|
+
for (const [name, spec] of Object.entries(mergedConfig.servers)) {
|
|
644
|
+
if (!(name in globalConfig.servers)) {
|
|
645
|
+
localServers[name] = spec;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
saveProjectConfig({ ...projectConfig, servers: localServers }, localPath);
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if (projectConfigPath) {
|
|
653
|
+
const projectPath = path.dirname(projectConfigPath);
|
|
508
654
|
return {
|
|
509
655
|
type: "project",
|
|
510
656
|
configPath: globalPath,
|
|
511
657
|
projectPath,
|
|
512
|
-
config,
|
|
513
|
-
save: () => saveConfig(
|
|
658
|
+
config: globalConfig,
|
|
659
|
+
save: () => saveConfig(globalConfig, globalPath)
|
|
514
660
|
};
|
|
515
661
|
}
|
|
516
662
|
}
|
|
517
663
|
return {
|
|
518
664
|
type: "global",
|
|
519
665
|
configPath: globalPath,
|
|
520
|
-
config,
|
|
521
|
-
save: () => saveConfig(
|
|
666
|
+
config: globalConfig,
|
|
667
|
+
save: () => saveConfig(globalConfig, globalPath)
|
|
522
668
|
};
|
|
523
669
|
}
|
|
524
670
|
|
|
525
|
-
export { tokenizeCommandLine, parseCliAddCommand, defaultConfig, loadConfig, saveConfig, loadProjectConfig, saveProjectConfig, loadMergedConfig, resolveActiveConfig };
|
|
671
|
+
export { tokenizeCommandLine, parseCliAddCommand, ConfigLoadError, defaultConfig, loadConfig, saveConfig, loadProjectConfig, saveProjectConfig, loadMergedConfig, migrateProjectServers, resolveActiveConfig };
|