@tryvira/mcp 0.1.60 → 0.1.62

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.
Files changed (3) hide show
  1. package/README.md +6 -2
  2. package/dist/cli.js +84 -7
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@ An npx-ready MCP server for Vira's existing scoped authority boundary.
8
8
  ## Run it
9
9
 
10
10
  ```bash
11
- npx -y @tryvira/mcp@0.1.55
11
+ npx -y @tryvira/mcp@0.1.62
12
12
  ```
13
13
 
14
14
  The package is a thin stdio MCP adapter over the public Vira API. It uses the
@@ -45,7 +45,11 @@ policy, evaluation, and release eligibility. The server does not bypass those ch
45
45
 
46
46
  ## What a client can discover
47
47
 
48
- Version `0.1.55` exposes the complete public lifecycle tool catalog, including
48
+ Version `0.1.62` exposes a compact, task-oriented public catalog. The first-class
49
+ workflow tools cover connection, semantic resolution, TaskRuns, Teach, evaluation,
50
+ pack release and runtime projection. The remaining registered Control API operations
51
+ are available through `read_control_api` and `write_control_api`, so the catalog
52
+ does not duplicate every GET/POST route as a separate model-facing tool.
49
53
  AI System/connection diagnostics, Behavior Programs and Strategies, Pack
50
54
  evaluation/approval/revision/materialization, TaskRun readback and recovery,
51
55
  observation and signal operations, Teach analysis/review, comparative
package/dist/cli.js CHANGED
@@ -13,8 +13,10 @@ var registry = {};
13
13
  var add = (names, authority) => names.forEach((name) => {
14
14
  registry[name] = authority;
15
15
  });
16
+ var generatedReadTools = ["list_strategy_executions", "search_runtime_traces", "get_ai_system", "list_system_connections", "list_inventory", "get_connection", "connection_health", "list_teach_analyses", "get_teach_analysis", "get_evaluation", "list_conversation_archive", "list_teach_runs", "get_teach_run_recommendation", "get_improvement_proposal", "list_compound_task_plans", "get_compound_task_plan", "get_behavior_program"];
17
+ add(generatedReadTools, read());
16
18
  add(["get_scope", "list_capabilities", "get_job", "list_inbox", "get_conflict_inspection", "get_optimization_run", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_behavior_program", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "list_ai_systems", "get_ai_system", "list_system_connections", "get_connection", "connection_health", "inventory", "connection_inventory", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision", "get_pack_revision_diff", "list_packs", "diagnose_pack", "get_teach_analysis", "get_teach_run_recommendation", "get_evaluation", "get_evaluation_comparison", "get_evaluation_plan", "get_improvement_proposal", "search_runtime_traces"], read());
17
- add(["connect_once", "observe", "feedback", "outcome"], effectful("integration.write", "server", ["studio.write", "admin"]));
19
+ add(["connect_ai_system", "observe", "record_user_feedback", "record_business_outcome"], effectful("integration.write", "server", ["studio.write", "admin"]));
18
20
  add(["mark_inbox_read"], effectful("teach.write", "server", ["studio.write", "admin"]));
19
21
  add(["inspect_conflicts", "resolve_conflict"], effectful("behavior.write", "server", ["studio.write", "admin", "release.approve"]));
20
22
  add(["start_optimization", "cancel_optimization_run"], effectful("evaluation.write", "server", ["studio.write", "admin", "optimizer.execute"]));
