@01.software/cli 0.7.0 → 0.8.0
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 +28 -26
- package/dist/index.js.map +1 -1
- package/dist/mcp/chunk-45ZCPS57.js +5443 -0
- package/dist/mcp/chunk-45ZCPS57.js.map +1 -0
- package/dist/mcp/http.js +432 -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 +5856 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -440,27 +440,14 @@ 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;
|
|
457
|
-
let tenantId;
|
|
458
446
|
if (!publishableKey || !secretKey) {
|
|
459
447
|
const local = loadLocalCredentials();
|
|
460
448
|
if (local) {
|
|
461
449
|
publishableKey = publishableKey ?? local.publishableKey;
|
|
462
450
|
secretKey = secretKey ?? local.secretKey;
|
|
463
|
-
tenantId = local.tenantId;
|
|
464
451
|
}
|
|
465
452
|
}
|
|
466
453
|
if (!publishableKey || !secretKey) {
|
|
@@ -468,7 +455,6 @@ function resolveClient(apiKeyFlag) {
|
|
|
468
455
|
if (stored) {
|
|
469
456
|
publishableKey = publishableKey ?? stored.publishableKey;
|
|
470
457
|
secretKey = secretKey ?? stored.secretKey;
|
|
471
|
-
tenantId = tenantId ?? stored.tenantId;
|
|
472
458
|
}
|
|
473
459
|
}
|
|
474
460
|
if (!publishableKey || !secretKey) {
|
|
@@ -495,10 +481,15 @@ function resolveClient(apiKeyFlag) {
|
|
|
495
481
|
}
|
|
496
482
|
});
|
|
497
483
|
}
|
|
498
|
-
|
|
499
|
-
const serverOptions = { publishableKey, secretKey, tenantId };
|
|
484
|
+
const serverOptions = { publishableKey, secretKey };
|
|
500
485
|
return {
|
|
501
|
-
collections: new CollectionClient(
|
|
486
|
+
collections: new CollectionClient(
|
|
487
|
+
publishableKey,
|
|
488
|
+
secretKey,
|
|
489
|
+
void 0,
|
|
490
|
+
void 0,
|
|
491
|
+
void 0
|
|
492
|
+
),
|
|
502
493
|
commerce: new ServerCommerceClient(serverOptions),
|
|
503
494
|
publishableKey,
|
|
504
495
|
secretKey
|
|
@@ -1428,13 +1419,28 @@ import { existsSync as existsSync2 } from "fs";
|
|
|
1428
1419
|
import { spawn } from "child_process";
|
|
1429
1420
|
import { fileURLToPath } from "url";
|
|
1430
1421
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1431
|
-
function findStdioEntry() {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1422
|
+
function findStdioEntry(baseDir = __dirname) {
|
|
1423
|
+
const packaged = resolve(baseDir, "mcp/stdio.js");
|
|
1424
|
+
if (existsSync2(packaged)) return packaged;
|
|
1425
|
+
const roots = ["../../../..", "../../..", "../.."];
|
|
1426
|
+
const entries = ["apps/mcp/dist/stdio.js", "apps/mcp/.xmcp/stdio.js"];
|
|
1427
|
+
for (const entry of entries) {
|
|
1428
|
+
for (const root of roots) {
|
|
1429
|
+
const candidate = resolve(baseDir, root, entry);
|
|
1430
|
+
if (existsSync2(candidate)) return candidate;
|
|
1431
|
+
}
|
|
1435
1432
|
}
|
|
1436
1433
|
return null;
|
|
1437
1434
|
}
|
|
1435
|
+
function createMcpEnv(baseEnv, client) {
|
|
1436
|
+
const env = {
|
|
1437
|
+
...baseEnv,
|
|
1438
|
+
SOFTWARE_PUBLISHABLE_KEY: client.publishableKey,
|
|
1439
|
+
SOFTWARE_SECRET_KEY: client.secretKey
|
|
1440
|
+
};
|
|
1441
|
+
delete env.SOFTWARE_TENANT_ID;
|
|
1442
|
+
return env;
|
|
1443
|
+
}
|
|
1438
1444
|
function registerMcpCommands(program2) {
|
|
1439
1445
|
program2.command("mcp").description("Start MCP server over stdio").action(() => {
|
|
1440
1446
|
const client = resolveClient(program2.opts().apiKey);
|
|
@@ -1447,11 +1453,7 @@ function registerMcpCommands(program2) {
|
|
|
1447
1453
|
);
|
|
1448
1454
|
}
|
|
1449
1455
|
const child = spawn(process.execPath, [stdioEntry], {
|
|
1450
|
-
env:
|
|
1451
|
-
...process.env,
|
|
1452
|
-
SOFTWARE_PUBLISHABLE_KEY: client.publishableKey,
|
|
1453
|
-
SOFTWARE_SECRET_KEY: client.secretKey
|
|
1454
|
-
},
|
|
1456
|
+
env: createMcpEnv(process.env, client),
|
|
1455
1457
|
stdio: ["inherit", "inherit", "inherit"]
|
|
1456
1458
|
});
|
|
1457
1459
|
child.on("error", (err) => {
|