@kwonye/mcpx 0.1.77 → 0.1.80
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/adapters/cline.d.ts.map +1 -1
- package/dist/{cli-fsf33sgp.js → cli-08mgt3c8.js} +4 -1
- package/dist/cli-0ztrmp65.js +514 -0
- package/dist/{cli-htm5cf82.js → cli-f2a6pkds.js} +492 -126
- package/dist/{cli-s4py8ckf.js → cli-ma89vavk.js} +42 -11
- package/dist/{cli-f16kphtq.js → cli-wcxyqz7g.js} +493 -127
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +34 -10
- package/dist/{config-kayej21q.js → config-p8tjffpa.js} +2 -2
- package/dist/core/add-command.d.ts +7 -0
- package/dist/core/add-command.d.ts.map +1 -0
- package/dist/core/auth-probe.d.ts +1 -0
- package/dist/core/auth-probe.d.ts.map +1 -1
- package/dist/core/config-repair.d.ts +3 -0
- package/dist/core/config-repair.d.ts.map +1 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/daemon.d.ts.map +1 -1
- package/dist/core/index.d.ts +5 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +25 -5
- package/dist/core/oauth.d.ts +12 -0
- package/dist/core/oauth.d.ts.map +1 -0
- package/dist/core/paths.d.ts +1 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/registry.d.ts +1 -0
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/spawn-env.d.ts +2 -0
- package/dist/core/spawn-env.d.ts.map +1 -0
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/sync.d.ts.map +1 -1
- package/dist/core/update.d.ts +1 -0
- package/dist/core/update.d.ts.map +1 -1
- package/dist/gateway/server.d.ts +5 -1
- package/dist/gateway/server.d.ts.map +1 -1
- package/dist/{registry-1s14wd58.js → registry-b3cetq7x.js} +4 -2
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cli-7bsf6akp.js +0 -202
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ensureParentDir,
|
|
3
|
+
getGatewayTokenPath,
|
|
2
4
|
getSecretNamesPath,
|
|
3
5
|
readJsonFile,
|
|
4
6
|
writeJsonAtomic
|
|
5
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-08mgt3c8.js";
|
|
6
8
|
import {
|
|
7
9
|
__require,
|
|
8
10
|
normalizeServerSpecEnabled
|
|
9
11
|
} from "./cli-s4gspqdf.js";
|
|
10
12
|
|
|
11
13
|
// src/core/registry.ts
|
|
14
|
+
import crypto from "node:crypto";
|
|
15
|
+
import fs from "node:fs";
|
|
12
16
|
import path from "node:path";
|
|
13
17
|
function validateServerName(name) {
|
|
14
18
|
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,62}$/.test(name)) {
|
|
@@ -53,11 +57,38 @@ function getGatewayTokenSecretName(config) {
|
|
|
53
57
|
}
|
|
54
58
|
function ensureGatewayToken(config, secrets) {
|
|
55
59
|
const secretName = getGatewayTokenSecretName(config);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const tokenPath = getGatewayTokenPath(secretName);
|
|
61
|
+
const envValue = process.env[`MCPX_SECRET_${secretName}`];
|
|
62
|
+
if (envValue && envValue.length > 0) {
|
|
63
|
+
return envValue;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const fileValue = fs.readFileSync(tokenPath, "utf8").trim();
|
|
67
|
+
if (fileValue) {
|
|
68
|
+
return fileValue;
|
|
69
|
+
}
|
|
70
|
+
} catch {}
|
|
71
|
+
const keychainValue = secrets.getSecret(secretName);
|
|
72
|
+
if (keychainValue) {
|
|
73
|
+
ensureParentDir(tokenPath);
|
|
74
|
+
fs.writeFileSync(tokenPath, keychainValue, { mode: 384 });
|
|
75
|
+
return keychainValue;
|
|
76
|
+
}
|
|
77
|
+
const token = crypto.randomBytes(32).toString("base64url");
|
|
78
|
+
ensureParentDir(tokenPath);
|
|
79
|
+
fs.writeFileSync(tokenPath, token, { mode: 384 });
|
|
80
|
+
return token;
|
|
81
|
+
}
|
|
82
|
+
function rotateGatewayToken(config, secrets) {
|
|
83
|
+
const secretName = getGatewayTokenSecretName(config);
|
|
84
|
+
const token = crypto.randomBytes(32).toString("base64url");
|
|
85
|
+
const tokenPath = getGatewayTokenPath(secretName);
|
|
86
|
+
ensureParentDir(tokenPath);
|
|
87
|
+
fs.writeFileSync(tokenPath, token, { mode: 384 });
|
|
88
|
+
try {
|
|
89
|
+
secrets.setSecret(secretName, token);
|
|
90
|
+
} catch {}
|
|
91
|
+
return token;
|
|
61
92
|
}
|
|
62
93
|
function registerProject(globalConfig, projectPath, name) {
|
|
63
94
|
if (!globalConfig.projects) {
|
|
@@ -76,8 +107,8 @@ function unregisterProject(globalConfig, projectPath) {
|
|
|
76
107
|
}
|
|
77
108
|
|
|
78
109
|
// src/core/secrets.ts
|
|
79
|
-
import
|
|
80
|
-
import
|
|
110
|
+
import crypto2 from "node:crypto";
|
|
111
|
+
import fs2 from "node:fs";
|
|
81
112
|
var keytarSync = null;
|
|
82
113
|
try {
|
|
83
114
|
const keytar = (()=>{throw new Error("Cannot require module "+"../node_modules/keytar/lib/keytar.js");})();
|
|
@@ -168,7 +199,7 @@ class SecretsManager {
|
|
|
168
199
|
return secret;
|
|
169
200
|
}
|
|
170
201
|
rotateLocalToken(secretName = "local_gateway_token") {
|
|
171
|
-
const token =
|
|
202
|
+
const token = crypto2.randomBytes(32).toString("base64url");
|
|
172
203
|
this.setSecret(secretName, token);
|
|
173
204
|
return token;
|
|
174
205
|
}
|
|
@@ -177,11 +208,11 @@ function readSecretValueFromStdin() {
|
|
|
177
208
|
if (process.stdin.isTTY) {
|
|
178
209
|
throw new Error("No value provided. Use --value or pipe a value via stdin.");
|
|
179
210
|
}
|
|
180
|
-
const content =
|
|
211
|
+
const content = fs2.readFileSync(process.stdin.fd, "utf8").trim();
|
|
181
212
|
if (content.length === 0) {
|
|
182
213
|
throw new Error("Empty secret value provided.");
|
|
183
214
|
}
|
|
184
215
|
return content;
|
|
185
216
|
}
|
|
186
217
|
|
|
187
|
-
export { SecretsManager, readSecretValueFromStdin, validateServerName, addServer, removeServer, updateServer, setServerEnabled, getGatewayTokenSecretName, ensureGatewayToken, registerProject, unregisterProject };
|
|
218
|
+
export { SecretsManager, readSecretValueFromStdin, validateServerName, addServer, removeServer, updateServer, setServerEnabled, getGatewayTokenSecretName, ensureGatewayToken, rotateGatewayToken, registerProject, unregisterProject };
|