@kwonye/mcpx 0.1.87 → 0.1.88
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.d.ts.map +1 -1
- package/dist/{cli-bq7zsrv6.js → cli-btx8jwra.js} +20 -63
- package/dist/{cli-dvj5waat.js → cli-qfvawh8e.js} +32 -5
- package/dist/{cli-t81mwnff.js → cli-vwnh1mqg.js} +106 -64
- package/dist/{cli-7k3vf6tg.js → cli-w4p1t10f.js} +107 -65
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -17
- package/dist/{config-ajxqtkq6.js → config-nkgc4c4n.js} +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -3
- package/dist/core/registry.d.ts +1 -0
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/sync.d.ts.map +1 -1
- package/dist/{registry-j53hz9d4.js → registry-vykv33et.js} +3 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmD1G,qBAAa,aAAc,YAAW,aAAa;IACjD,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;IAEhC,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,YAAY,IAAI,OAAO;IAIvB,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY;IAwE9D,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,GAAG,UAAU;CAoFzE"}
|
|
@@ -347,7 +347,8 @@ var stdioServerSchema = z.object({
|
|
|
347
347
|
var serverSchema = z.discriminatedUnion("transport", [httpServerSchema, stdioServerSchema]);
|
|
348
348
|
var projectEntrySchema = z.object({
|
|
349
349
|
name: z.string(),
|
|
350
|
-
path: z.string()
|
|
350
|
+
path: z.string(),
|
|
351
|
+
disabledServers: z.array(z.string()).default([])
|
|
351
352
|
});
|
|
352
353
|
var configSchema = z.object({
|
|
353
354
|
schemaVersion: z.literal(1).default(1),
|
|
@@ -404,27 +405,7 @@ function loadConfig(configPath = getConfigPath()) {
|
|
|
404
405
|
}
|
|
405
406
|
function saveConfig(config, configPath = getConfigPath()) {
|
|
406
407
|
config.servers = Object.fromEntries(Object.entries(config.servers).map(([name, spec]) => [name, normalizeServerSpecEnabled(spec)]));
|
|
407
|
-
|
|
408
|
-
if (configPath === getConfigPath() && config.projects) {
|
|
409
|
-
for (const [projectPath, projectEntry] of Object.entries(config.projects)) {
|
|
410
|
-
const localPath = path.join(projectPath, ".mcpx.json");
|
|
411
|
-
if (fs.existsSync(localPath)) {
|
|
412
|
-
try {
|
|
413
|
-
const localConfig = loadProjectConfig(localPath);
|
|
414
|
-
const projectName = localConfig.name || projectEntry.name || path.basename(projectPath);
|
|
415
|
-
for (const serverName of Object.keys(localConfig.servers)) {
|
|
416
|
-
const namespacedName = `${projectName}.${serverName}`;
|
|
417
|
-
delete serversToSave[namespacedName];
|
|
418
|
-
}
|
|
419
|
-
} catch {}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
const cleanedConfig = {
|
|
424
|
-
...config,
|
|
425
|
-
servers: serversToSave
|
|
426
|
-
};
|
|
427
|
-
writeJsonAtomic(configPath, cleanedConfig);
|
|
408
|
+
writeJsonAtomic(configPath, config);
|
|
428
409
|
}
|
|
429
410
|
function loadProjectConfig(projectConfigPath) {
|
|
430
411
|
const raw = readJsonFile(projectConfigPath, { servers: {} });
|
|
@@ -443,66 +424,42 @@ function loadMergedConfig(configPath = getConfigPath()) {
|
|
|
443
424
|
if (!config.projects) {
|
|
444
425
|
config.projects = {};
|
|
445
426
|
}
|
|
446
|
-
for (const [projectPath
|
|
427
|
+
for (const [projectPath] of Object.entries(config.projects)) {
|
|
447
428
|
const localPath = path.join(projectPath, ".mcpx.json");
|
|
448
429
|
if (!fs.existsSync(localPath)) {
|
|
449
430
|
continue;
|
|
450
431
|
}
|
|
451
432
|
try {
|
|
452
433
|
const localConfig = loadProjectConfig(localPath);
|
|
453
|
-
const projectName = localConfig.name || projectEntry.name || path.basename(projectPath);
|
|
454
434
|
for (const [serverName, spec] of Object.entries(localConfig.servers)) {
|
|
455
|
-
|
|
435
|
+
if (config.servers[serverName])
|
|
436
|
+
continue;
|
|
456
437
|
const normalized = normalizeServerSpecEnabled(spec);
|
|
457
438
|
if (normalized.transport === "stdio" && !normalized.cwd) {
|
|
458
439
|
normalized.cwd = projectPath;
|
|
459
440
|
}
|
|
460
|
-
config.servers[
|
|
441
|
+
config.servers[serverName] = normalized;
|
|
461
442
|
}
|
|
462
443
|
} catch {}
|
|
463
444
|
}
|
|
464
445
|
return config;
|
|
465
446
|
}
|
|
466
447
|
function resolveActiveConfig(options = {}) {
|
|
467
|
-
if (options.global) {
|
|
468
|
-
const globalPath2 = getConfigPath();
|
|
469
|
-
const config2 = loadConfig(globalPath2);
|
|
470
|
-
return {
|
|
471
|
-
type: "global",
|
|
472
|
-
configPath: globalPath2,
|
|
473
|
-
config: config2,
|
|
474
|
-
save: () => saveConfig(config2, globalPath2)
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
const projectConfigPath = findProjectConfigPath();
|
|
478
|
-
if (options.local || projectConfigPath) {
|
|
479
|
-
const targetPath = projectConfigPath || path.join(process.cwd(), ".mcpx.json");
|
|
480
|
-
const projectPath = path.dirname(targetPath);
|
|
481
|
-
const projectConfig = loadProjectConfig(targetPath);
|
|
482
|
-
const dummyConfig = {
|
|
483
|
-
schemaVersion: 1,
|
|
484
|
-
name: projectConfig.name,
|
|
485
|
-
gateway: {
|
|
486
|
-
port: 37373,
|
|
487
|
-
tokenRef: "secret://local_gateway_token",
|
|
488
|
-
autoStart: true
|
|
489
|
-
},
|
|
490
|
-
servers: projectConfig.servers,
|
|
491
|
-
clients: {}
|
|
492
|
-
};
|
|
493
|
-
return {
|
|
494
|
-
type: "project",
|
|
495
|
-
configPath: targetPath,
|
|
496
|
-
projectPath,
|
|
497
|
-
config: dummyConfig,
|
|
498
|
-
save: () => {
|
|
499
|
-
projectConfig.servers = dummyConfig.servers;
|
|
500
|
-
saveProjectConfig(projectConfig, targetPath);
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
448
|
const globalPath = getConfigPath();
|
|
505
449
|
const config = loadConfig(globalPath);
|
|
450
|
+
if (!options.global) {
|
|
451
|
+
const projectConfigPath = findProjectConfigPath();
|
|
452
|
+
if (options.local || projectConfigPath) {
|
|
453
|
+
const projectPath = projectConfigPath ? path.dirname(projectConfigPath) : process.cwd();
|
|
454
|
+
return {
|
|
455
|
+
type: "project",
|
|
456
|
+
configPath: globalPath,
|
|
457
|
+
projectPath,
|
|
458
|
+
config,
|
|
459
|
+
save: () => saveConfig(config, globalPath)
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}
|
|
506
463
|
return {
|
|
507
464
|
type: "global",
|
|
508
465
|
configPath: globalPath,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
writeJsonAtomic
|
|
8
8
|
} from "./cli-zbbeadz8.js";
|
|
9
9
|
import {
|
|
10
|
+
isServerEnabled,
|
|
10
11
|
normalizeServerSpecEnabled
|
|
11
12
|
} from "./cli-s4gspqdf.js";
|
|
12
13
|
|
|
@@ -88,15 +89,41 @@ function registerProject(globalConfig, projectPath, name) {
|
|
|
88
89
|
if (!globalConfig.projects) {
|
|
89
90
|
globalConfig.projects = {};
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
92
|
+
const resolvedPath = path.resolve(projectPath);
|
|
93
|
+
const projectName = name?.trim() || path.basename(resolvedPath);
|
|
94
|
+
const existing = globalConfig.projects[resolvedPath];
|
|
95
|
+
globalConfig.projects[resolvedPath] = {
|
|
93
96
|
name: projectName,
|
|
94
|
-
path:
|
|
97
|
+
path: resolvedPath,
|
|
98
|
+
disabledServers: existing?.disabledServers ?? []
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
function unregisterProject(globalConfig, projectPath) {
|
|
98
102
|
if (globalConfig.projects) {
|
|
99
|
-
delete globalConfig.projects[projectPath];
|
|
103
|
+
delete globalConfig.projects[path.resolve(projectPath)];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function setProjectServerEnabled(globalConfig, projectPath, serverName, enabled) {
|
|
107
|
+
if (!globalConfig.projects)
|
|
108
|
+
globalConfig.projects = {};
|
|
109
|
+
const resolvedPath = path.resolve(projectPath);
|
|
110
|
+
const project = globalConfig.projects[resolvedPath];
|
|
111
|
+
if (!project) {
|
|
112
|
+
throw new Error(`Project "${resolvedPath}" is not registered.`);
|
|
113
|
+
}
|
|
114
|
+
if (!project.disabledServers) {
|
|
115
|
+
project.disabledServers = [];
|
|
116
|
+
}
|
|
117
|
+
if (enabled) {
|
|
118
|
+
project.disabledServers = project.disabledServers.filter((s) => s !== serverName);
|
|
119
|
+
const serverSpec = globalConfig.servers[serverName];
|
|
120
|
+
if (serverSpec && !isServerEnabled(serverSpec)) {
|
|
121
|
+
globalConfig.servers[serverName] = { ...serverSpec, enabled: true };
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
if (!project.disabledServers.includes(serverName)) {
|
|
125
|
+
project.disabledServers.push(serverName);
|
|
126
|
+
}
|
|
100
127
|
}
|
|
101
128
|
}
|
|
102
129
|
|
|
@@ -233,4 +260,4 @@ function readSecretValueFromStdin() {
|
|
|
233
260
|
return content;
|
|
234
261
|
}
|
|
235
262
|
|
|
236
|
-
export { SecretsManager, readSecretValueFromStdin, validateServerName, addServer, removeServer, updateServer, setServerEnabled, getGatewayTokenSecretName, ensureGatewayToken, rotateGatewayToken, registerProject, unregisterProject };
|
|
263
|
+
export { SecretsManager, readSecretValueFromStdin, validateServerName, addServer, removeServer, updateServer, setServerEnabled, getGatewayTokenSecretName, ensureGatewayToken, rotateGatewayToken, registerProject, unregisterProject, setProjectServerEnabled };
|