@lacneu/atrium-mcp 0.30.0

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/tools.js ADDED
@@ -0,0 +1,389 @@
1
+ /**
2
+ * Shared tool logic for both the MCP server and the CLI.
3
+ *
4
+ * Each function here maps 1:1 to one /api/v1 route. The package is a thin proxy:
5
+ * whether a route is deployed is a *runtime* concern — a not-yet-deployed route
6
+ * returns the API's own response/error (e.g. 404) which we surface, rather than
7
+ * crashing the server.
8
+ *
9
+ * Server-side `requirePermission` enforces the key's scope, so a tool call to a
10
+ * route the key lacks permission for naturally returns 403.
11
+ */
12
+ import { z } from "zod";
13
+ import { apiFetch } from "./config.js";
14
+ /**
15
+ * Shared MCP input schemas, kept here (not in server.ts) so they can be unit
16
+ * tested without importing server.ts/cli.ts — both of which call `main()` at
17
+ * module load. server.ts spreads these into `registerTool({ inputSchema })`.
18
+ */
19
+ export const queryOpenClawInput = {
20
+ question: z.string().optional().describe("Prompt/query text."),
21
+ payload: z.unknown().optional()
22
+ .describe("Free-form passthrough forwarded to the bridge."),
23
+ };
24
+ export const reportAnomalyInput = {
25
+ kind: z.string().describe("Anomaly kind/type (required)."),
26
+ severity: z.enum(["info", "warn", "critical"])
27
+ .describe("Severity: 'info' | 'warn' | 'critical' (required)."),
28
+ message: z.string().describe("Human-readable description (required)."),
29
+ correlationId: z.string().optional()
30
+ .describe("Correlation chain this anomaly relates to."),
31
+ evidence: z.unknown().optional()
32
+ .describe("Free-form structured, non-PHI evidence."),
33
+ };
34
+ export const getDeliveryReportInput = {
35
+ sessionId: z.string().optional()
36
+ .describe("Recording session id; omit for the active (or most recent) session."),
37
+ };
38
+ export const deleteDeliverySessionsInput = {
39
+ sessionIds: z.array(z.string()).min(1)
40
+ .describe("Recording session ids to delete (along with their timing rows)."),
41
+ };
42
+ /**
43
+ * Time-range token: epoch ms (numeric string) OR a Grafana-style relative
44
+ * token — `now`, or `now-<N><unit>` with unit in s|m|h|d|w (e.g. `now-24h`).
45
+ * Passed through verbatim; the server resolves tokens → ms at request time.
46
+ */
47
+ const FROM_DESCRIBE = "Lower time bound. Epoch ms (e.g. '1717372800000') OR Grafana relative " +
48
+ "token: 'now' or 'now-<N><unit>' with unit s|m|h|d|w (e.g. 'now-24h').";
49
+ const TO_DESCRIBE = "Upper time bound. Epoch ms (e.g. '1717459200000') OR Grafana relative " +
50
+ "token: 'now' or 'now-<N><unit>' with unit s|m|h|d|w (e.g. 'now').";
51
+ export const listTracesInput = {
52
+ limit: z.number().int().min(1).max(200).optional()
53
+ .describe("Max events to return (1-200)."),
54
+ q: z.string().optional()
55
+ .describe("Case-insensitive substring over kind, principalId, roleKey, route, correlationId."),
56
+ from: z.string().optional().describe(FROM_DESCRIBE),
57
+ to: z.string().optional().describe(TO_DESCRIBE),
58
+ kind: z.string().optional()
59
+ .describe("Filter by event kind (e.g. 'api.call')."),
60
+ status: z.number().int().optional()
61
+ .describe("Filter by exact HTTP status code (e.g. 404)."),
62
+ statusClass: z.enum(["2xx", "4xx", "5xx"]).optional()
63
+ .describe("Filter by HTTP status class: '2xx' | '4xx' | '5xx'."),
64
+ direction: z.string().optional()
65
+ .describe("Filter by direction (e.g. 'inbound' | 'outbound')."),
66
+ principalType: z.string().optional()
67
+ .describe("Filter by principal type (e.g. 'user' | 'service')."),
68
+ roleKey: z.string().optional().describe("Filter by role key."),
69
+ correlationId: z.string().optional()
70
+ .describe("Filter to one correlation chain."),
71
+ };
72
+ export const getKpiInput = {
73
+ metric: z.string().optional()
74
+ .describe("Filter to a single metric name."),
75
+ since: z.string().optional()
76
+ .describe("ISO timestamp or bucket lower bound (kept; equivalent to from)."),
77
+ from: z.string().optional().describe(FROM_DESCRIBE),
78
+ to: z.string().optional().describe(TO_DESCRIBE),
79
+ };
80
+ export const listAnomaliesInput = {
81
+ limit: z.number().int().min(1).max(200).optional()
82
+ .describe("Max anomalies to return (1-200)."),
83
+ since: z.string().optional()
84
+ .describe("ISO timestamp lower bound (kept; equivalent to from)."),
85
+ q: z.string().optional()
86
+ .describe("Case-insensitive substring over message, kind, correlationId."),
87
+ from: z.string().optional().describe(FROM_DESCRIBE),
88
+ to: z.string().optional().describe(TO_DESCRIBE),
89
+ status: z.string().optional()
90
+ .describe("Filter by anomaly status (e.g. 'open' | 'acknowledged')."),
91
+ severity: z.string().optional()
92
+ .describe("Filter by severity (e.g. 'info' | 'warn' | 'critical')."),
93
+ source: z.string().optional().describe("Filter by anomaly source."),
94
+ kind: z.string().optional().describe("Filter by anomaly kind/type."),
95
+ };
96
+ export const getFeedbackReportInput = {
97
+ feedbackId: z
98
+ .string()
99
+ .describe("The report reference (the id the feedback dialog shows after submit)"),
100
+ };
101
+ /**
102
+ * GET /api/v1/feedback-report — one user-submitted report by its shareable
103
+ * REFERENCE. Returns the frozen forensic snapshot (message text/parts, prompt,
104
+ * context window, session settings — volunteered by the reporter) + survival
105
+ * flags (chatExists/messageExists: the report OUTLIVES message/chat deletion).
106
+ * Requires `traces.read`.
107
+ */
108
+ export function getFeedbackReport(config, args, options) {
109
+ return apiFetch(config, `/feedback-report${qs({ feedbackId: args.feedbackId })}`, {}, options);
110
+ }
111
+ export const getChatStateInput = {
112
+ chatId: z.string().describe("The chat id (the /chat/<id> path segment) to inspect (required)."),
113
+ };
114
+ export const getCompactionHistoryInput = {
115
+ chatId: z.string().describe("The chat id (the /chat/<id> path segment) whose gateway-session compaction history to read (required)."),
116
+ };
117
+ export const getSchemaInput = {
118
+ id: z.string().describe("The schema registry id (from list_schemas), e.g. \"provenance.v1\" (required)."),
119
+ };
120
+ export const getTraceEnrichmentInput = {
121
+ correlationId: z
122
+ .string()
123
+ .describe("The Atrium correlationId of the turn (from a trace/anomaly via list_traces/list_anomalies) — the deterministic key to the Opik/Langfuse trace (required)."),
124
+ chatId: z
125
+ .string()
126
+ .optional()
127
+ .describe("Optional chat id. Enables the Langfuse session augmentation: surfaces OTHER traces on the same chat session (incl. any OpenClaw-emitted one), content-free. Omit for this turn's deterministic trace only."),
128
+ at: z
129
+ .number()
130
+ .optional()
131
+ .describe("The ORIGINAL trace timestamp (epoch ms), from the same trace/anomaly row as " +
132
+ "the correlationId. REQUIRED to resolve an Opik trace (its id bakes the " +
133
+ "timestamp in); omit only for a Langfuse-only lookup. Without it, Opik " +
134
+ "reports `needs_timestamp` rather than silently returning nothing."),
135
+ };
136
+ export const diagnoseChatInput = {
137
+ chatId: z.string().describe("The chat id to diagnose (required)."),
138
+ };
139
+ export const reconcileChatInput = {
140
+ chatId: z
141
+ .string()
142
+ .describe("The chat id whose stuck stream to reconcile (required)."),
143
+ };
144
+ export const syncInstanceInput = {
145
+ instance: z
146
+ .string()
147
+ .describe("The instance NAME to force-sync (required)."),
148
+ };
149
+ /** Build a query string from defined values only (Bearer is never in the URL). */
150
+ function qs(params) {
151
+ const sp = new URLSearchParams();
152
+ for (const [key, value] of Object.entries(params)) {
153
+ if (value !== undefined && value !== null && value !== "") {
154
+ sp.set(key, String(value));
155
+ }
156
+ }
157
+ const s = sp.toString();
158
+ return s ? `?${s}` : "";
159
+ }
160
+ /** GET /api/v1/health — liveness probe (no auth needed, but we send the key). */
161
+ export function health(config, options) {
162
+ return apiFetch(config, "/health", {}, options);
163
+ }
164
+ /**
165
+ * GET /api/v1/compat — the bridge compatibility snapshot (reachable,
166
+ * bridgeVersion, per-instance targets + their gatewayVersion). Requires
167
+ * `bridge.read`. Diagnoses the "version gateway inconnue" gating: empty
168
+ * `targets` (or a `gatewayVersion: null` target) is what gates AgentFiles /
169
+ * ChatDefaults off.
170
+ */
171
+ export function getCompat(config, options) {
172
+ return apiFetch(config, "/compat", {}, options);
173
+ }
174
+ /**
175
+ * GET /api/v1/bridge-status — a CLEAR per-instance bridge<->gateway health view: per
176
+ * instance `bridgeUrlConfigured`, `available`/`degraded` + `reason`, `gatewayVersion` +
177
+ * `gatewayState`/`lastErrorCode`, `agentCount` + discovery freshness. Requires
178
+ * `bridge.read`. The fast "what's wrong with my instances" check — e.g. an instance with
179
+ * `bridgeUrlConfigured:false` is exactly why a sync returns `no_bridge_url`.
180
+ */
181
+ export function bridgeStatus(config, options) {
182
+ return apiFetch(config, "/bridge-status", {}, options);
183
+ }
184
+ /**
185
+ * GET /api/v1/integrations — Opik/Langfuse integration status: per vendor
186
+ * `configured`/`enabled` + the NON-SECRET effective endpoints + the shipping
187
+ * cursors (lastAt/failureCount/error code). NEVER a key. Requires `traces.read`.
188
+ * The self-correction loop's first step: an agent learns whether enriched
189
+ * observability data is available (and shipping is healthy) before asking for it.
190
+ */
191
+ export function getIntegrations(config, options) {
192
+ return apiFetch(config, "/integrations", {}, options);
193
+ }
194
+ /**
195
+ * GET /api/v1/chat-state — per-message lifecycle of one chat (METADATA ONLY: no
196
+ * text). Requires `traces.read`. Exposes the stuck-streaming signal: a message
197
+ * `status:"streaming"` with a large `ageSeconds` (`stuckStreaming:true`) is a
198
+ * turn whose finalize frame the bridge never relayed. A provenance part also
199
+ * carries a SOC2-safe `structure` (per-item kind + hasFileName/hasScore booleans,
200
+ * counts, allowlisted source/route) for diagnosing the Sources panel content-free.
201
+ *
202
+ * TURN RECONSTRUCTION (content-free): per message, `outbox:{outboxId,status}` is
203
+ * the dispatch JOIN KEY — `chatId:outboxId` is the correlationId of that turn's
204
+ * chat.send / openclaw.dispatch (and openclaw.rehydrate) traces, so list_traces
205
+ * stitches a message to its dispatch chain. NOTE on `outbox:null`: it means EITHER
206
+ * no outbox row (an assistant message — only user turns dispatch) OR a user message
207
+ * older than the per-status read cap; when top-level `outboxTruncated` is true, read
208
+ * null on an OLDER user message as "beyond the cap", NOT as "never dispatched". The
209
+ * most-recent user turns are always covered. Per message, `routedInstanceName` /
210
+ * `routedAgentId` give the per-turn routed agent (null = the chat's primary).
211
+ * Chat-level `routing` (perTurnRouting + lastRouted* + the opaque `routingSegment`)
212
+ * shows whether/where the chat fans turns to specialists. `subAgents` is the
213
+ * content-free delegation summary: `byStatus` counts + capped `failedSample` /
214
+ * `runningSample` (each = childIdShort + status enum + errorCategory enum +
215
+ * hasTaskName bool + ageSeconds — NEVER the task/result/error text or phase).
216
+ */
217
+ export function getChatState(config, args, options) {
218
+ return apiFetch(config, `/chat-state${qs({ chatId: args.chatId })}`, {}, options);
219
+ }
220
+ /**
221
+ * GET /api/v1/compaction-history — the gateway's compaction checkpoints for one
222
+ * chat's session (LAZY: the only caller of the gateway's sessions.compaction.list,
223
+ * never on the turn path). Requires `traces.read`. CONTENT-FREE: each checkpoint =
224
+ * {checkpointId, createdAt, reason, tokensBefore, tokensAfter} — the stored summary
225
+ * (conversation content) never crosses this API. Correlate with the per-turn
226
+ * `chat.gateway_pressure` traces (list_traces kind=chat.gateway_pressure): pressure
227
+ * shows WHEN the session filled up + which turn compacted; this shows what each
228
+ * compaction condensed (e.g. reason "auto-threshold", 19698 -> 1050 tokens).
229
+ */
230
+ export function getCompactionHistory(config, args, options) {
231
+ return apiFetch(config, `/compaction-history${qs({ chatId: args.chatId })}`, {}, options);
232
+ }
233
+ /**
234
+ * GET /api/v1/schemas — the published CONTRACT schemas an integration author can
235
+ * conform to (provenance/v1 today; more as the surface grows). Metadata list (id,
236
+ * title, version, category). PUBLIC (no key required). The discovery step before
237
+ * fetching one schema with get_schema.
238
+ */
239
+ export function listSchemas(config, options) {
240
+ return apiFetch(config, "/schemas", {}, options);
241
+ }
242
+ /**
243
+ * GET /api/v1/schemas/:id — one published contract schema's JSON (e.g.
244
+ * "provenance.v1"), to validate a plugin's emitted reports against. PUBLIC (no key
245
+ * required). 404 for an unknown id.
246
+ */
247
+ export function getSchema(config, args, options) {
248
+ return apiFetch(config, `/schemas/${encodeURIComponent(args.id)}`, {}, options);
249
+ }
250
+ /**
251
+ * GET /api/v1/trace-enrichment — the SOC2-safe STRUCTURE of a turn's trace (keyed
252
+ * by its correlationId) from the configured Opik/Langfuse: span
253
+ * names/types/lifecycle/timing/parent tree, NEVER input/output/message
254
+ * text/metadata. Requires `traces.read`. The self-correction loop's deep read: an
255
+ * agent sees the REAL OpenClaw message structure behind an anomaly without ever
256
+ * seeing regulated data.
257
+ */
258
+ export function getTraceEnrichment(config, args, options) {
259
+ return apiFetch(config, `/trace-enrichment${qs({ correlationId: args.correlationId, chatId: args.chatId, at: args.at })}`, {}, options);
260
+ }
261
+ /**
262
+ * GET /api/v1/diagnose — ONE actionable assessment of a chat for the
263
+ * self-correction loop: SOC2-safe chat-state + bridge availability, classified
264
+ * (stuck_stream | dispatch_error | attachment_problem | subagent_stuck |
265
+ * subagent_failure | bridge_unavailable | bridge_degraded | healthy) with a
266
+ * `suggestedAction` and, when a safe corrective exists, a `suggestedTool`.
267
+ * `subagent_stuck` (a delegated sub-agent running far too long — a main turn
268
+ * awaiting it can hang) and `subagent_failure` (a recent failed delegation) read
269
+ * the new chat-state `subAgents` summary. Requires `traces.read`. Read-only. Call
270
+ * FIRST on a user report, then act on the suggestion.
271
+ */
272
+ export function diagnoseChat(config, args, options) {
273
+ return apiFetch(config, `/diagnose${qs({ chatId: args.chatId })}`, {}, options);
274
+ }
275
+ /**
276
+ * POST /api/v1/reconcile-chat — the BOUNDED corrective `diagnose` may recommend:
277
+ * flip this chat's stuck 'streaming' message(s) to error (preserving text),
278
+ * releasing the hung UI so the user can retry. Requires `selfheal` (a sensitive
279
+ * write). Audited. Only touches messages already streaming past a short cutoff.
280
+ */
281
+ export function reconcileChat(config, args, options) {
282
+ return apiFetch(config, "/reconcile-chat", { method: "POST", body: JSON.stringify({ chatId: args.chatId }) }, options);
283
+ }
284
+ /**
285
+ * POST /api/v1/instances/sync — force an instance sync: poke the bridge (resolve creds +
286
+ * connect -> pairing) then pull THAT instance's agents into Atrium NOW, instead of waiting
287
+ * for the discovery cron. Requires `selfheal` (the admin + agent service-account roles).
288
+ * Returns `{ status, agents, detail }` — `status` is the exact outcome (synced | no_agents
289
+ * | no_bridge_url | unreachable | unauthorized | not_served | deploy_misconfigured) and
290
+ * `detail` is a plain-English explanation an agent can act on.
291
+ */
292
+ export function syncInstance(config, args, options) {
293
+ return apiFetch(config, "/instances/sync", { method: "POST", body: JSON.stringify({ instance: args.instance }) }, options);
294
+ }
295
+ /**
296
+ * POST /api/v1/delivery-record/start — start a delivery-latency recording session
297
+ * (measures the bridge->Convex->frontend streaming pipeline, per delta, content-free).
298
+ * Requires `selfheal` (activation is a privileged write). Returns { sessionId,
299
+ * autoStopAt }; the session auto-stops after ~10 min.
300
+ */
301
+ export function startDeliveryRecord(config, options) {
302
+ return apiFetch(config, "/delivery-record/start", { method: "POST", body: "{}" }, options);
303
+ }
304
+ /** POST /api/v1/delivery-record/stop — stop the active recording. Requires `selfheal`. */
305
+ export function stopDeliveryRecord(config, options) {
306
+ return apiFetch(config, "/delivery-record/stop", { method: "POST", body: "{}" }, options);
307
+ }
308
+ /**
309
+ * GET /api/v1/delivery-report — skew-corrected per-segment latency for a recording
310
+ * session: A=bridge->Convex, B=Convex exec, C=Convex->frontend (p50/p95/max + counts;
311
+ * C.count <= A.count by design, since the client only observes coalesced states).
312
+ * Requires `traces.read`. Omit sessionId for the active (or most recent) session.
313
+ */
314
+ export function getDeliveryReport(config, args, options) {
315
+ return apiFetch(config, `/delivery-report${qs({ sessionId: args.sessionId })}`, {}, options);
316
+ }
317
+ /**
318
+ * GET /api/v1/delivery-sessions — list recent recording sessions (sessionId,
319
+ * startedAt, stoppedAt, startedBy, active). Requires `traces.read`. Use to pick a
320
+ * sessionId for get_delivery_report or delete_delivery_sessions.
321
+ */
322
+ export function listDeliverySessions(config, options) {
323
+ return apiFetch(config, "/delivery-sessions", {}, options);
324
+ }
325
+ /**
326
+ * POST /api/v1/delivery-record/delete — delete recording sessions and their timing
327
+ * rows. Requires `selfheal`. Deleting the active session also stops recording.
328
+ */
329
+ export function deleteDeliverySessions(config, args, options) {
330
+ return apiFetch(config, "/delivery-record/delete", { method: "POST", body: JSON.stringify({ sessionIds: args.sessionIds }) }, options);
331
+ }
332
+ /** GET /api/v1/traces — recent trace events. Requires `traces.read`. */
333
+ export function listTraces(config, args = {}, options) {
334
+ const query = qs({
335
+ limit: args.limit,
336
+ q: args.q,
337
+ from: args.from,
338
+ to: args.to,
339
+ kind: args.kind,
340
+ status: args.status,
341
+ statusClass: args.statusClass,
342
+ direction: args.direction,
343
+ principalType: args.principalType,
344
+ roleKey: args.roleKey,
345
+ correlationId: args.correlationId,
346
+ });
347
+ return apiFetch(config, `/traces${query}`, {}, options);
348
+ }
349
+ /** GET /api/v1/kpi — KPI rollups. Requires `kpi.read`. */
350
+ export function getKpi(config, args = {}, options) {
351
+ const query = qs({
352
+ metric: args.metric,
353
+ since: args.since,
354
+ from: args.from,
355
+ to: args.to,
356
+ });
357
+ return apiFetch(config, `/kpi${query}`, {}, options);
358
+ }
359
+ /**
360
+ * POST /api/v1/openclaw/query — query OpenClaw via the bridge.
361
+ * Requires `openclaw.query`. Sends `{ question, payload }` (the only keys the
362
+ * server route reads; it 400s when both are undefined).
363
+ */
364
+ export function queryOpenClaw(config, args = {}, options) {
365
+ return apiFetch(config, "/openclaw/query", { method: "POST", body: JSON.stringify(args) }, options);
366
+ }
367
+ /** GET /api/v1/anomalies — detected anomalies. Requires `anomalies.read`. */
368
+ export function listAnomalies(config, args = {}, options) {
369
+ const query = qs({
370
+ limit: args.limit,
371
+ since: args.since,
372
+ q: args.q,
373
+ from: args.from,
374
+ to: args.to,
375
+ status: args.status,
376
+ severity: args.severity,
377
+ source: args.source,
378
+ kind: args.kind,
379
+ });
380
+ return apiFetch(config, `/anomalies${query}`, {}, options);
381
+ }
382
+ /**
383
+ * POST /api/v1/anomalies — report an anomaly. Requires
384
+ * `anomalies.report`. Sends `evidence` (the server's field name), not `details`.
385
+ */
386
+ export function reportAnomaly(config, args, options) {
387
+ return apiFetch(config, "/anomalies", { method: "POST", body: JSON.stringify(args) }, options);
388
+ }
389
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,C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EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,EAAE,aAAa,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAc,EACd,IAAuB,EACvB,OAAyB;IAEzB,OAAO,QAAQ,CACb,MAAM,EACN,YAAY,EACZ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAC9C,OAAO,CACR,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@lacneu/atrium-mcp",
3
+ "version": "0.30.0",
4
+ "type": "module",
5
+ "description": "Thin MCP server + CLI that proxy the atrium /api/v1 observability surface using an oc_live_ Bearer key. Talks HTTP only — no Convex imports.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/lacneu/atrium.git",
10
+ "directory": "mcp"
11
+ },
12
+ "bin": {
13
+ "atrium-mcp": "dist/server.js",
14
+ "atrium": "dist/cli.js"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.build.json",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest",
25
+ "mcp": "node dist/server.js",
26
+ "cli": "node dist/cli.js"
27
+ },
28
+ "dependencies": {
29
+ "@modelcontextprotocol/sdk": "^1.29.0",
30
+ "zod": "^4.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^20.14.0",
34
+ "typescript": "^5.5.4",
35
+ "vitest": "^2.0.5"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ }
40
+ }