@kwonye/mcpx 0.1.91 → 0.1.94
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 +2 -1
- 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.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/kiro.d.ts +2 -1
- package/dist/adapters/kiro.d.ts.map +1 -1
- package/dist/adapters/opencode.d.ts.map +1 -1
- package/dist/adapters/qwen.d.ts +2 -1
- package/dist/adapters/qwen.d.ts.map +1 -1
- package/dist/adapters/utils/index.d.ts +11 -3
- 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-b83jnbz7.js → cli-154shqmt.js} +180 -1717
- package/dist/cli-9fmn9y72.js +923 -0
- package/dist/{cli-btx8jwra.js → cli-csfsg1yf.js} +136 -8
- package/dist/{cli-grafmdtc.js → cli-mxmgxdm2.js} +181 -1718
- package/dist/cli-n8vt375e.js +2082 -0
- package/dist/{cli-qfvawh8e.js → cli-tk8bggg5.js} +82 -9
- package/dist/{cli-zbbeadz8.js → cli-zjepj3sj.js} +7 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +172 -20
- package/dist/{config-nkgc4c4n.js → config-dtc3c79c.js} +7 -3
- package/dist/core/config-repair.d.ts.map +1 -1
- package/dist/core/config-store.d.ts +3 -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 +1 -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 +14 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +133 -12
- package/dist/core/oauth.d.ts.map +1 -1
- package/dist/core/paths.d.ts +4 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/plugin-cache.d.ts +21 -0
- package/dist/core/plugin-cache.d.ts.map +1 -0
- package/dist/core/plugin-data.d.ts +29 -0
- package/dist/core/plugin-data.d.ts.map +1 -0
- package/dist/core/plugin-lifecycle.d.ts +8 -0
- package/dist/core/plugin-lifecycle.d.ts.map +1 -0
- package/dist/core/plugin-manager.d.ts +52 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-parse.d.ts +6 -0
- package/dist/core/plugin-parse.d.ts.map +1 -0
- package/dist/core/plugin-projections.d.ts +9 -0
- package/dist/core/plugin-projections.d.ts.map +1 -0
- package/dist/core/plugin-source.d.ts +5 -0
- package/dist/core/plugin-source.d.ts.map +1 -0
- 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/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/gateway/server.d.ts +4 -1
- package/dist/gateway/server.d.ts.map +1 -1
- package/dist/plugin-manager-1sjwfnah.js +31 -0
- package/dist/{registry-vykv33et.js → registry-n12thgf2.js} +2 -2
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getConfigPath,
|
|
4
4
|
readJsonFile,
|
|
5
5
|
writeJsonAtomic
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-zjepj3sj.js";
|
|
7
7
|
import {
|
|
8
8
|
normalizeServerSpecEnabled
|
|
9
9
|
} from "./cli-s4gspqdf.js";
|
|
@@ -317,6 +317,14 @@ function repairConfig(config) {
|
|
|
317
317
|
servers[name] = repaired;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
+
const existingNames = new Set(Object.keys(servers));
|
|
321
|
+
if (config.projects) {
|
|
322
|
+
for (const project of Object.values(config.projects)) {
|
|
323
|
+
if (project.disabledServers) {
|
|
324
|
+
project.disabledServers = project.disabledServers.filter((s) => existingNames.has(s));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
320
328
|
return {
|
|
321
329
|
...config,
|
|
322
330
|
servers
|
|
@@ -324,6 +332,17 @@ function repairConfig(config) {
|
|
|
324
332
|
}
|
|
325
333
|
|
|
326
334
|
// src/core/config.ts
|
|
335
|
+
class ConfigLoadError extends Error {
|
|
336
|
+
configPath;
|
|
337
|
+
backupPath;
|
|
338
|
+
issues;
|
|
339
|
+
constructor(configPath, message, issues) {
|
|
340
|
+
super(message);
|
|
341
|
+
this.name = "ConfigLoadError";
|
|
342
|
+
this.configPath = configPath;
|
|
343
|
+
this.issues = issues;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
327
346
|
var clientStateSchema = z.object({
|
|
328
347
|
status: z.enum(["SYNCED", "UNSUPPORTED_HTTP", "ERROR", "SKIPPED"]),
|
|
329
348
|
lastSyncAt: z.string().optional(),
|
|
@@ -350,6 +369,57 @@ var projectEntrySchema = z.object({
|
|
|
350
369
|
path: z.string(),
|
|
351
370
|
disabledServers: z.array(z.string()).default([])
|
|
352
371
|
});
|
|
372
|
+
var pluginComponentSchema = z.enum(["mcpServers", "skills", "hooks", "agents", "commands"]);
|
|
373
|
+
var discoveredComponentSchema = z.object({
|
|
374
|
+
id: z.string(),
|
|
375
|
+
type: pluginComponentSchema,
|
|
376
|
+
path: z.string(),
|
|
377
|
+
description: z.string().optional()
|
|
378
|
+
});
|
|
379
|
+
var discoveredMcpServerSchema = z.object({
|
|
380
|
+
id: z.string(),
|
|
381
|
+
command: z.string(),
|
|
382
|
+
args: z.array(z.string()).optional(),
|
|
383
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
384
|
+
cwd: z.string().optional()
|
|
385
|
+
});
|
|
386
|
+
var discoveredComponentsSchema = z.object({
|
|
387
|
+
skills: z.array(discoveredComponentSchema).default([]),
|
|
388
|
+
commands: z.array(discoveredComponentSchema).default([]),
|
|
389
|
+
agents: z.array(discoveredComponentSchema).default([]),
|
|
390
|
+
hooks: z.array(discoveredComponentSchema).default([]),
|
|
391
|
+
mcpServers: z.array(discoveredMcpServerSchema).default([])
|
|
392
|
+
});
|
|
393
|
+
var managedPluginSchema = z.object({
|
|
394
|
+
id: z.string(),
|
|
395
|
+
name: z.string(),
|
|
396
|
+
source: z.string(),
|
|
397
|
+
version: z.string(),
|
|
398
|
+
ref: z.string(),
|
|
399
|
+
resolvedSha: z.string(),
|
|
400
|
+
installedAt: z.string(),
|
|
401
|
+
root: z.string(),
|
|
402
|
+
dataDir: z.string(),
|
|
403
|
+
components: z.record(pluginComponentSchema, z.boolean()).default({}),
|
|
404
|
+
discovered: discoveredComponentsSchema.default({}),
|
|
405
|
+
enabled: z.boolean().default(true),
|
|
406
|
+
status: z.enum(["healthy", "unhealthy", "preparing", "updating", "error"]).default("healthy"),
|
|
407
|
+
error: z.string().optional(),
|
|
408
|
+
serverNames: z.array(z.string()).default([]),
|
|
409
|
+
projectedClients: z.array(z.string()).default([]),
|
|
410
|
+
approvals: z.object({
|
|
411
|
+
mcpServers: z.boolean().optional(),
|
|
412
|
+
skills: z.boolean().optional(),
|
|
413
|
+
hooks: z.boolean().optional(),
|
|
414
|
+
agents: z.boolean().optional(),
|
|
415
|
+
commands: z.boolean().optional()
|
|
416
|
+
}).optional(),
|
|
417
|
+
projectOverrides: z.record(z.string(), z.object({
|
|
418
|
+
enabled: z.boolean().optional(),
|
|
419
|
+
components: z.record(pluginComponentSchema, z.boolean()).optional(),
|
|
420
|
+
config: z.record(z.string(), z.unknown()).optional()
|
|
421
|
+
})).optional()
|
|
422
|
+
});
|
|
353
423
|
var configSchema = z.object({
|
|
354
424
|
schemaVersion: z.literal(1).default(1),
|
|
355
425
|
gateway: z.object({
|
|
@@ -363,7 +433,8 @@ var configSchema = z.object({
|
|
|
363
433
|
}),
|
|
364
434
|
servers: z.record(z.string(), serverSchema).default({}),
|
|
365
435
|
clients: z.record(z.string(), clientStateSchema).default({}),
|
|
366
|
-
projects: z.record(z.string(), projectEntrySchema).default({})
|
|
436
|
+
projects: z.record(z.string(), projectEntrySchema).default({}),
|
|
437
|
+
plugins: z.record(z.string(), managedPluginSchema).default({})
|
|
367
438
|
});
|
|
368
439
|
var projectConfigSchema = z.object({
|
|
369
440
|
name: z.string().min(1).optional(),
|
|
@@ -379,14 +450,35 @@ function defaultConfig() {
|
|
|
379
450
|
},
|
|
380
451
|
servers: {},
|
|
381
452
|
clients: {},
|
|
382
|
-
projects: {}
|
|
453
|
+
projects: {},
|
|
454
|
+
plugins: {}
|
|
383
455
|
};
|
|
384
456
|
}
|
|
385
457
|
function loadConfig(configPath = getConfigPath()) {
|
|
386
|
-
|
|
458
|
+
if (!fs.existsSync(configPath)) {
|
|
459
|
+
return defaultConfig();
|
|
460
|
+
}
|
|
461
|
+
let raw;
|
|
462
|
+
try {
|
|
463
|
+
const content = fs.readFileSync(configPath, "utf8");
|
|
464
|
+
raw = JSON.parse(content);
|
|
465
|
+
} catch (err) {
|
|
466
|
+
const backupPath = `${configPath}.invalid-${Date.now()}`;
|
|
467
|
+
try {
|
|
468
|
+
fs.copyFileSync(configPath, backupPath);
|
|
469
|
+
} catch {}
|
|
470
|
+
const message = `Failed to parse config file at ${configPath}.`;
|
|
471
|
+
throw new ConfigLoadError(configPath, `${message} Backed up to ${backupPath}.`, [`JSON parse error: ${err.message}`]);
|
|
472
|
+
}
|
|
387
473
|
const parsed = configSchema.safeParse(raw);
|
|
388
474
|
if (!parsed.success) {
|
|
389
|
-
|
|
475
|
+
const backupPath = `${configPath}.invalid-${Date.now()}`;
|
|
476
|
+
try {
|
|
477
|
+
fs.copyFileSync(configPath, backupPath);
|
|
478
|
+
} catch {}
|
|
479
|
+
const issues = parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
|
|
480
|
+
const message = `Config file at ${configPath} has validation errors.`;
|
|
481
|
+
throw new ConfigLoadError(configPath, `${message} Backed up to ${backupPath}.`, issues);
|
|
390
482
|
}
|
|
391
483
|
const clientEntries = {};
|
|
392
484
|
for (const [key, value] of Object.entries(parsed.data.clients)) {
|
|
@@ -400,14 +492,26 @@ function loadConfig(configPath = getConfigPath()) {
|
|
|
400
492
|
gateway: parsed.data.gateway,
|
|
401
493
|
servers,
|
|
402
494
|
clients: clientEntries,
|
|
403
|
-
projects: parsed.data.projects
|
|
495
|
+
projects: parsed.data.projects,
|
|
496
|
+
plugins: parsed.data.plugins
|
|
404
497
|
});
|
|
405
498
|
}
|
|
406
499
|
function saveConfig(config, configPath = getConfigPath()) {
|
|
407
500
|
config.servers = Object.fromEntries(Object.entries(config.servers).map(([name, spec]) => [name, normalizeServerSpecEnabled(spec)]));
|
|
408
501
|
writeJsonAtomic(configPath, config);
|
|
409
502
|
}
|
|
410
|
-
function loadProjectConfig(projectConfigPath) {
|
|
503
|
+
function loadProjectConfig(projectConfigPath, options) {
|
|
504
|
+
if (options?.strict) {
|
|
505
|
+
const raw2 = readJsonFile(projectConfigPath, null);
|
|
506
|
+
if (raw2 === null) {
|
|
507
|
+
return { servers: {} };
|
|
508
|
+
}
|
|
509
|
+
const parsed2 = projectConfigSchema.safeParse(raw2);
|
|
510
|
+
if (!parsed2.success) {
|
|
511
|
+
throw new ConfigLoadError(projectConfigPath, `Project config at ${projectConfigPath} has validation errors.`, parsed2.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`));
|
|
512
|
+
}
|
|
513
|
+
return parsed2.data;
|
|
514
|
+
}
|
|
411
515
|
const raw = readJsonFile(projectConfigPath, { servers: {} });
|
|
412
516
|
const parsed = projectConfigSchema.safeParse(raw);
|
|
413
517
|
if (!parsed.success) {
|
|
@@ -444,6 +548,30 @@ function loadMergedConfig(configPath = getConfigPath()) {
|
|
|
444
548
|
}
|
|
445
549
|
return config;
|
|
446
550
|
}
|
|
551
|
+
function migrateProjectServers(config, projectPath) {
|
|
552
|
+
const localConfigPath = path.join(projectPath, ".mcpx.json");
|
|
553
|
+
if (!fs.existsSync(localConfigPath)) {
|
|
554
|
+
return { migrated: [], conflicts: [] };
|
|
555
|
+
}
|
|
556
|
+
const migrated = [];
|
|
557
|
+
const conflicts = [];
|
|
558
|
+
try {
|
|
559
|
+
const localConfig = loadProjectConfig(localConfigPath);
|
|
560
|
+
for (const [serverName, spec] of Object.entries(localConfig.servers)) {
|
|
561
|
+
if (config.servers[serverName]) {
|
|
562
|
+
conflicts.push(serverName);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
const normalized = normalizeServerSpecEnabled(spec);
|
|
566
|
+
if (normalized.transport === "stdio" && !normalized.cwd) {
|
|
567
|
+
normalized.cwd = projectPath;
|
|
568
|
+
}
|
|
569
|
+
config.servers[serverName] = normalized;
|
|
570
|
+
migrated.push(serverName);
|
|
571
|
+
}
|
|
572
|
+
} catch {}
|
|
573
|
+
return { migrated, conflicts };
|
|
574
|
+
}
|
|
447
575
|
function resolveActiveConfig(options = {}) {
|
|
448
576
|
const globalPath = getConfigPath();
|
|
449
577
|
const config = loadConfig(globalPath);
|
|
@@ -468,4 +596,4 @@ function resolveActiveConfig(options = {}) {
|
|
|
468
596
|
};
|
|
469
597
|
}
|
|
470
598
|
|
|
471
|
-
export { tokenizeCommandLine, parseCliAddCommand, defaultConfig, loadConfig, saveConfig, loadProjectConfig, saveProjectConfig, loadMergedConfig, resolveActiveConfig };
|
|
599
|
+
export { tokenizeCommandLine, parseCliAddCommand, ConfigLoadError, defaultConfig, loadConfig, saveConfig, loadProjectConfig, saveProjectConfig, loadMergedConfig, migrateProjectServers, resolveActiveConfig };
|