@tryvira/mcp 0.1.61 → 0.1.63

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 +77 -2
  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.61
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.61` 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
@@ -35,6 +35,8 @@ add(["review_comparative_finding", "edit_improvement_proposal", "transition_beha
35
35
  add(["create_release"], effectful("release.approve", "human"));
36
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"));
37
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"]));
38
40
  var MCP_TOOL_REGISTRY = Object.freeze(registry);
39
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" });
40
42
  var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
@@ -142,13 +144,31 @@ var readFromApi = async (path) => {
142
144
  for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
143
145
  return (await viraHttpRequest(url, { method: "GET", apiKey })).body;
144
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
+ };
145
165
  var optimizerRequest = async (path, method, body) => {
146
166
  const controlPath = path === "/v1/optimize" ? "/v1/optimization/execute" : path;
147
167
  const url = new URL(`${baseUrl}${controlPath}`);
148
168
  if (method === "GET") for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
149
169
  return (await viraHttpRequest(url, { method, apiKey, body: body ? { ...body, scope } : void 0, idempotencyKey: method === "POST" ? `mcp:optimizer:${path}` : void 0 })).body;
150
170
  };
151
- var tools = [
171
+ var fullTools = [
152
172
  { name: "get_scope", description: "Read the immutable organization/project/environment scope configured for this MCP session.", inputSchema: input(), run: async () => ({ scope, apiUrl: baseUrl }) },
153
173
  { name: "list_capabilities", description: "List capabilities available to this API key.", inputSchema: input(), run: () => client.listCapabilities({ surface: "mcp" }) },
154
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))}`) },
@@ -263,6 +283,61 @@ var tools = [
263
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) },
264
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) }
265
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]);
266
341
  if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
267
342
  var authorize = async (tool, args) => {
268
343
  if (!tool.effectful) return;
@@ -274,7 +349,7 @@ var authorize = async (tool, args) => {
274
349
  })).body;
275
350
  if (decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
276
351
  };
277
- 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: {} } });
278
353
  for (const tool of tools) {
279
354
  server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
280
355
  const args = raw;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/mcp",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
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.68",
41
+ "@tryvira/sdk": "^0.1.69",
42
42
  "zod": "^4.2.0"
43
43
  },
44
44
  "scripts": {