@01.software/cli 0.7.0 → 0.7.1
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/index.js +29 -23
- package/dist/index.js.map +1 -1
- package/dist/mcp/chunk-3ZSKJM43.js +5395 -0
- package/dist/mcp/chunk-3ZSKJM43.js.map +1 -0
- package/dist/mcp/http.js +291 -0
- package/dist/mcp/http.js.map +1 -0
- package/dist/mcp/stdio.js +20 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/dist/mcp/vercel.d.ts +5 -0
- package/dist/mcp/vercel.js +5669 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -440,17 +440,6 @@ function exitWithError(error, options = {}) {
|
|
|
440
440
|
function isValidBearerToken(secret) {
|
|
441
441
|
return secret.startsWith("sk01_") || secret.startsWith("pat01_");
|
|
442
442
|
}
|
|
443
|
-
var tenantHeaderInterceptorInstalled = false;
|
|
444
|
-
function installTenantHeaderInterceptor(tenantId) {
|
|
445
|
-
if (tenantHeaderInterceptorInstalled) return;
|
|
446
|
-
tenantHeaderInterceptorInstalled = true;
|
|
447
|
-
const originalFetch = globalThis.fetch.bind(globalThis);
|
|
448
|
-
globalThis.fetch = async (input, init) => {
|
|
449
|
-
const headers = new Headers(init?.headers);
|
|
450
|
-
if (!headers.has("X-Tenant-Id")) headers.set("X-Tenant-Id", tenantId);
|
|
451
|
-
return originalFetch(input, { ...init, headers });
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
443
|
function resolveClient(apiKeyFlag) {
|
|
455
444
|
let publishableKey = process.env.SOFTWARE_PUBLISHABLE_KEY;
|
|
456
445
|
let secretKey = apiKeyFlag ?? process.env.SOFTWARE_SECRET_KEY;
|
|
@@ -460,7 +449,7 @@ function resolveClient(apiKeyFlag) {
|
|
|
460
449
|
if (local) {
|
|
461
450
|
publishableKey = publishableKey ?? local.publishableKey;
|
|
462
451
|
secretKey = secretKey ?? local.secretKey;
|
|
463
|
-
tenantId = local.tenantId;
|
|
452
|
+
tenantId = tenantId ?? local.tenantId;
|
|
464
453
|
}
|
|
465
454
|
}
|
|
466
455
|
if (!publishableKey || !secretKey) {
|
|
@@ -495,10 +484,16 @@ function resolveClient(apiKeyFlag) {
|
|
|
495
484
|
}
|
|
496
485
|
});
|
|
497
486
|
}
|
|
498
|
-
if (tenantId) installTenantHeaderInterceptor(tenantId);
|
|
499
487
|
const serverOptions = { publishableKey, secretKey, tenantId };
|
|
500
488
|
return {
|
|
501
|
-
collections: new CollectionClient(
|
|
489
|
+
collections: new CollectionClient(
|
|
490
|
+
publishableKey,
|
|
491
|
+
secretKey,
|
|
492
|
+
void 0,
|
|
493
|
+
void 0,
|
|
494
|
+
void 0,
|
|
495
|
+
tenantId
|
|
496
|
+
),
|
|
502
497
|
commerce: new ServerCommerceClient(serverOptions),
|
|
503
498
|
publishableKey,
|
|
504
499
|
secretKey
|
|
@@ -1428,13 +1423,28 @@ import { existsSync as existsSync2 } from "fs";
|
|
|
1428
1423
|
import { spawn } from "child_process";
|
|
1429
1424
|
import { fileURLToPath } from "url";
|
|
1430
1425
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1431
|
-
function findStdioEntry() {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1426
|
+
function findStdioEntry(baseDir = __dirname) {
|
|
1427
|
+
const packaged = resolve(baseDir, "mcp/stdio.js");
|
|
1428
|
+
if (existsSync2(packaged)) return packaged;
|
|
1429
|
+
const roots = ["../../../..", "../../..", "../.."];
|
|
1430
|
+
const entries = ["apps/mcp/dist/stdio.js", "apps/mcp/.xmcp/stdio.js"];
|
|
1431
|
+
for (const entry of entries) {
|
|
1432
|
+
for (const root of roots) {
|
|
1433
|
+
const candidate = resolve(baseDir, root, entry);
|
|
1434
|
+
if (existsSync2(candidate)) return candidate;
|
|
1435
|
+
}
|
|
1435
1436
|
}
|
|
1436
1437
|
return null;
|
|
1437
1438
|
}
|
|
1439
|
+
function createMcpEnv(baseEnv, client) {
|
|
1440
|
+
const env = {
|
|
1441
|
+
...baseEnv,
|
|
1442
|
+
SOFTWARE_PUBLISHABLE_KEY: client.publishableKey,
|
|
1443
|
+
SOFTWARE_SECRET_KEY: client.secretKey
|
|
1444
|
+
};
|
|
1445
|
+
delete env.SOFTWARE_TENANT_ID;
|
|
1446
|
+
return env;
|
|
1447
|
+
}
|
|
1438
1448
|
function registerMcpCommands(program2) {
|
|
1439
1449
|
program2.command("mcp").description("Start MCP server over stdio").action(() => {
|
|
1440
1450
|
const client = resolveClient(program2.opts().apiKey);
|
|
@@ -1447,11 +1457,7 @@ function registerMcpCommands(program2) {
|
|
|
1447
1457
|
);
|
|
1448
1458
|
}
|
|
1449
1459
|
const child = spawn(process.execPath, [stdioEntry], {
|
|
1450
|
-
env:
|
|
1451
|
-
...process.env,
|
|
1452
|
-
SOFTWARE_PUBLISHABLE_KEY: client.publishableKey,
|
|
1453
|
-
SOFTWARE_SECRET_KEY: client.secretKey
|
|
1454
|
-
},
|
|
1460
|
+
env: createMcpEnv(process.env, client),
|
|
1455
1461
|
stdio: ["inherit", "inherit", "inherit"]
|
|
1456
1462
|
});
|
|
1457
1463
|
child.on("error", (err) => {
|