@tryvira/mcp 0.1.51 → 0.1.53
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 +29 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,30 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
5
5
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
6
6
|
import { ViraClient } from "@tryvira/sdk";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
// src/tool-registry.ts
|
|
10
|
+
var read = (permissionClass = "integration.read") => ({ permissionClass, requiredRoles: [permissionClass], effectType: "read", scopePolicy: "environment", approvalRequirement: "none" });
|
|
11
|
+
var effectful = (permissionClass, approvalRequirement = "server", aliases = []) => ({ permissionClass, requiredRoles: [permissionClass, ...aliases], effectType: "effectful", scopePolicy: "environment", approvalRequirement });
|
|
12
|
+
var registry = {};
|
|
13
|
+
var add = (names, authority) => names.forEach((name) => {
|
|
14
|
+
registry[name] = authority;
|
|
15
|
+
});
|
|
16
|
+
add(["list_capabilities", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "list_ai_systems", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision_diff", "list_packs", "diagnose_pack"], read());
|
|
17
|
+
add(["list_host_tools"], read("integration.read"));
|
|
18
|
+
add(["resolve_semantic", "resolve_task_run", "simulate_behavior_strategy"], read("runtime.execute"));
|
|
19
|
+
add(["resolve_runtime", "start_task_run", "continue_task_run", "cancel_task_run", "retry_task_run", "start_strategy_execution", "continue_strategy_execution", "cancel_strategy_execution", "compile_behavior_capsule", "serve_behavior_projection", "authorize_host_tool"], effectful("runtime.execute"));
|
|
20
|
+
add(["create_semantic_task", "create_behavior_point", "activate_behavior_strategy", "delete_ai_system", "delete_semantic_task", "delete_behavior_point", "delete_behavior_strategy"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
21
|
+
add(["submit_teach_evidence", "create_teach_proposal", "transition_teach_proposal", "accept_teach_recommendation"], effectful("teach.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
22
|
+
registry.get_teach_behavior_set = read("teach.write");
|
|
23
|
+
add(["start_evaluation", "create_evaluation_plan", "seal_evaluation_plan", "create_improvement_proposal", "review_improvement_proposal", "create_behavior_revision_candidate", "evaluate_behavior_revision_candidate", "accept_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
24
|
+
add(["create_release"], effectful("release.approve", "human"));
|
|
25
|
+
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"));
|
|
26
|
+
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"]));
|
|
27
|
+
var MCP_TOOL_REGISTRY = Object.freeze(registry);
|
|
28
|
+
var getMcpToolAuthority = (tool) => MCP_TOOL_REGISTRY[tool];
|
|
29
|
+
var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
|
|
30
|
+
|
|
31
|
+
// src/cli.ts
|
|
8
32
|
var required = (key) => {
|
|
9
33
|
const value = process.env[key]?.trim();
|
|
10
34
|
if (!value) throw new Error(`${key}_REQUIRED`);
|
|
@@ -105,10 +129,13 @@ var tools = [
|
|
|
105
129
|
{ name: "authorize_host_tool", description: "Request Vira server authorization for one dynamically registered host tool proposal matched to its ActionDefinition.", inputSchema: input({ toolName: z.string().min(1), executionId: z.string().min(1), sessionId: z.string().min(1), dataVersion: z.string().min(1), context: z.record(z.string(), z.unknown()), proposal: z.record(z.string(), z.unknown()), approval: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => {
|
|
106
130
|
const { toolName, executionId, sessionId, dataVersion, context, proposal, approval } = args;
|
|
107
131
|
const registered = hostToolDefinition(String(toolName));
|
|
108
|
-
|
|
109
|
-
|
|
132
|
+
const contextRecord = context;
|
|
133
|
+
const proposalRecord = proposal;
|
|
134
|
+
if (String(proposalRecord.tool_key ?? "") !== registered.name) throw new Error("MCP_HOST_TOOL_DEFINITION_MISMATCH");
|
|
135
|
+
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), dataVersion: String(dataVersion), scope, context: contextRecord, proposal: proposalRecord, ...approval ? { approval } : {} });
|
|
110
136
|
} }
|
|
111
137
|
];
|
|
138
|
+
if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
|
|
112
139
|
var authorize = async (tool, args) => {
|
|
113
140
|
if (!tool.effectful) return;
|
|
114
141
|
const response = await fetch(authorityUrl, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
4
4
|
"description": "Vira MCP client and npx-ready JSON-RPC launcher.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vira",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
40
|
-
"@tryvira/sdk": "^0.1.
|
|
40
|
+
"@tryvira/sdk": "^0.1.60",
|
|
41
41
|
"zod": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|