@deepsql/mcp 0.10.0 → 0.10.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/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/commands/connections.js +23 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -61,7 +61,7 @@ Commands:
|
|
|
61
61
|
config path Print the auth file path.
|
|
62
62
|
mcp Run the stdio MCP server using the saved token.
|
|
63
63
|
connections list [--json] List database connections (active default
|
|
64
|
-
is marked with
|
|
64
|
+
is marked with \`*\`).
|
|
65
65
|
connections use <name> Pin <name> as the active default; commands
|
|
66
66
|
drop --connection from then on.
|
|
67
67
|
connections current Print the active default (exit 1 if none).
|
|
@@ -433,6 +433,21 @@ function formatErrors(errors) {
|
|
|
433
433
|
return errors.map((e) => `${e.path}: ${e.message}`).join("\n ");
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Parse a port from interactive input. Throws on a missing/invalid value
|
|
438
|
+
* rather than letting NaN propagate into the JSON payload (which the backend
|
|
439
|
+
* would reject with a confusing "must be an integer" error after a network
|
|
440
|
+
* round-trip).
|
|
441
|
+
*/
|
|
442
|
+
function parsePortPrompt(value, fallback, label) {
|
|
443
|
+
if (value == null || value === "") return fallback;
|
|
444
|
+
const n = parseInt(value, 10);
|
|
445
|
+
if (!Number.isFinite(n) || n < 1 || n > 65535) {
|
|
446
|
+
throw new Error(`${label} must be an integer between 1 and 65535 (got "${value}").`);
|
|
447
|
+
}
|
|
448
|
+
return n;
|
|
449
|
+
}
|
|
450
|
+
|
|
436
451
|
function printPrivilegeReport(stream, result) {
|
|
437
452
|
if (!result || typeof result !== "object") return;
|
|
438
453
|
if (result.message) stream.write(`${result.message}\n`);
|
|
@@ -516,13 +531,14 @@ async function promptInteractive({ withCloud = false } = {}) {
|
|
|
516
531
|
],
|
|
517
532
|
});
|
|
518
533
|
cfg.host = await ui.input({ message: "Host:", required: true });
|
|
519
|
-
cfg.port =
|
|
534
|
+
cfg.port = parsePortPrompt(
|
|
520
535
|
await ui.input({
|
|
521
536
|
message: "Port:",
|
|
522
537
|
default: cfg.dbType === "postgres" ? "5432" : "3306",
|
|
523
538
|
required: true,
|
|
524
539
|
}),
|
|
525
|
-
|
|
540
|
+
cfg.dbType === "postgres" ? 5432 : 3306,
|
|
541
|
+
"Port",
|
|
526
542
|
);
|
|
527
543
|
cfg.database = await ui.input({ message: "Database name:", required: true });
|
|
528
544
|
cfg.username = await ui.input({ message: "Username:", required: true });
|
|
@@ -552,7 +568,11 @@ async function promptInteractive({ withCloud = false } = {}) {
|
|
|
552
568
|
if (wantSsh) {
|
|
553
569
|
cfg.sshEnabled = true;
|
|
554
570
|
cfg.sshHost = await ui.input({ message: "SSH host:", required: true });
|
|
555
|
-
cfg.sshPort =
|
|
571
|
+
cfg.sshPort = parsePortPrompt(
|
|
572
|
+
await ui.input({ message: "SSH port:", default: "22", required: true }),
|
|
573
|
+
22,
|
|
574
|
+
"SSH port",
|
|
575
|
+
);
|
|
556
576
|
cfg.sshUsername = await ui.input({ message: "SSH username:", required: true });
|
|
557
577
|
cfg.sshAuthType = await ui.select({
|
|
558
578
|
message: "SSH auth:",
|