@@ -33,8 +35,10 @@ add(["review_comparative_finding", "edit_improvement_proposal", "transition_beha
33
35
  add(["create_release"], effectful("release.approve", "human"));
34
36
  add(["create_signal_discovery_proposal", "review_signal_discovery_proposal", "materialize_signal_discovery", "create_signal_mapping", "review_signal_mapping", "create_observation", "review_discovery_candidate"], effectful("discovery.write"));
35
37
  add(["create_pack_revision", "transition_pack_revision", "materialize_pack_revision", "import_pack", "install_pack", "evaluate_pack", "approve_pack", "release_pack", "preview_pack_upgrade"], effectful("pack.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
38
+ add(["read_control_api"], read());
39
+ add(["write_control_api"], effectful("integration.write", "server", ["studio.write", "admin"]));
36
40
  var MCP_TOOL_REGISTRY = Object.freeze(registry);
37
- var getMcpToolAuthority = (tool) => MCP_TOOL_REGISTRY[tool];
41
+ var getMcpToolAuthority = (tool) => MCP_TOOL_REGISTRY[tool] ?? (tool.startsWith("api_get_") ? { requiredRoles: ["integration.read"], scopePolicy: "environment", effectType: "read" } : { requiredRoles: ["integration.write"], scopePolicy: "environment", effectType: "effectful" });
38
42
  var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
39
43
 
40
44
  // src/cli.ts
@@ -140,13 +144,31 @@ var readFromApi = async (path) => {
140
144
  for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
141
145
  return (await viraHttpRequest(url, { method: "GET", apiKey })).body;
142
146
  };
147
+ var safeControlPath = (value) => {
148
+ const path = String(value ?? "");
149
+ if (!/^\/v1\/[A-Za-z0-9_./{}-]+$/.test(path) || path.includes("..")) throw new Error("MCP_CONTROL_PATH_INVALID");
150
+ return path;
151
+ };
152
+ var controlQuery = (query) => {
153
+ if (query === void 0) return "";
154
+ if (!query || typeof query !== "object" || Array.isArray(query)) throw new Error("MCP_CONTROL_QUERY_INVALID");
155
+ const entries = Object.entries(query).filter(([, value]) => value !== void 0);
156
+ return entries.length ? "?" + entries.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === "string" ? value : JSON.stringify(value))}`).join("&") : "";
157
+ };
158
+ var readControlApi = async (args) => readFromApi(`${safeControlPath(args.path)}${controlQuery(args.query)}`);
159
+ var writeControlApi = async (args) => {
160
+ const path = safeControlPath(args.path);
161
+ const method = String(args.method ?? "POST");
162
+ if (!["POST", "PUT", "PATCH", "DELETE"].includes(method)) throw new Error("MCP_CONTROL_WRITE_METHOD_INVALID");
163
+ return (await viraHttpRequest(`${baseUrl}${path}`, { method, apiKey, body: { ...scope, ...args.body && typeof args.body === "object" ? args.body : {} }, idempotencyKey: String(args.idempotencyKey ?? `mcp:write_control_api:${path}`) })).body;
164
+ };
143
165
  var optimizerRequest = async (path, method, body) => {
144
166
  const controlPath = path === "/v1/optimize" ? "/v1/optimization/execute" : path;
145
167
  const url = new URL(`${baseUrl}${controlPath}`);
146
168
  if (method === "GET") for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
147
169
  return (await viraHttpRequest(url, { method, apiKey, body: body ? { ...body, scope } : void 0, idempotencyKey: method === "POST" ? `mcp:optimizer:${path}` : void 0 })).body;
148
170
  };
149
- var tools = [
171
+ var fullTools = [
150
172
  { name: "get_scope", description: "Read the immutable organization/project/environment scope configured for this MCP session.", inputSchema: input(), run: async () => ({ scope, apiUrl: baseUrl }) },
151
173
  { name: "list_capabilities", description: "List capabilities available to this API key.", inputSchema: input(), run: () => client.listCapabilities({ surface: "mcp" }) },
152
174
  { name: "list_inbox", description: "List the authenticated actor\u2019s scoped review notifications.", inputSchema: input({ limit: z.number().int().positive().max(100).optional() }), run: async (args) => readFromApi(`/v1/notifications/inbox?limit=${encodeURIComponent(String(args.limit ?? 100))}`) },
@@ -157,7 +179,7 @@ var tools = [
157
179
  { name: "start_optimization", description: "Start provider-backed scoped optimization with dataset and holdout governance through the authenticated Control API.", inputSchema: input({ request: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => optimizerRequest("/v1/optimize", "POST", args.request) },
158
180
  { name: "get_optimization_run", description: "Read a scoped durable optimization run.", inputSchema: input({ runId: z.string().min(1) }), run: (args) => optimizerRequest(`/v1/optimization/runs/${encodeURIComponent(String(args.runId))}`, "GET") },
159
181
  { name: "cancel_optimization_run", description: "Request cancellation of a scoped optimization run.", inputSchema: input({ runId: z.string().min(1) }), effectful: true, run: (args) => optimizerRequest(`/v1/optimization/runs/${encodeURIComponent(String(args.runId))}/cancel`, "POST", {}) },
160
- { name: "connect_once", description: "Create or reuse a scoped AI System connection and return its capability handshake.", inputSchema: input({ name: z.string().min(1), systemType: z.string().min(1), adapterType: z.string().min(1), adapterVersion: z.string().min(1), capabilities: z.array(z.string()).optional(), config: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.connectOnce({ name: String(args.name), systemType: String(args.systemType), organizationId: scope.organizationId, projectId: scope.projectId, environmentId: scope.environmentId, adapterType: String(args.adapterType), adapterVersion: String(args.adapterVersion), capabilities: args.capabilities, config: args.config, idempotencyKey: args.idempotencyKey }) },
182
+ { name: "connect_ai_system", description: "Create or reuse a scoped AI System connection and return its capability handshake.", inputSchema: input({ name: z.string().min(1), systemType: z.string().min(1), adapterType: z.string().min(1), adapterVersion: z.string().min(1), capabilities: z.array(z.string()).optional(), config: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.connectAiSystem({ name: String(args.name), systemType: String(args.systemType), organizationId: scope.organizationId, projectId: scope.projectId, environmentId: scope.environmentId, adapterType: String(args.adapterType), adapterVersion: String(args.adapterVersion), capabilities: args.capabilities, config: args.config, idempotencyKey: args.idempotencyKey }) },
161
183
  { name: "get_job", description: "Read a scope-bound asynchronous job and completion evidence.", inputSchema: input({ jobId: z.string().min(1) }), run: (args) => readFromApi(`/v1/jobs/${encodeURIComponent(String(args.jobId))}`) },
162
184
  { name: "list_semantic_tasks", description: "List Semantic Tasks with bounded cursor pagination.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/semantic-tasks", args) },
163
185
  { name: "list_behavior_points", description: "List BehaviorPoints with bounded cursor pagination.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/behavior-points", args) },
@@ -219,8 +241,8 @@ var tools = [
219
241
  { name: "get_task_run", description: "Read TaskRun state and final result.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.getTaskRun(String(args.taskRunId)) },
220
242
  { name: "list_task_run_events", description: "Read TaskRun lifecycle events and child lineage.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.listTaskRunEvents(String(args.taskRunId)) },
221
243
  { name: "observe", description: "Ingest a scoped observation.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.observe(args.event) },
222
- { name: "feedback", description: "Record scoped user feedback for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.feedback(args.event) },
223
- { name: "outcome", description: "Record a scoped business outcome for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.outcome(args.event) },
244
+ { name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.recordUserFeedback(args.event) },
245
+ { name: "record_business_outcome", description: "Record a scoped business outcome for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.recordBusinessOutcome(args.event) },
224
246
  { name: "search_runtime_traces", description: "Search scoped runtime traces and receipts.", inputSchema: input({ limit: z.number().int().positive().optional(), cursor: z.string().optional(), query: z.string().optional(), event: z.string().optional() }), run: (args) => client.searchRuntimeTraces(args) },
225
247
  { name: "create_signal_discovery_proposal", description: "Create an evidence-backed signal discovery proposal.", inputSchema: input({ proposal: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createSignalDiscoveryProposal(args.proposal) },
226
248
  { name: "review_signal_discovery_proposal", description: "Approve or reject a signal discovery proposal.", inputSchema: input({ proposalId: z.string().min(1), decision: z.enum(["APPROVE", "REJECT"]) }), effectful: true, run: (args) => client.reviewSignalDiscoveryProposal(String(args.proposalId), args.decision) },
@@ -261,6 +283,61 @@ var tools = [
261
283
  { name: "serve_behavior_projection", description: "Serve the active behavior projection for verification.", inputSchema: input({ input: z.string().min(1), provider: z.string().min(1), programId: z.string().optional() }), effectful: true, run: (args) => client.serveBehaviorProjection(args) },
262
284
  { name: "create_release", description: "Create a governed release for an approved immutable artifact.", inputSchema: input({ release: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createRelease(args.release) }
263
285
  ];
286
+ var promotedNames = /* @__PURE__ */ new Set([
287
+ "get_scope",
288
+ "list_capabilities",
289
+ "connect_ai_system",
290
+ "get_job",
291
+ "list_semantic_tasks",
292
+ "list_behavior_points",
293
+ "resolve_semantic",
294
+ "resolve_task_run",
295
+ "start_task_run",
296
+ "get_task_run",
297
+ "list_task_run_events",
298
+ "continue_task_run",
299
+ "cancel_task_run",
300
+ "retry_task_run",
301
+ "resolve_runtime",
302
+ "create_observation",
303
+ "record_user_feedback",
304
+ "record_business_outcome",
305
+ "submit_teach_evidence",
306
+ "get_teach_behavior_set",
307
+ "create_teach_proposal",
308
+ "accept_teach_recommendation",
309
+ "start_evaluation",
310
+ "get_evaluation",
311
+ "get_evaluation_comparison",
312
+ "create_behavior_revision_candidate",
313
+ "evaluate_behavior_revision_candidate",
314
+ "accept_behavior_revision_candidate",
315
+ "create_pack_revision",
316
+ "transition_pack_revision",
317
+ "materialize_pack_revision",
318
+ "diagnose_pack",
319
+ "evaluate_pack",
320
+ "import_pack",
321
+ "install_pack",
322
+ "approve_pack",
323
+ "release_pack",
324
+ "serve_behavior_projection",
325
+ "list_behavior_strategies",
326
+ "get_behavior_strategy",
327
+ "simulate_behavior_strategy",
328
+ "get_strategy_execution_trace",
329
+ "continue_strategy_execution",
330
+ "list_inbox",
331
+ "mark_inbox_read",
332
+ "inspect_conflicts",
333
+ "get_conflict_inspection",
334
+ "resolve_conflict"
335
+ ]);
336
+ var genericTools = [
337
+ { name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: input({ path: z.string().regex(/^\/v1\/[A-Za-z0-9_./{}-]+$/), query: z.record(z.string(), z.unknown()).optional() }), run: readControlApi },
338
+ { name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", inputSchema: input({ path: z.string().regex(/^\/v1\/[A-Za-z0-9_./{}-]+$/), method: z.enum(["POST", "PUT", "PATCH", "DELETE"]).default("POST"), body: z.record(z.string(), z.unknown()), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: writeControlApi }
339
+ ];
340
+ var tools = Object.freeze([...fullTools.filter((tool) => promotedNames.has(tool.name)), ...genericTools]);
264
341
  if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
265
342
  var authorize = async (tool, args) => {
266
343
  if (!tool.effectful) return;
@@ -272,7 +349,7 @@ var authorize = async (tool, args) => {
272
349
  })).body;
273
350
  if (decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
274
351
  };
275
- var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.60" }, { capabilities: { tools: {} } });
352
+ var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.61" }, { capabilities: { tools: {} } });
276
353
  for (const tool of tools) {
277
354
  server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
278
355
  const args = raw;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/mcp",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "mcpName": "io.github.hrpering/vira",
5
5
  "description": "Vira MCP client and npx-ready JSON-RPC launcher.",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/server": "^2.4.0",
41
- "@tryvira/sdk": "^0.1.60",
41
+ "@tryvira/sdk": "^0.1.68",
42
42
  "zod": "^4.2.0"
43
43
  },
44
44
  "scripts": {