@megamcp/sentinel 0.1.0 → 0.1.1
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 +18 -8
- package/dist/cli.js +1 -1
- package/dist/orchestrate.js +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,14 +6,24 @@ It ships two ways:
|
|
|
6
6
|
- a **CLI** (`check` / `watch`) for cron and CI, and
|
|
7
7
|
- an **MCP server** (`list_targets`, `check_target`, `health_summary`) — i.e. an MCP server that monitors MCP servers.
|
|
8
8
|
|
|
9
|
-
## Quick start
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx @megamcp/sentinel check <url>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
For local development:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
npm run build
|
|
20
|
+
|
|
21
|
+
# one-shot check of all targets (exits non-zero if any are DOWN)
|
|
22
|
+
npm run check
|
|
23
|
+
|
|
24
|
+
# or check one configured target / ad-hoc HTTP MCP endpoint
|
|
25
|
+
npm run check -- echo-sample
|
|
26
|
+
npm run check -- https://example.com/mcp
|
|
17
27
|
|
|
18
28
|
# continuous watch
|
|
19
29
|
npm run watch # every 60s
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { checkTargets } from "./orchestrate.js";
|
|
3
3
|
import { renderResult, renderSummary } from "./format.js";
|
|
4
|
-
const USAGE = "Usage: megamcp-sentinel <check|watch> [targetId] [--json]";
|
|
4
|
+
const USAGE = "Usage: megamcp-sentinel <check|watch> [targetId|url] [--json]";
|
|
5
5
|
async function main() {
|
|
6
6
|
const argv = process.argv.slice(2);
|
|
7
7
|
const cmd = argv[0] ?? "check";
|
package/dist/orchestrate.js
CHANGED
|
@@ -9,10 +9,10 @@ export function configPath() {
|
|
|
9
9
|
* Returns the results in config order.
|
|
10
10
|
*/
|
|
11
11
|
export async function checkTargets(filterId) {
|
|
12
|
-
const
|
|
13
|
-
const selected = filterId ? targets.filter((t) => t.id === filterId) : targets;
|
|
12
|
+
const targets = filterId && isHttpUrl(filterId) ? [targetFromUrl(filterId)] : loadConfig(configPath()).targets;
|
|
13
|
+
const selected = filterId && !isHttpUrl(filterId) ? targets.filter((t) => t.id === filterId) : targets;
|
|
14
14
|
if (filterId && selected.length === 0) {
|
|
15
|
-
throw new Error(`No target matched id: ${filterId}`);
|
|
15
|
+
throw new Error(`No target matched id or URL: ${filterId}`);
|
|
16
16
|
}
|
|
17
17
|
const results = [];
|
|
18
18
|
for (const target of selected) {
|
|
@@ -31,3 +31,15 @@ export async function checkTargets(filterId) {
|
|
|
31
31
|
}
|
|
32
32
|
return results;
|
|
33
33
|
}
|
|
34
|
+
function isHttpUrl(value) {
|
|
35
|
+
return /^https?:\/\//i.test(value);
|
|
36
|
+
}
|
|
37
|
+
function targetFromUrl(url) {
|
|
38
|
+
return {
|
|
39
|
+
id: url,
|
|
40
|
+
label: url,
|
|
41
|
+
transport: { type: "http", url },
|
|
42
|
+
minTools: 1,
|
|
43
|
+
latencyBudgetMs: 5000,
|
|
44
|
+
};
|
|
45
|
+
}
|