@speedscale/proxymock 2.5.1198 → 2.5.1206
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 +2 -2
- package/bin/postinstall.js +20 -0
- package/bin/proxymock.js +13 -7
- package/lib/register-mcp.js +40 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ proxymock allows you to record, visualize, mock, and replay traffic on your loca
|
|
|
30
30
|
npx -y @speedscale/proxymock --help
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
The binary
|
|
33
|
+
The binary is downloaded and cached in `~/.speedscale/` during installation. proxymock also registers its MCP server and bundled skills with detected supported AI clients. You can repeat setup with `proxymock mcp install --yes`.
|
|
34
34
|
|
|
35
35
|
## Getting Started
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ For complete setup instructions and tutorials, visit the [proxymock documentatio
|
|
|
38
38
|
|
|
39
39
|
## MCP (Model Context Protocol) Support
|
|
40
40
|
|
|
41
|
-
proxymock includes an MCP server for
|
|
41
|
+
proxymock includes an MCP server for supported AI development tools. Installation registers it automatically for detected clients. For a client that was not detected, run `proxymock mcp install --yes` or add this configuration:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import install from "../lib/install.js";
|
|
4
|
+
import { getPackageVersion } from "../lib/version.js";
|
|
5
|
+
import registerMcp from "../lib/register-mcp.js";
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
try {
|
|
9
|
+
await install();
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.warn(
|
|
12
|
+
`proxymock MCP setup skipped: binary download failed (${error.message}). Run npx -y @speedscale/proxymock mcp install --yes after installation.`,
|
|
13
|
+
);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
await registerMcp(`v${getPackageVersion()}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main();
|
package/bin/proxymock.js
CHANGED
|
@@ -9,13 +9,19 @@ import {
|
|
|
9
9
|
import { binaryPath } from "../lib/constants.js";
|
|
10
10
|
import logger from "../lib/log.js";
|
|
11
11
|
import install from "../lib/install.js";
|
|
12
|
+
import registerMcp from "../lib/register-mcp.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Spawns the proxymock binary with the provided command line arguments
|
|
15
16
|
* Exits the process with the same code as proxymock
|
|
16
17
|
*/
|
|
17
|
-
function runProxyMock() {
|
|
18
|
-
const
|
|
18
|
+
async function runProxyMock(version) {
|
|
19
|
+
const args = process.argv.slice(2);
|
|
20
|
+
if (args[0] !== "mcp") {
|
|
21
|
+
await registerMcp(version);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const child = spawn(binaryPath, args, {
|
|
19
25
|
stdio: "inherit",
|
|
20
26
|
env: process.env,
|
|
21
27
|
});
|
|
@@ -33,14 +39,14 @@ function runProxyMock() {
|
|
|
33
39
|
/**
|
|
34
40
|
* Installs proxymock and runs it, exiting on failure
|
|
35
41
|
*/
|
|
36
|
-
async function installAndRun() {
|
|
42
|
+
async function installAndRun(version) {
|
|
37
43
|
try {
|
|
38
44
|
await install();
|
|
39
45
|
} catch (error) {
|
|
40
46
|
logger.error(`Installation failed: ${error.message}`);
|
|
41
47
|
process.exit(1);
|
|
42
48
|
}
|
|
43
|
-
runProxyMock();
|
|
49
|
+
await runProxyMock(version);
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
/**
|
|
@@ -54,7 +60,7 @@ async function main() {
|
|
|
54
60
|
|
|
55
61
|
// Check if proxymock is installed
|
|
56
62
|
if (!existsSync(binaryPath)) {
|
|
57
|
-
await installAndRun();
|
|
63
|
+
await installAndRun(expectedVersion);
|
|
58
64
|
return;
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -63,12 +69,12 @@ async function main() {
|
|
|
63
69
|
|
|
64
70
|
if (installedVersion === null || installedVersion !== expectedVersion) {
|
|
65
71
|
// Version unknown or mismatch, reinstall version from package
|
|
66
|
-
await installAndRun();
|
|
72
|
+
await installAndRun(expectedVersion);
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
// Version matches, run directly
|
|
71
|
-
runProxyMock();
|
|
77
|
+
await runProxyMock(expectedVersion);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
main();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { INSTALLROOT, binaryPath } from "./constants.js";
|
|
5
|
+
|
|
6
|
+
const markerPath = join(INSTALLROOT, "mcp-registration-version");
|
|
7
|
+
|
|
8
|
+
export default async function registerMcp(version) {
|
|
9
|
+
try {
|
|
10
|
+
if (readFileSync(markerPath, "utf8").trim() === version) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
} catch {}
|
|
14
|
+
|
|
15
|
+
const exitCode = await new Promise((resolve) => {
|
|
16
|
+
const child = spawn(binaryPath, ["mcp", "install", "--yes"], {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
env: process.env,
|
|
19
|
+
});
|
|
20
|
+
child.on("error", (error) => {
|
|
21
|
+
console.warn(
|
|
22
|
+
`proxymock MCP setup skipped: ${error.message}. Run proxymock mcp install --yes after installation.`,
|
|
23
|
+
);
|
|
24
|
+
resolve(null);
|
|
25
|
+
});
|
|
26
|
+
child.on("exit", resolve);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (exitCode === 0) {
|
|
30
|
+
try {
|
|
31
|
+
writeFileSync(markerPath, version);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.warn(`Could not save proxymock MCP setup state: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
} else if (exitCode !== null) {
|
|
36
|
+
console.warn(
|
|
37
|
+
"proxymock MCP setup did not complete. Run proxymock mcp install --yes after installation.",
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speedscale/proxymock",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1206",
|
|
4
4
|
"description": "A free desktop CLI that automatically creates mocks and tests from watching your app run.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"url": "https://slack.speedscale.com/"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
+
"postinstall": "node bin/postinstall.js",
|
|
35
36
|
"test": "node --test || echo 'No tests defined'",
|
|
36
37
|
"validate": "npm pack && echo 'Package validation complete'"
|
|
37
38
|
},
|