@belvador/mcp 0.7.0 → 0.7.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/dist/cli.js +39 -10
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1225,7 +1225,7 @@ var TELEMETRY_PLAN_DEFAULTS = {
|
|
|
1225
1225
|
logs_monthly_bytes: 5 * 1000 ** 3,
|
|
1226
1226
|
metrics_retention_days: 14,
|
|
1227
1227
|
metrics_monthly_bytes: 2 * 1000 ** 3,
|
|
1228
|
-
metric_series_max:
|
|
1228
|
+
metric_series_max: 35000,
|
|
1229
1229
|
metric_names_max: 1000,
|
|
1230
1230
|
telemetry_rate_bytes_per_sec: 1024 * 1024,
|
|
1231
1231
|
telemetry_burst_bytes: 8 * 1024 * 1024,
|
|
@@ -1288,7 +1288,8 @@ var METRIC_QUERY = {
|
|
|
1288
1288
|
exemplarsMax: 50,
|
|
1289
1289
|
queryMaxSeconds: 3
|
|
1290
1290
|
};
|
|
1291
|
-
var
|
|
1291
|
+
var metricNameSchema = z10.string().min(1).max(METRIC_LIMITS.nameMaxChars).regex(METRIC_NAME_RE);
|
|
1292
|
+
var metricName = metricNameSchema;
|
|
1292
1293
|
var attrKey = z10.string().regex(METRIC_ATTR_KEY_RE);
|
|
1293
1294
|
var metricFilterSchema = z10.object({
|
|
1294
1295
|
k: attrKey,
|
|
@@ -2340,7 +2341,7 @@ var TOKEN_IN_TEXT = new RegExp(PING_TOKEN_PATTERN, "g");
|
|
|
2340
2341
|
import { z as z17 } from "zod";
|
|
2341
2342
|
|
|
2342
2343
|
// ../src/shared/contracts/vocab/slo.ts
|
|
2343
|
-
var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans"];
|
|
2344
|
+
var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans", "metric"];
|
|
2344
2345
|
|
|
2345
2346
|
// ../src/shared/contracts/slo.ts
|
|
2346
2347
|
var SLO_SLIS = ["availability", "latency"];
|
|
@@ -2360,6 +2361,8 @@ var SLO_LIMITS = {
|
|
|
2360
2361
|
descriptionMaxChars: 1000,
|
|
2361
2362
|
environmentMaxChars: 64,
|
|
2362
2363
|
spansLagMinutes: 3,
|
|
2364
|
+
metricsLagMinutes: 3,
|
|
2365
|
+
metricSeenMinutes: 5,
|
|
2363
2366
|
sliItemsPerMessage: 200,
|
|
2364
2367
|
maxNodeSlos: 1000
|
|
2365
2368
|
};
|
|
@@ -2367,14 +2370,30 @@ var SLO_SOURCE_META = {
|
|
|
2367
2370
|
uptime: { provenance: "managed_probe", estimated: false, slis: ["availability", "latency"], budgeting: "Timeslices" },
|
|
2368
2371
|
monitor: { provenance: "check_in", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
|
|
2369
2372
|
heartbeat: { provenance: "ping_token", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
|
|
2370
|
-
spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" }
|
|
2373
|
+
spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" },
|
|
2374
|
+
metric: { provenance: "ingest_key", estimated: false, slis: ["availability"], budgeting: "Occurrences" }
|
|
2371
2375
|
};
|
|
2376
|
+
var sloMetricSchema = z17.object({
|
|
2377
|
+
name: metricNameSchema,
|
|
2378
|
+
filter: z17.array(metricFilterSchema).max(METRIC_QUERY.filtersMax).default([])
|
|
2379
|
+
}).superRefine((m, ctx) => {
|
|
2380
|
+
m.filter.forEach((f, i) => {
|
|
2381
|
+
if (f.op === "exists" !== (f.v === undefined))
|
|
2382
|
+
ctx.addIssue({ code: "custom", path: ["filter", i, "v"], message: "INVALID_INPUT" });
|
|
2383
|
+
});
|
|
2384
|
+
});
|
|
2385
|
+
function sameSloMetric(a, b) {
|
|
2386
|
+
const key = (m) => JSON.stringify([m.name, [...m.filter].map((f) => [f.k, f.op, f.v ?? null]).sort()]);
|
|
2387
|
+
return key(a) === key(b);
|
|
2388
|
+
}
|
|
2372
2389
|
var nodeSloSchema = z17.object({
|
|
2373
2390
|
slo_id: z17.guid(),
|
|
2374
2391
|
project_id: z17.number().int().positive(),
|
|
2375
|
-
source: z17.enum(["monitor", "spans"]),
|
|
2392
|
+
source: z17.enum(["monitor", "spans", "metric"]),
|
|
2376
2393
|
sli: z17.enum(SLO_SLIS),
|
|
2377
2394
|
monitor_id: z17.guid().optional(),
|
|
2395
|
+
good_metric: sloMetricSchema.optional(),
|
|
2396
|
+
total_metric: sloMetricSchema.optional(),
|
|
2378
2397
|
environment: z17.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
|
|
2379
2398
|
service: z17.string().min(1).max(128).optional(),
|
|
2380
2399
|
operation: z17.string().min(1).max(256).optional(),
|
|
@@ -2385,6 +2404,8 @@ var nodeSloSchema = z17.object({
|
|
|
2385
2404
|
ctx.addIssue({ code: "custom", path: ["monitor_id"], message: "INVALID_INPUT" });
|
|
2386
2405
|
if (v.source === "spans" && !v.service)
|
|
2387
2406
|
ctx.addIssue({ code: "custom", path: ["service"], message: "INVALID_INPUT" });
|
|
2407
|
+
if (v.source === "metric" !== Boolean(v.good_metric && v.total_metric) || v.source === "metric" && v.sli !== "availability")
|
|
2408
|
+
ctx.addIssue({ code: "custom", path: ["good_metric"], message: "INVALID_INPUT" });
|
|
2388
2409
|
if (v.sli === "latency" !== (v.latency_threshold_ms !== undefined))
|
|
2389
2410
|
ctx.addIssue({ code: "custom", path: ["latency_threshold_ms"], message: "INVALID_INPUT" });
|
|
2390
2411
|
});
|
|
@@ -2401,7 +2422,9 @@ var sloInputSchema = z17.object({
|
|
|
2401
2422
|
projectId: z17.number().int().positive().optional(),
|
|
2402
2423
|
service: z17.string().max(128).optional(),
|
|
2403
2424
|
operation: z17.string().max(256).optional(),
|
|
2404
|
-
environment: z17.string().max(SLO_LIMITS.environmentMaxChars).optional()
|
|
2425
|
+
environment: z17.string().max(SLO_LIMITS.environmentMaxChars).optional(),
|
|
2426
|
+
goodMetric: sloMetricSchema.optional(),
|
|
2427
|
+
totalMetric: sloMetricSchema.optional()
|
|
2405
2428
|
}),
|
|
2406
2429
|
sli: z17.enum(SLO_SLIS),
|
|
2407
2430
|
latencyThresholdMs: z17.number().int().min(1).max(60000).nullable(),
|
|
@@ -2414,9 +2437,15 @@ var sloInputSchema = z17.object({
|
|
|
2414
2437
|
ctx.addIssue({ code: "custom", path: ["sli"], message: "INVALID_INPUT" });
|
|
2415
2438
|
if (v.sli === "latency" !== Boolean(v.latencyThresholdMs))
|
|
2416
2439
|
ctx.addIssue({ code: "custom", path: ["latencyThresholdMs"], message: "INVALID_INPUT" });
|
|
2417
|
-
|
|
2440
|
+
const ref = v.sourceRef;
|
|
2441
|
+
const refOk = v.source === "spans" ? Boolean(ref.projectId && ref.service?.trim()) : v.source === "metric" ? Boolean(ref.projectId && ref.goodMetric && ref.totalMetric) : Boolean(ref.id);
|
|
2442
|
+
if (!refOk)
|
|
2418
2443
|
ctx.addIssue({ code: "custom", path: ["sourceRef"], message: "INVALID_INPUT" });
|
|
2419
|
-
if (v.
|
|
2444
|
+
if (v.source === "metric" && ref.goodMetric && ref.totalMetric && sameSloMetric(ref.goodMetric, ref.totalMetric))
|
|
2445
|
+
ctx.addIssue({ code: "custom", path: ["sourceRef", "goodMetric"], message: "INVALID_INPUT" });
|
|
2446
|
+
if (v.source !== "metric" && (ref.goodMetric || ref.totalMetric))
|
|
2447
|
+
ctx.addIssue({ code: "custom", path: ["sourceRef", "goodMetric"], message: "INVALID_INPUT" });
|
|
2448
|
+
if (ref.environment !== undefined && v.source !== "monitor" && v.source !== "spans" && v.source !== "metric")
|
|
2420
2449
|
ctx.addIssue({ code: "custom", path: ["sourceRef", "environment"], message: "INVALID_INPUT" });
|
|
2421
2450
|
if (v.allowPublicSources && v.source !== "monitor" && v.source !== "spans")
|
|
2422
2451
|
ctx.addIssue({ code: "custom", path: ["allowPublicSources"], message: "INVALID_INPUT" });
|
|
@@ -3015,7 +3044,7 @@ var MONITOR_OPERATIONS = [
|
|
|
3015
3044
|
idempotency: "required",
|
|
3016
3045
|
status: 201,
|
|
3017
3046
|
mcp: "configure",
|
|
3018
|
-
summary: "Create an SLO over a monitor, an uptime check or
|
|
3047
|
+
summary: "Create an SLO over a monitor, a heartbeat, an uptime check, spans or two metric counters (good ÷ total).",
|
|
3019
3048
|
ui: ["slos#createSlo"]
|
|
3020
3049
|
}),
|
|
3021
3050
|
op({
|
|
@@ -6159,7 +6188,7 @@ function findToken(env = process.env, keychain = keychainToken) {
|
|
|
6159
6188
|
}
|
|
6160
6189
|
|
|
6161
6190
|
// packages/mcp/src/cli.ts
|
|
6162
|
-
var PACKAGE_VERSION = "0.7.
|
|
6191
|
+
var PACKAGE_VERSION = "0.7.1";
|
|
6163
6192
|
var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
|
|
6164
6193
|
|
|
6165
6194
|
Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belvador/mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Belvador MCP server over stdio: the same read-only tools as api.belvador.dev/mcp (issues, events, traces, logs, monitors, docs), with node data read straight from the edge.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Belvador (https://belvador.dev)",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"node": ">=20.10"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@belvador/api": "0.7.
|
|
33
|
+
"@belvador/api": "0.7.1",
|
|
34
34
|
"@modelcontextprotocol/server": "2.4.0",
|
|
35
35
|
"zod": "4.6.7"
|
|
36
36
|
},
|