@relay-core/mcp 0.3.7 → 0.3.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 +15 -16
- package/bin/mcp-probe +13 -3
- package/lib/resolve-binary.js +25 -0
- package/package.json +21 -8
- package/install.js +0 -89
package/README.md
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
# @relay-core/mcp
|
|
2
2
|
|
|
3
|
-
MCP
|
|
3
|
+
[MCP](https://modelcontextprotocol.io) server for **[RelayCore](https://relaycore.dev)** — connect AI agents (Cursor, Claude Desktop, …) to live HTTP(S) traffic.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
### Cursor / Claude Desktop
|
|
5
|
+
## Configure
|
|
8
6
|
|
|
9
7
|
```json
|
|
10
8
|
{
|
|
11
9
|
"mcpServers": {
|
|
12
10
|
"relay-core": {
|
|
13
11
|
"command": "npx",
|
|
14
|
-
"args": ["@relay-core/mcp"]
|
|
12
|
+
"args": ["-y", "@relay-core/mcp"]
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
```
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
Requires **Node** ≥ 18. Binaries install via `@relay-core/binaries-*` (same as the CLI package).
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
## HTTPS prerequisite
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
Install and trust the RelayCore CA once:
|
|
25
23
|
|
|
26
24
|
```bash
|
|
27
25
|
npx @relay-core/cli ca init && npx @relay-core/cli ca install
|
|
28
26
|
```
|
|
29
27
|
|
|
30
|
-
## Tools
|
|
28
|
+
## Tools (overview)
|
|
29
|
+
|
|
30
|
+
| Area | Examples |
|
|
31
|
+
|------|----------|
|
|
32
|
+
| Observe | `search_flows`, `get_flow`, `get_metrics` |
|
|
33
|
+
| Control | `set_intercept`, `resume_flow`, `set_rule` |
|
|
34
|
+
| Analyze | `export_har`, `replay_flow` |
|
|
35
|
+
| Policy / scripts | `get_policy`, `set_script`, `mock_url` |
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|----------|-------|
|
|
34
|
-
| Observe | `search_flows` `get_flow` `get_metrics` |
|
|
35
|
-
| Control | `set_intercept` `resume_flow` `set_rule` `delete_rule` |
|
|
36
|
-
| Analyze | `export_har` `replay_flow` |
|
|
37
|
-
| Policy | `get_policy` `update_policy` `patch_policy` |
|
|
38
|
-
| Extend | `set_script` `mock_url` |
|
|
37
|
+
Details: [relaycore.dev](https://relaycore.dev) · [GitHub](https://github.com/relaycraft/relay-core)
|
|
39
38
|
|
|
40
39
|
## License
|
|
41
40
|
|
package/bin/mcp-probe
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
2
4
|
const { spawnSync } = require("child_process");
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const { resolveBinary } = require("../lib/resolve-binary");
|
|
6
|
+
|
|
7
|
+
let binary;
|
|
8
|
+
try {
|
|
9
|
+
binary = resolveBinary("relay-core-probe");
|
|
10
|
+
} catch (err) {
|
|
11
|
+
console.error(err.message);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
6
16
|
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a RelayCore native binary from the matching @relay-core/binaries-* optional dependency.
|
|
5
|
+
* @param {string} name - e.g. "relay-core-cli" or "relay-core-probe"
|
|
6
|
+
* @returns {string} Absolute path to the binary
|
|
7
|
+
*/
|
|
8
|
+
function resolveBinary(name) {
|
|
9
|
+
const platformPkg = `@relay-core/binaries-${process.platform}-${process.arch}`;
|
|
10
|
+
const file = process.platform === "win32" ? `${name}.exe` : name;
|
|
11
|
+
try {
|
|
12
|
+
return require.resolve(`${platformPkg}/bin/${file}`);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
if (process.env.RELAY_CORE_DEBUG) {
|
|
15
|
+
console.error("[relay-core] resolveBinary:", err);
|
|
16
|
+
}
|
|
17
|
+
throw new Error(
|
|
18
|
+
`RelayCore native binary "${name}" is not installed for ${process.platform}-${process.arch}.\n` +
|
|
19
|
+
`Expected optional package ${platformPkg} (install or upgrade from the npm registry).\n` +
|
|
20
|
+
`Supported: macOS (x64, arm64), Linux (x64, arm64), Windows (x64). See https://relaycore.dev`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { resolveBinary };
|
package/package.json
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relay-core/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "RelayCore MCP server — AI agent traffic control via Model Context Protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://relaycore.dev",
|
|
7
|
+
"bugs": "https://github.com/relaycraft/relay-core/issues",
|
|
6
8
|
"repository": "github:relaycraft/relay-core",
|
|
7
9
|
"bin": {
|
|
8
10
|
"relay-core-probe": "./bin/mcp-probe"
|
|
9
11
|
},
|
|
10
12
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"bin/",
|
|
14
|
+
"lib/",
|
|
15
|
+
"README.md"
|
|
14
16
|
],
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@relay-core/binaries-darwin-arm64": "0.3.10",
|
|
19
|
+
"@relay-core/binaries-darwin-x64": "0.3.10",
|
|
20
|
+
"@relay-core/binaries-linux-arm64": "0.3.10",
|
|
21
|
+
"@relay-core/binaries-linux-x64": "0.3.10",
|
|
22
|
+
"@relay-core/binaries-win32-x64": "0.3.10"
|
|
17
23
|
},
|
|
18
24
|
"engines": {
|
|
19
25
|
"node": ">=18"
|
|
20
26
|
},
|
|
21
|
-
"os": [
|
|
22
|
-
|
|
27
|
+
"os": [
|
|
28
|
+
"darwin",
|
|
29
|
+
"linux",
|
|
30
|
+
"win32"
|
|
31
|
+
],
|
|
32
|
+
"cpu": [
|
|
33
|
+
"x64",
|
|
34
|
+
"arm64"
|
|
35
|
+
]
|
|
23
36
|
}
|
package/install.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const { execSync } = require("child_process");
|
|
5
|
-
const { existsSync, mkdirSync, readFileSync, createWriteStream } = require("fs");
|
|
6
|
-
const { pipeline } = require("stream/promises");
|
|
7
|
-
const { join } = require("path");
|
|
8
|
-
const https = require("https");
|
|
9
|
-
|
|
10
|
-
const PKG_DIR = join(__dirname, "..");
|
|
11
|
-
const BINARY_NAME = "relay-core-probe";
|
|
12
|
-
|
|
13
|
-
function getVersion() {
|
|
14
|
-
try {
|
|
15
|
-
return JSON.parse(readFileSync(join(PKG_DIR, "package.json"), "utf-8")).version;
|
|
16
|
-
} catch { return "0.3.0"; }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getTarget() {
|
|
20
|
-
const map = {
|
|
21
|
-
"darwin-x64": "x86_64-apple-darwin",
|
|
22
|
-
"darwin-arm64": "aarch64-apple-darwin",
|
|
23
|
-
"linux-x64": "x86_64-unknown-linux-gnu",
|
|
24
|
-
"linux-arm64": "aarch64-unknown-linux-gnu",
|
|
25
|
-
"win32-x64": "x86_64-pc-windows-msvc",
|
|
26
|
-
};
|
|
27
|
-
const target = map[`${process.platform}-${process.arch}`];
|
|
28
|
-
if (!target) {
|
|
29
|
-
console.error(`Unsupported platform: ${process.platform}-${process.arch}. macOS/Linux/Windows (x64/arm64) supported.`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function download(url, dest) {
|
|
36
|
-
console.log(`Downloading ${url} → ${dest}`);
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const file = createWriteStream(dest);
|
|
39
|
-
https.get(url, (response) => {
|
|
40
|
-
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
41
|
-
https.get(response.headers.location, (rr) => pipeline(rr, file).then(resolve, reject));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (response.statusCode !== 200) return reject(new Error(`HTTP ${response.statusCode}`));
|
|
45
|
-
pipeline(response, file).then(resolve, reject);
|
|
46
|
-
}).on("error", reject);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
(async () => {
|
|
51
|
-
try {
|
|
52
|
-
const binDir = join(PKG_DIR, "bin");
|
|
53
|
-
mkdirSync(binDir, { recursive: true });
|
|
54
|
-
|
|
55
|
-
const ext = process.platform === "win32" ? ".exe" : "";
|
|
56
|
-
const binaryPath = join(binDir, BINARY_NAME + ext);
|
|
57
|
-
const version = getVersion();
|
|
58
|
-
|
|
59
|
-
if (existsSync(binaryPath)) {
|
|
60
|
-
try {
|
|
61
|
-
const out = execSync(`"${binaryPath}" --version`, { encoding: "utf-8", timeout: 5000 }).trim();
|
|
62
|
-
if (out.includes(version)) {
|
|
63
|
-
console.log(`${BINARY_NAME} v${version} already installed.`);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
console.log(`Installed ${out}, updating to v${version}...`);
|
|
67
|
-
} catch { console.log("Re-downloading..."); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const target = getTarget();
|
|
71
|
-
const archiveExt = process.platform === "win32" ? "zip" : "tar.gz";
|
|
72
|
-
const url = `https://github.com/relaycraft/relay-core/releases/download/v${version}/${BINARY_NAME}-${target}.${archiveExt}`;
|
|
73
|
-
const archivePath = join(binDir, `${BINARY_NAME}.${archiveExt}`);
|
|
74
|
-
|
|
75
|
-
await download(url, archivePath);
|
|
76
|
-
console.log("Extracting...");
|
|
77
|
-
|
|
78
|
-
if (process.platform === "win32") {
|
|
79
|
-
execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${binDir}' -Force"`, { stdio: "inherit" });
|
|
80
|
-
} else {
|
|
81
|
-
execSync(`tar xzf ${archivePath} -C ${binDir}`, { stdio: "inherit" });
|
|
82
|
-
execSync(`chmod +x ${binaryPath}`, { stdio: "inherit" });
|
|
83
|
-
}
|
|
84
|
-
console.log(`${BINARY_NAME} v${version} installed.`);
|
|
85
|
-
} catch (err) {
|
|
86
|
-
console.error("Install failed:", err.message);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
})();
|