@akms/mcp-ssh 0.1.5 → 0.1.7
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/CHANGELOG.md +205 -0
- package/README.md +6 -1
- package/lib/cli.cjs +639 -503
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +642 -506
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +18 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +18 -3
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
package/lib/index.d.cts
CHANGED
|
@@ -180,7 +180,7 @@ declare class SshConnection {
|
|
|
180
180
|
* @throws {Error} If the connection was closed, authentication fails, the host is
|
|
181
181
|
* unreachable, the handshake times out, or the carrier cannot be opened.
|
|
182
182
|
*/
|
|
183
|
-
connect(): Promise<void>;
|
|
183
|
+
connect(onProgress?: (stage: "transport" | "host") => void): Promise<void>;
|
|
184
184
|
/**
|
|
185
185
|
* Screens a command against this profile's policy, then runs it on its own channel.
|
|
186
186
|
*
|
|
@@ -532,7 +532,7 @@ declare const $logger: Logger;
|
|
|
532
532
|
/** Env var overriding the stderr log level ("debug" | "info" | "warn" | "error" | "silent"). */
|
|
533
533
|
declare const LOG_LEVEL_ENV = "SSH_MCP_LOG_LEVEL";
|
|
534
534
|
declare const SERVER_NAME = "akms-mcp-ssh";
|
|
535
|
-
declare const SERVER_VERSION = "0.1.
|
|
535
|
+
declare const SERVER_VERSION = "0.1.7";
|
|
536
536
|
|
|
537
537
|
/**
|
|
538
538
|
* Environment variables that define the host, one MCP server entry per host.
|
package/lib/index.d.ts
CHANGED
|
@@ -180,7 +180,7 @@ declare class SshConnection {
|
|
|
180
180
|
* @throws {Error} If the connection was closed, authentication fails, the host is
|
|
181
181
|
* unreachable, the handshake times out, or the carrier cannot be opened.
|
|
182
182
|
*/
|
|
183
|
-
connect(): Promise<void>;
|
|
183
|
+
connect(onProgress?: (stage: "transport" | "host") => void): Promise<void>;
|
|
184
184
|
/**
|
|
185
185
|
* Screens a command against this profile's policy, then runs it on its own channel.
|
|
186
186
|
*
|
|
@@ -532,7 +532,7 @@ declare const $logger: Logger;
|
|
|
532
532
|
/** Env var overriding the stderr log level ("debug" | "info" | "warn" | "error" | "silent"). */
|
|
533
533
|
declare const LOG_LEVEL_ENV = "SSH_MCP_LOG_LEVEL";
|
|
534
534
|
declare const SERVER_NAME = "akms-mcp-ssh";
|
|
535
|
-
declare const SERVER_VERSION = "0.1.
|
|
535
|
+
declare const SERVER_VERSION = "0.1.7";
|
|
536
536
|
|
|
537
537
|
/**
|
|
538
538
|
* Environment variables that define the host, one MCP server entry per host.
|
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var SESSION_SWEEP_INTERVAL_MS = 6e4;
|
|
|
25
25
|
var CWD_MARKER = "__AKMS_SSH_CWD__";
|
|
26
26
|
var MAX_DIRECTORY_ENTRIES = 1e3;
|
|
27
27
|
var SERVER_NAME = "akms-mcp-ssh";
|
|
28
|
-
var SERVER_VERSION = "0.1.
|
|
28
|
+
var SERVER_VERSION = "0.1.7";
|
|
29
29
|
|
|
30
30
|
// src/_defs/command-rules.ts
|
|
31
31
|
var CRITICAL_PATH_PATTERN = new RegExp(
|
|
@@ -488,6 +488,10 @@ var LEVEL_WEIGHTS = {
|
|
|
488
488
|
error: 4
|
|
489
489
|
};
|
|
490
490
|
var SECRET_META_KEYS = ["password", "passphrase", "privatekey", "privatekeypath", "secret", "token"];
|
|
491
|
+
var stderrBroken = false;
|
|
492
|
+
process.stderr.on("error", () => {
|
|
493
|
+
stderrBroken = true;
|
|
494
|
+
});
|
|
491
495
|
function resolveThreshold() {
|
|
492
496
|
const configured = process.env[LOG_LEVEL_ENV];
|
|
493
497
|
if (configured == null) {
|
|
@@ -511,6 +515,9 @@ function maskMeta(meta) {
|
|
|
511
515
|
return masked;
|
|
512
516
|
}
|
|
513
517
|
function write(level, message, meta) {
|
|
518
|
+
if (stderrBroken == true) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
514
521
|
const threshold = resolveThreshold();
|
|
515
522
|
if (threshold === "silent") {
|
|
516
523
|
return;
|
|
@@ -524,8 +531,12 @@ function write(level, message, meta) {
|
|
|
524
531
|
if (Object.keys(masked).length > 0) {
|
|
525
532
|
line += ` ${JSON.stringify(masked)}`;
|
|
526
533
|
}
|
|
527
|
-
|
|
534
|
+
try {
|
|
535
|
+
process.stderr.write(`${line}
|
|
528
536
|
`);
|
|
537
|
+
} catch {
|
|
538
|
+
stderrBroken = true;
|
|
539
|
+
}
|
|
529
540
|
}
|
|
530
541
|
function createLogger(boundMeta) {
|
|
531
542
|
return {
|
|
@@ -1609,7 +1620,7 @@ var SshConnection = class {
|
|
|
1609
1620
|
* @throws {Error} If the connection was closed, authentication fails, the host is
|
|
1610
1621
|
* unreachable, the handshake times out, or the carrier cannot be opened.
|
|
1611
1622
|
*/
|
|
1612
|
-
async connect() {
|
|
1623
|
+
async connect(onProgress) {
|
|
1613
1624
|
if (this.disposed == true) {
|
|
1614
1625
|
throw new Error(`ssh connection for '${this.profile.name}' has been closed; open a new session`);
|
|
1615
1626
|
}
|
|
@@ -1631,6 +1642,9 @@ var SshConnection = class {
|
|
|
1631
1642
|
this.observedFingerprint = fingerprint;
|
|
1632
1643
|
});
|
|
1633
1644
|
this.connecting = (async () => {
|
|
1645
|
+
if (this.profile.jump != null || this.profile.proxyCommand != null) {
|
|
1646
|
+
onProgress?.("transport");
|
|
1647
|
+
}
|
|
1634
1648
|
const transport = await openTransport(this.profile, (fingerprint) => {
|
|
1635
1649
|
this.observedJumpFingerprint = fingerprint;
|
|
1636
1650
|
});
|
|
@@ -1641,6 +1655,7 @@ var SshConnection = class {
|
|
|
1641
1655
|
if (transport != null) {
|
|
1642
1656
|
connectConfig.sock = transport.sock;
|
|
1643
1657
|
}
|
|
1658
|
+
onProgress?.("host");
|
|
1644
1659
|
await new Promise((resolve, reject) => {
|
|
1645
1660
|
const client = new Client();
|
|
1646
1661
|
this.pendingClient = client;
|