mcp-speechmatics-transcribe 0.1.8 → 0.1.10
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 -1
- package/mcp.js +2 -1
- package/modules/cli-process.js +12 -1
- package/modules/discovery-cache.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,7 +153,9 @@ changes create a different cache entry; edits inside an env file take effect on
|
|
|
153
153
|
the next refresh or after invalidation.
|
|
154
154
|
|
|
155
155
|
Cache filenames hash the CLI command, arguments, working directory, and complete
|
|
156
|
-
effective environment. `CODEX_TOOL_CALL_ID`
|
|
156
|
+
effective environment. `CODEX_TOOL_CALL_ID`, `PATH`, and names starting with
|
|
157
|
+
`INIT_` or `NPM_` are excluded from the hash (the PATH and prefix checks are
|
|
158
|
+
case-insensitive); additional
|
|
157
159
|
names can be listed in `SPEECHMATICS_DISCOVERY_CACHE_KEY_EXCLUDE`. These exclusions
|
|
158
160
|
never remove variables from the CLI environment. Windows environment names are
|
|
159
161
|
case-insensitive. Exclude only transient values that do not affect discovery.
|
|
@@ -164,6 +166,13 @@ results are not stored. Expired or damaged entries are refreshed, and tool-list
|
|
|
164
166
|
change notifications invalidate the cache. Warm discovery and legacy MCP ping
|
|
165
167
|
do not start a CLI process. Actual tool calls always delegate to the CLI.
|
|
166
168
|
|
|
169
|
+
At startup, each MCP wrapper appends one `{pid, startedAt, env}` record to the
|
|
170
|
+
local `env-startup.jsonl` beside the cache. It captures the original wrapper
|
|
171
|
+
environment before preparing the backend environment. This diagnostic file
|
|
172
|
+
contains raw environment values, including credentials, and is created with
|
|
173
|
+
user-only permissions where supported. It remains outside the repository and
|
|
174
|
+
package; keep its contents private. Snapshot failures do not prevent startup.
|
|
175
|
+
|
|
167
176
|
## Development and releases
|
|
168
177
|
|
|
169
178
|
```sh
|
package/mcp.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Server, PROTOCOL_VERSION_META_KEY } from "@modelcontextprotocol/server";
|
|
2
2
|
import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
3
|
-
import { runCli, resolveCliLaunch } from "./modules/cli-process.js";
|
|
3
|
+
import { runCli, resolveCliLaunch, dumpStartupEnvironment } from "./modules/cli-process.js";
|
|
4
4
|
import { createDiscoveryCache } from "./modules/discovery-cache.js";
|
|
5
5
|
|
|
6
|
+
dumpStartupEnvironment();
|
|
6
7
|
const launch = resolveCliLaunch();
|
|
7
8
|
const discovery = createDiscoveryCache(launch, () => runCli("--tool-manifest", undefined, { launch }));
|
|
8
9
|
let era;
|
package/modules/cli-process.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { spawn, execFile } from "node:child_process";
|
|
2
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { resolve, join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { mkdirSync, appendFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
|
|
7
|
+
export function dumpStartupEnvironment(directory = join(tmpdir(), "transcription", "discovery")) {
|
|
8
|
+
const file = join(directory, "env-startup.jsonl");
|
|
9
|
+
try {
|
|
10
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
11
|
+
appendFileSync(file, JSON.stringify({ pid: process.pid, startedAt: new Date().toISOString(), env: process.env }) + "\n", { mode: 0o600 });
|
|
12
|
+
return file;
|
|
13
|
+
} catch { /* A diagnostic snapshot must not prevent MCP startup. */ }
|
|
14
|
+
}
|
|
4
15
|
|
|
5
16
|
// Keep arguments and credentials on stdin/environment, outside the shell command.
|
|
6
17
|
export function resolveCliLaunch() {
|
|
@@ -20,7 +20,7 @@ export function discoveryKey(launch, platform = process.platform) {
|
|
|
20
20
|
const normalize = (key) => platform === "win32" ? key.toUpperCase() : key;
|
|
21
21
|
const excluded = new Set(["CODEX_TOOL_CALL_ID", ...(launch.env.SPEECHMATICS_DISCOVERY_CACHE_KEY_EXCLUDE ?? "").split(",").map((key) => key.trim()).filter(Boolean)].map(normalize));
|
|
22
22
|
const env = Object.entries(launch.env).map(([key, value]) => [normalize(key), value])
|
|
23
|
-
.filter(([key]) => !excluded.has(key)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
23
|
+
.filter(([key]) => !excluded.has(key) && !/^(?:PATH$|INIT_|NPM_)/i.test(key)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
24
24
|
return createHash("sha256").update(JSON.stringify({ version: 1, command: launch.command, args: launch.args, cwd: launch.cwd, shell: launch.shell, env })).digest("hex");
|
|
25
25
|
}
|
|
26
26
|
|