fix(mcp): route ssh transport layers through desktop bridge

This commit is contained in:
xcstatus authored and GitHub committed 2026-06-17 22:06:33 +08:00
1 parent f89bf310b4
commit 417a48ccfe
2 files changed
+57 -2

No files matched your search

@@ -21,6 +21,30 @@ function sqliteConfig(path: string): ConnectionConfig {
};
}
function mysqlSshConfig(): ConnectionConfig {
return {
id: "mysql-ssh-test",
name: "mysql-over-ssh",
db_type: "mysql",
host: "10.0.0.10",
port: 3306,
username: "root",
password: "secret",
ssl: false,
transport_layers: [
{
type: "ssh",
id: "bastion",
enabled: true,
host: "bastion.example.com",
port: 22,
user: "root",
password: "ssh-secret",
},
],
};
}
test("queries SQLite connections without the DBX bridge", async () => {
const dir = mkdtempSync(join(tmpdir(), "dbx-mcp-sqlite-"));
const path = join(dir, "app.db");
@@ -85,3 +109,19 @@ test("lists and describes SQLite tables without the DBX bridge", async () => {
rmSync(dir, { recursive: true, force: true });
}
});
test("routes SSH transport layer connections through the DBX bridge", async () => {
const dir = mkdtempSync(join(tmpdir(), "dbx-mcp-bridge-home-"));
const originalHome = process.env.HOME;
process.env.HOME = dir;
try {
await assert.rejects(() => executeQuery(mysqlSshConfig(), "select 1"), /DBX desktop app is not running/);
await assert.rejects(() => listTables(mysqlSshConfig()), /DBX desktop app is not running/);
await assert.rejects(() => describeTable(mysqlSshConfig(), "users"), /DBX desktop app is not running/);
} finally {
if (originalHome === undefined) delete process.env.HOME;
else process.env.HOME = originalHome;
rmSync(dir, { recursive: true, force: true });
}
});