@relay-core/mcp 0.3.0 → 0.3.2
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 +42 -0
- package/install.js +28 -11
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @relay-core/mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [RelayCore](https://github.com/relaycraft/relay-core) — expose real-time traffic inspection and control to AI agents.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Cursor / Claude Desktop
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"relay-core": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["@relay-core/mcp"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then ask your agent: "Search for recent 5xx errors and explain what went wrong."
|
|
21
|
+
|
|
22
|
+
### Prerequisites
|
|
23
|
+
|
|
24
|
+
HTTPS interception requires a CA certificate trusted by your system:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @relay-core/cli ca init && npx @relay-core/cli ca install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tools
|
|
31
|
+
|
|
32
|
+
| Category | Tools |
|
|
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` |
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
MIT
|
package/install.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { execSync } = require("child_process");
|
|
3
|
-
const { existsSync, mkdirSync } = require("fs");
|
|
3
|
+
const { existsSync, mkdirSync, readFileSync } = require("fs");
|
|
4
4
|
const { createWriteStream } = require("fs");
|
|
5
5
|
const { pipeline } = require("stream/promises");
|
|
6
6
|
const { join } = require("path");
|
|
7
7
|
const https = require("https");
|
|
8
8
|
|
|
9
|
+
const getVersion = () => {
|
|
10
|
+
try {
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "package.json"), "utf-8"));
|
|
12
|
+
return pkg.version;
|
|
13
|
+
} catch {
|
|
14
|
+
return "0.3.0";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
const PACKAGE = process.env.npm_package_name || "@relay-core/cli";
|
|
10
|
-
const VERSION =
|
|
19
|
+
const VERSION = getVersion();
|
|
11
20
|
|
|
12
21
|
// Map (os, arch) → GitHub release target
|
|
13
22
|
function getTarget() {
|
|
@@ -17,11 +26,12 @@ function getTarget() {
|
|
|
17
26
|
"darwin-x64": "x86_64-apple-darwin",
|
|
18
27
|
"darwin-arm64": "aarch64-apple-darwin",
|
|
19
28
|
"linux-x64": "x86_64-unknown-linux-gnu",
|
|
29
|
+
"win32-x64": "x86_64-pc-windows-msvc",
|
|
20
30
|
};
|
|
21
31
|
const key = `${os}-${arch}`;
|
|
22
32
|
const target = map[key];
|
|
23
33
|
if (!target) {
|
|
24
|
-
console.error(`Unsupported platform: ${key}.
|
|
34
|
+
console.error(`Unsupported platform: ${key}. Supported: macOS (x64/arm64), Linux (x64), Windows (x64).`);
|
|
25
35
|
process.exit(1);
|
|
26
36
|
}
|
|
27
37
|
return target;
|
|
@@ -31,6 +41,12 @@ function getBinaryName() {
|
|
|
31
41
|
return PACKAGE.endsWith("mcp") ? "relay-core-probe" : "relay-core-cli";
|
|
32
42
|
}
|
|
33
43
|
|
|
44
|
+
function getBinaryPath(binaryName) {
|
|
45
|
+
return process.platform === "win32"
|
|
46
|
+
? join(__dirname, "bin", binaryName + ".exe")
|
|
47
|
+
: join(__dirname, "bin", binaryName);
|
|
48
|
+
}
|
|
49
|
+
|
|
34
50
|
async function download(url, dest) {
|
|
35
51
|
console.log(`Downloading ${url} → ${dest}`);
|
|
36
52
|
return new Promise((resolve, reject) => {
|
|
@@ -54,8 +70,9 @@ async function download(url, dest) {
|
|
|
54
70
|
(async () => {
|
|
55
71
|
try {
|
|
56
72
|
const binDir = join(__dirname, "bin");
|
|
73
|
+
mkdirSync(binDir, { recursive: true });
|
|
57
74
|
const binaryName = getBinaryName();
|
|
58
|
-
const binaryPath =
|
|
75
|
+
const binaryPath = getBinaryPath(binaryName);
|
|
59
76
|
|
|
60
77
|
// Skip download if binary already exists (re-install)
|
|
61
78
|
if (existsSync(binaryPath)) {
|
|
@@ -64,17 +81,17 @@ async function download(url, dest) {
|
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
const target = getTarget();
|
|
67
|
-
const
|
|
68
|
-
const
|
|
84
|
+
const ext = process.platform === "win32" ? "zip" : "tar.gz";
|
|
85
|
+
const url = `https://github.com/relaycraft/relay-core/releases/download/v${VERSION}/${binaryName}-${target}.${ext}`;
|
|
86
|
+
const archivePath = join(binDir, `${binaryName}.${ext}`);
|
|
69
87
|
|
|
70
|
-
mkdirSync(binDir, { recursive: true });
|
|
71
88
|
await download(url, archivePath);
|
|
72
89
|
|
|
73
90
|
console.log("Extracting...");
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
if (process.platform === "win32") {
|
|
92
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${binDir}' -Force"`, { stdio: "inherit" });
|
|
93
|
+
} else {
|
|
94
|
+
execSync(`tar xzf ${archivePath} -C ${binDir}`, { stdio: "inherit" });
|
|
78
95
|
execSync(`chmod +x ${binaryPath}`, { stdio: "inherit" });
|
|
79
96
|
}
|
|
80
97
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relay-core/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "RelayCore MCP server — AI agent traffic control via Model Context Protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:relaycraft/relay-core",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"install.js",
|
|
12
|
+
"README.md",
|
|
12
13
|
"bin/"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
@@ -17,6 +18,6 @@
|
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=18"
|
|
19
20
|
},
|
|
20
|
-
"os": ["darwin", "linux"],
|
|
21
|
+
"os": ["darwin", "linux", "win32"],
|
|
21
22
|
"cpu": ["x64", "arm64"]
|
|
22
23
|
}
|