@megamcp/sentinel 0.1.0 → 0.1.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/dist/cli.js CHANGED
@@ -1,14 +1,30 @@
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
+ import { runCheck } from "./monitor.js";
5
+ const USAGE = "Usage: megamcp-sentinel <check|watch> [targetId|http-url] [--json]";
6
+ function isHttpUrl(value) {
7
+ return value !== undefined && /^https?:\/\//i.test(value);
8
+ }
9
+ function targetFromUrl(url) {
10
+ const parsed = new URL(url);
11
+ return {
12
+ id: `url-${parsed.hostname.replace(/[^a-z0-9-]/gi, "-").toLowerCase()}`,
13
+ label: parsed.hostname,
14
+ transport: { type: "http", url },
15
+ minTools: 1,
16
+ latencyBudgetMs: 5000,
17
+ };
18
+ }
5
19
  async function main() {
6
20
  const argv = process.argv.slice(2);
7
21
  const cmd = argv[0] ?? "check";
8
22
  const asJson = argv.includes("--json");
9
23
  const positional = argv.slice(1).filter((a) => !a.startsWith("--"));
10
24
  if (cmd === "check") {
11
- const results = await checkTargets(positional[0]);
25
+ const results = isHttpUrl(positional[0])
26
+ ? [(await runCheck(targetFromUrl(positional[0]), { fingerprint: null, tools: [] })).result]
27
+ : await checkTargets(positional[0]);
12
28
  if (asJson) {
13
29
  console.log(JSON.stringify(results, null, 2));
14
30
  }
package/package.json CHANGED
@@ -1,28 +1,22 @@
1
1
  {
2
2
  "name": "@megamcp/sentinel",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "MegaMCP Sentinel — an MCP server that monitors the health of other MCP servers.",
5
5
  "license": "UNLICENSED",
6
- "type": "module",
7
- "files": [
8
- "dist/",
9
- "README.md",
10
- "docs-run-production.md",
11
- "run-check.ps1",
12
- "sentinel.config.json"
13
- ],
14
- "publishConfig": {
15
- "access": "public",
16
- "registry": "https://registry.npmjs.org/"
17
- },
6
+ "type": "module",
18
7
  "bin": {
8
+ "sentinel": "dist/cli.js",
19
9
  "megamcp-sentinel": "dist/cli.js",
20
10
  "megamcp-inspect": "dist/inspect.js",
21
11
  "megamcp-sentinel-report": "dist/report.js"
22
12
  },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "sentinel.config.json"
17
+ ],
23
18
  "scripts": {
24
- "build": "tsc",
25
- "prepack": "npm run build",
19
+ "build": "tsc",
26
20
  "start": "node dist/server.js",
27
21
  "check": "node dist/cli.js check",
28
22
  "watch": "node dist/cli.js watch",
@@ -1,27 +0,0 @@
1
- # Running Sentinel in production (Windows)
2
-
3
- `run-check.ps1` runs every configured check once and appends a timestamped JSON record to `logs/runs.jsonl`. Per-target rolling history is also kept in `state/`.
4
-
5
- ## Enable 24/7 monitoring (every 15 minutes, hidden)
6
-
7
- Run this once in PowerShell (it sets up a recurring Scheduled Task — OS-level persistence, so it needs your authorization):
8
-
9
- ```powershell
10
- schtasks /Create /TN "MegaMCP Sentinel" `
11
- /TR "powershell.exe -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$env:USERPROFILE\Desktop\MegaMCP\sentinel\run-check.ps1`"" `
12
- /SC MINUTE /MO 15 /F
13
- ```
14
-
15
- ## Check / run / disable
16
-
17
- ```powershell
18
- schtasks /Query /TN "MegaMCP Sentinel" /FO LIST # status + next run
19
- schtasks /Run /TN "MegaMCP Sentinel" # run now
20
- schtasks /Delete /TN "MegaMCP Sentinel" /F # remove it
21
- ```
22
-
23
- ## Where results go
24
- - `logs/runs.jsonl` — one JSON object per run: `{ at, results: [...] }`
25
- - `state/<target>.json` — rolling per-target history + last-known tool schema (for drift)
26
-
27
- When the hosted version ships, this same wrapper logic moves to a server-side cron / Vercel Cron / GitHub Action feeding the public status board.
package/run-check.ps1 DELETED
@@ -1,13 +0,0 @@
1
- # MegaMCP Sentinel - production check wrapper (for Windows Task Scheduler).
2
- # Runs all configured checks and appends one timestamped JSON line to logs\runs.jsonl.
3
- $ErrorActionPreference = 'Continue'
4
- $node = Join-Path $env:LOCALAPPDATA 'Programs\nodejs'
5
- $env:Path = "$node;$env:Path"
6
- $proj = Split-Path -Parent $MyInvocation.MyCommand.Definition
7
- Set-Location $proj
8
- New-Item -ItemType Directory -Force (Join-Path $proj 'logs') | Out-Null
9
- $stamp = (Get-Date).ToString('o')
10
- $out = (& node 'dist\cli.js' check --json) -join "`n"
11
- try { $parsed = $out | ConvertFrom-Json } catch { $parsed = @{ error = 'check failed'; raw = $out } }
12
- $line = [pscustomobject]@{ at = $stamp; results = $parsed } | ConvertTo-Json -Depth 8 -Compress
13
- Add-Content -Path (Join-Path $proj 'logs\runs.jsonl') -Value $line