@fanduzi/deltascope-mcp 0.15.0 → 0.16.3
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/README.md +10 -0
- package/bin/deltascope-mcp.js +25 -19
- package/lib/releases.js +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,16 @@ This package does not implement DeltaScope MCP tools itself. It downloads the ma
|
|
|
8
8
|
|
|
9
9
|
The launcher verifies the downloaded archive against the official DeltaScope release checksums before it updates the local cache.
|
|
10
10
|
|
|
11
|
+
## Supported Audit Surface
|
|
12
|
+
|
|
13
|
+
The launched `deltascope-mcp` server exposes a unified `audit_sql` surface for:
|
|
14
|
+
|
|
15
|
+
- MySQL offline audit
|
|
16
|
+
- TiDB offline audit
|
|
17
|
+
- PostgreSQL offline audit on PG-capable release binaries
|
|
18
|
+
|
|
19
|
+
Connection-backed metadata-aware audit remains limited to MySQL/TiDB-compatible instances. PostgreSQL requests must stay offline-only on the MCP surface.
|
|
20
|
+
|
|
11
21
|
## Version Contract
|
|
12
22
|
|
|
13
23
|
- npm package version should track the DeltaScope release version it boots
|
package/bin/deltascope-mcp.js
CHANGED
|
@@ -4,37 +4,39 @@ import fs from "node:fs/promises";
|
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
|
|
6
6
|
import { downloadAndExtractBinary } from "../lib/download.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ensureExecutable,
|
|
9
|
+
formatBootstrapContext,
|
|
10
|
+
spawnBinary,
|
|
11
|
+
} from "../lib/launcher.js";
|
|
8
12
|
import {
|
|
9
13
|
resolveArchiveName,
|
|
10
14
|
resolveArchiveURL,
|
|
11
15
|
resolveChecksumsURL,
|
|
12
16
|
resolveDeltaScopeVersion,
|
|
13
|
-
resolvePlatform
|
|
17
|
+
resolvePlatform,
|
|
14
18
|
} from "../lib/releases.js";
|
|
15
19
|
|
|
16
20
|
const packageJson = JSON.parse(
|
|
17
|
-
await fs.readFile(new URL("../package.json", import.meta.url), "utf8")
|
|
21
|
+
await fs.readFile(new URL("../package.json", import.meta.url), "utf8"),
|
|
18
22
|
);
|
|
19
23
|
const version = resolveDeltaScopeVersion({
|
|
20
24
|
packageVersion: packageJson.version,
|
|
21
|
-
envVersion: process.env.DELTASCOPE_MCP_VERSION ?? ""
|
|
25
|
+
envVersion: process.env.DELTASCOPE_MCP_VERSION ?? "",
|
|
22
26
|
});
|
|
23
27
|
const platform = resolvePlatform();
|
|
24
28
|
const archiveURL = resolveArchiveURL({
|
|
25
29
|
baseURL: process.env.DELTASCOPE_MCP_BASE_URL ?? "",
|
|
26
30
|
version,
|
|
27
31
|
os: platform.os,
|
|
28
|
-
arch: platform.arch
|
|
32
|
+
arch: platform.arch,
|
|
29
33
|
});
|
|
30
34
|
const archiveName = resolveArchiveName({
|
|
31
35
|
version,
|
|
32
36
|
os: platform.os,
|
|
33
|
-
arch: platform.arch
|
|
34
|
-
});
|
|
35
|
-
const checksumsURL = resolveChecksumsURL({
|
|
36
|
-
version
|
|
37
|
+
arch: platform.arch,
|
|
37
38
|
});
|
|
39
|
+
const checksumsURL = resolveChecksumsURL({ version });
|
|
38
40
|
|
|
39
41
|
function log(message) {
|
|
40
42
|
process.stderr.write(`[deltascope-mcp-launcher] ${message}\n`);
|
|
@@ -58,27 +60,31 @@ const binaryPath = await ensureExecutable({
|
|
|
58
60
|
archiveURL,
|
|
59
61
|
checksumsURL,
|
|
60
62
|
archiveName,
|
|
61
|
-
destinationPath
|
|
63
|
+
destinationPath,
|
|
62
64
|
});
|
|
63
|
-
log(
|
|
65
|
+
log(
|
|
66
|
+
`downloaded archive and staged native binary for ${destinationPath}`,
|
|
67
|
+
);
|
|
64
68
|
return result;
|
|
65
69
|
} catch (error) {
|
|
66
|
-
process.stderr.write(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
process.stderr.write(
|
|
71
|
+
`${formatBootstrapContext({
|
|
72
|
+
version,
|
|
73
|
+
platform,
|
|
74
|
+
archiveURL,
|
|
75
|
+
destinationPath,
|
|
76
|
+
})}\n`,
|
|
77
|
+
);
|
|
72
78
|
throw error;
|
|
73
79
|
}
|
|
74
|
-
})()
|
|
80
|
+
})(),
|
|
75
81
|
});
|
|
76
82
|
|
|
77
83
|
log(`launching native binary ${binaryPath}`);
|
|
78
84
|
|
|
79
85
|
const child = spawnBinary(binaryPath, process.argv.slice(2), {
|
|
80
86
|
stdio: "inherit",
|
|
81
|
-
env: process.env
|
|
87
|
+
env: process.env,
|
|
82
88
|
});
|
|
83
89
|
|
|
84
90
|
child.on("error", (error) => {
|
package/lib/releases.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
|
|
3
|
-
export function resolvePlatform({
|
|
4
|
-
|
|
3
|
+
export function resolvePlatform({
|
|
4
|
+
platform = os.platform(),
|
|
5
|
+
arch = os.arch(),
|
|
6
|
+
} = {}) {
|
|
7
|
+
const resolvedPlatform =
|
|
8
|
+
platform === "darwin" || platform === "linux" ? platform : null;
|
|
5
9
|
if (resolvedPlatform === null) {
|
|
6
10
|
throw new Error(`unsupported platform: ${platform}`);
|
|
7
11
|
}
|
|
@@ -40,10 +44,16 @@ export function resolveArchiveName({ version, os, arch }) {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export function resolveChecksumsName({ version }) {
|
|
43
|
-
|
|
47
|
+
const rawVersion = version.replace(/^v/, "");
|
|
48
|
+
return `deltascope_${rawVersion}_checksums.txt`;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
export function resolveArchiveURL({
|
|
51
|
+
export function resolveArchiveURL({
|
|
52
|
+
repo = "Fanduzi/DeltaScope",
|
|
53
|
+
version,
|
|
54
|
+
os,
|
|
55
|
+
arch,
|
|
56
|
+
}) {
|
|
47
57
|
const baseURL = arguments[0].baseURL ?? "";
|
|
48
58
|
if (baseURL) {
|
|
49
59
|
return `${baseURL.replace(/\/$/, "")}/${version}/${resolveArchiveName({ version, os, arch })}`;
|