@miosa/cli 1.0.82 → 1.0.84
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiyHzC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiE/C"}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -3299,6 +3299,51 @@ function wireClaudeCode(apiKey, remoteUrl, scope) {
|
|
|
3299
3299
|
}
|
|
3300
3300
|
return { ok: true };
|
|
3301
3301
|
}
|
|
3302
|
+
function wireClaudeCodeLocal(scope) {
|
|
3303
|
+
// `claude mcp remove` first so re-running install replaces cleanly.
|
|
3304
|
+
spawnSync("claude", ["mcp", "remove", MCP_SERVER_NAME, "--scope", scope], {
|
|
3305
|
+
stdio: "ignore",
|
|
3306
|
+
});
|
|
3307
|
+
const result = spawnSync("claude", ["mcp", "add", "--scope", scope, MCP_SERVER_NAME, "miosa", "mcp", "serve"], { stdio: "pipe", encoding: "utf8" });
|
|
3308
|
+
if (result.error) {
|
|
3309
|
+
return {
|
|
3310
|
+
ok: false,
|
|
3311
|
+
reason: `Could not run \`claude\` CLI: ${result.error.message}`,
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
if (typeof result.status === "number" && result.status !== 0) {
|
|
3315
|
+
return {
|
|
3316
|
+
ok: false,
|
|
3317
|
+
reason: result.stderr?.trim() || `claude mcp add exited ${result.status}`,
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3320
|
+
return { ok: true };
|
|
3321
|
+
}
|
|
3322
|
+
function printLocalSnippet(client) {
|
|
3323
|
+
console.log();
|
|
3324
|
+
console.log(chalk.bold("Manual local MCP install snippet"));
|
|
3325
|
+
console.log(chalk.dim(" Requires `miosa login` or MIOSA_API_KEY in the MCP environment."));
|
|
3326
|
+
console.log();
|
|
3327
|
+
if (client === "cursor") {
|
|
3328
|
+
console.log(chalk.dim(" Add to ~/.cursor/mcp.json:"));
|
|
3329
|
+
console.log();
|
|
3330
|
+
console.log(JSON.stringify({
|
|
3331
|
+
mcpServers: {
|
|
3332
|
+
miosa: {
|
|
3333
|
+
command: "miosa",
|
|
3334
|
+
args: ["mcp", "serve"],
|
|
3335
|
+
},
|
|
3336
|
+
},
|
|
3337
|
+
}, null, 2));
|
|
3338
|
+
return;
|
|
3339
|
+
}
|
|
3340
|
+
if (client === "gemini") {
|
|
3341
|
+
console.log(` ${chalk.cyan(`gemini mcp add ${MCP_SERVER_NAME} miosa mcp serve`)}`);
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3344
|
+
// claude / manual
|
|
3345
|
+
console.log(` ${chalk.cyan(`claude mcp add --scope user ${MCP_SERVER_NAME} miosa mcp serve`)}`);
|
|
3346
|
+
}
|
|
3302
3347
|
function printManualSnippet(client, apiKey, remoteUrl) {
|
|
3303
3348
|
const masked = apiKey.length > 12
|
|
3304
3349
|
? apiKey.slice(0, 6) + "…" + apiKey.slice(-4)
|
|
@@ -3334,7 +3379,32 @@ function printManualSnippet(client, apiKey, remoteUrl) {
|
|
|
3334
3379
|
async function runInstall(opts) {
|
|
3335
3380
|
const config = loadConfig();
|
|
3336
3381
|
const clientName = `MIOSA MCP (${opts.client === "manual" ? "manual" : opts.client})`;
|
|
3337
|
-
console.log(chalk.bold("MIOSA MCP installer"), chalk.dim(
|
|
3382
|
+
console.log(chalk.bold("MIOSA MCP installer"), chalk.dim(opts.mode === "local"
|
|
3383
|
+
? `— wiring ${opts.client} → local miosa mcp serve`
|
|
3384
|
+
: `— wiring ${opts.client} → ${opts.remoteUrl}`));
|
|
3385
|
+
if (opts.mode === "local") {
|
|
3386
|
+
if (opts.client === "claude") {
|
|
3387
|
+
const wired = wireClaudeCodeLocal(opts.scope);
|
|
3388
|
+
if (wired.ok) {
|
|
3389
|
+
console.log();
|
|
3390
|
+
console.log(chalk.green("✓"), `MCP server '${MCP_SERVER_NAME}' added to Claude Code (${opts.scope} scope).`);
|
|
3391
|
+
console.log();
|
|
3392
|
+
console.log(chalk.dim("Verify:"));
|
|
3393
|
+
console.log(` ${chalk.cyan("claude mcp list")}`);
|
|
3394
|
+
console.log();
|
|
3395
|
+
console.log(chalk.dim("Try in a fresh Claude Code session:"));
|
|
3396
|
+
console.log(chalk.dim(` "Create a MIOSA sandbox, run \`python -c 'print(2+2)'\`, then destroy it."`));
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
console.log();
|
|
3400
|
+
console.log(chalk.yellow("!"), `Could not auto-wire Claude Code: ${wired.reason}`);
|
|
3401
|
+
console.log(chalk.yellow(" Falling back to manual snippet:"));
|
|
3402
|
+
printLocalSnippet("claude");
|
|
3403
|
+
return;
|
|
3404
|
+
}
|
|
3405
|
+
printLocalSnippet(opts.client);
|
|
3406
|
+
return;
|
|
3407
|
+
}
|
|
3338
3408
|
const apiKey = await runDeviceFlow(config.endpoint, clientName);
|
|
3339
3409
|
if (opts.client === "claude") {
|
|
3340
3410
|
const wired = wireClaudeCode(apiKey, opts.remoteUrl, opts.scope);
|
|
@@ -3375,17 +3445,23 @@ export function register(program) {
|
|
|
3375
3445
|
});
|
|
3376
3446
|
mcp
|
|
3377
3447
|
.command("install")
|
|
3378
|
-
.description("Install
|
|
3448
|
+
.description("Install MIOSA MCP into your AI client. Defaults to the local `miosa mcp serve` stdio server.")
|
|
3379
3449
|
.option("-c, --client <client>", "Which AI client to wire: claude (default), cursor, gemini, manual", "claude")
|
|
3380
3450
|
.option("-s, --scope <scope>", "Claude Code config scope: local, user (default), or project", "user")
|
|
3381
|
-
.option("--url <url>", "
|
|
3451
|
+
.option("--url <url>", "Hosted MCP URL used with --remote (default: https://api.miosa.ai/api/v1/mcp)", MCP_REMOTE_URL)
|
|
3452
|
+
.option("--remote", "Install the hosted HTTP MCP server instead of the local stdio server", false)
|
|
3382
3453
|
.action(async (opts) => {
|
|
3383
3454
|
const client = (["claude", "cursor", "gemini", "manual"].includes(opts.client)
|
|
3384
3455
|
? opts.client
|
|
3385
3456
|
: "claude");
|
|
3386
3457
|
const scope = (["local", "user", "project"].includes(opts.scope) ? opts.scope : "user");
|
|
3387
3458
|
try {
|
|
3388
|
-
await runInstall({
|
|
3459
|
+
await runInstall({
|
|
3460
|
+
client,
|
|
3461
|
+
scope,
|
|
3462
|
+
mode: opts.remote ? "remote" : "local",
|
|
3463
|
+
remoteUrl: opts.url,
|
|
3464
|
+
});
|
|
3389
3465
|
}
|
|
3390
3466
|
catch (e) {
|
|
3391
3467
|
const msg = e instanceof Error ? e.message : String(e);
|