@tryvira/mcp 0.1.52 → 0.1.54
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 +84 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,35 @@ 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_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(["list_host_tools"], read("integration.read"));
|
|
18
|
+
add(["test_connection"], effectful("integration.write", "server", ["studio.write", "admin"]));
|
|
19
|
+
add(["resolve_semantic", "resolve_task_run", "simulate_behavior_strategy"], read("runtime.execute"));
|
|
20
|
+
add(["observe"], effectful("observation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
21
|
+
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"));
|
|
22
|
+
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"]));
|
|
23
|
+
add(["create_behavior_program", "delete_behavior_program", "delete_behavior_program_cascade", "validate_behavior_strategy", "activate_behavior_strategy", "create_behavior_strategy", "create_behavior_strategy_variant"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
24
|
+
add(["submit_teach_evidence", "create_teach_proposal", "transition_teach_proposal", "accept_teach_recommendation"], effectful("teach.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
25
|
+
add(["create_teach_analysis", "reject_teach_recommendation", "edit_teach_recommendation", "request_teach_proposal_changes"], effectful("teach.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
26
|
+
registry.get_teach_behavior_set = read("teach.write");
|
|
27
|
+
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"]));
|
|
28
|
+
add(["review_comparative_finding", "edit_improvement_proposal", "transition_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
29
|
+
add(["create_release"], effectful("release.approve", "human"));
|
|
30
|
+
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"));
|
|
31
|
+
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"]));
|
|
32
|
+
var MCP_TOOL_REGISTRY = Object.freeze(registry);
|
|
33
|
+
var getMcpToolAuthority = (tool) => MCP_TOOL_REGISTRY[tool];
|
|
34
|
+
var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
|
|
35
|
+
|
|
36
|
+
// src/cli.ts
|
|
8
37
|
var required = (key) => {
|
|
9
38
|
const value = process.env[key]?.trim();
|
|
10
39
|
if (!value) throw new Error(`${key}_REQUIRED`);
|
|
@@ -109,8 +138,62 @@ var tools = [
|
|
|
109
138
|
const proposalRecord = proposal;
|
|
110
139
|
if (String(proposalRecord.tool_key ?? "") !== registered.name) throw new Error("MCP_HOST_TOOL_DEFINITION_MISMATCH");
|
|
111
140
|
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), dataVersion: String(dataVersion), scope, context: contextRecord, proposal: proposalRecord, ...approval ? { approval } : {} });
|
|
112
|
-
} }
|
|
141
|
+
} },
|
|
142
|
+
{ name: "list_ai_systems", description: "List connected AI systems in scope.", inputSchema: input(), run: () => client.listAISystems() },
|
|
143
|
+
{ name: "get_ai_system", description: "Read one connected AI system.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.getAISystem(String(args.systemId)) },
|
|
144
|
+
{ name: "list_system_connections", description: "List connections for an AI system.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.listSystemConnections(String(args.systemId)) },
|
|
145
|
+
{ name: "get_connection", description: "Read one connection.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.getConnection(String(args.connectionId)) },
|
|
146
|
+
{ name: "connection_health", description: "Check connection health.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.connectionHealth(String(args.connectionId)) },
|
|
147
|
+
{ name: "connection_inventory", description: "Read connection capability inventory.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.inventory(String(args.systemId)) },
|
|
148
|
+
{ name: "test_connection", description: "Run a server-side connection test.", inputSchema: input({ connectionId: z.string().min(1) }), effectful: true, run: (args) => client.testConnection(String(args.connectionId)) },
|
|
149
|
+
{ name: "get_behavior_program", description: "Read one Behavior Program.", inputSchema: input({ programId: z.string().min(1) }), run: (args) => client.getBehaviorProgram(String(args.programId)) },
|
|
150
|
+
{ name: "create_behavior_program", description: "Create a Behavior Program draft.", inputSchema: input({ program: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createBehaviorProgram(args.program) },
|
|
151
|
+
{ name: "delete_behavior_program", description: "Delete an unused Behavior Program.", inputSchema: input({ programId: z.string().min(1), confirm: z.boolean().optional() }), effectful: true, run: (args) => client.deleteBehaviorProgram(String(args.programId), { confirm: args.confirm === true }) },
|
|
152
|
+
{ name: "validate_behavior_strategy", description: "Validate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.validateBehaviorStrategy(String(args.strategyId)) },
|
|
153
|
+
{ name: "activate_behavior_strategy", description: "Activate a validated Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.activateBehaviorStrategy(String(args.strategyId)) },
|
|
154
|
+
{ name: "simulate_behavior_strategy", description: "Simulate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1), initialState: z.record(z.string(), z.unknown()).optional() }), run: (args) => client.simulateBehaviorStrategy(String(args.strategyId), args.initialState ?? {}) },
|
|
155
|
+
{ 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)) },
|
|
156
|
+
{ 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)) },
|
|
157
|
+
{ name: "observe", description: "Ingest a scoped observation.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.observe(args.event) },
|
|
158
|
+
{ 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) },
|
|
159
|
+
{ 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) },
|
|
160
|
+
{ 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) },
|
|
161
|
+
{ name: "materialize_signal_discovery", description: "Materialize an approved signal discovery.", inputSchema: input({ proposalId: z.string().min(1), input: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.materializeSignalDiscovery(String(args.proposalId), args.input ?? {}) },
|
|
162
|
+
{ name: "create_signal_mapping", description: "Create a signal producer mapping.", inputSchema: input({ mapping: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createSignalMapping(args.mapping) },
|
|
163
|
+
{ name: "get_signal_mapping", description: "Read a signal mapping.", inputSchema: input({ mappingId: z.string().min(1) }), run: (args) => client.getSignalMapping(String(args.mappingId)) },
|
|
164
|
+
{ name: "review_signal_mapping", description: "Approve or reject a signal mapping.", inputSchema: input({ mappingId: z.string().min(1), input: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.reviewSignalMapping(String(args.mappingId), args.input ?? {}) },
|
|
165
|
+
{ name: "create_teach_analysis", description: "Start a Teach analysis from admitted evidence.", inputSchema: input({ evidenceIds: z.array(z.string()).min(1), controlPointId: z.string().optional(), summary: z.string().optional() }), effectful: true, run: (args) => client.createTeachAnalysis(args.evidenceIds, { controlPointId: args.controlPointId, summary: args.summary }) },
|
|
166
|
+
{ name: "get_teach_analysis", description: "Read Teach analysis status and result.", inputSchema: input({ analysisId: z.string().min(1) }), run: (args) => client.getTeachAnalysis(String(args.analysisId)) },
|
|
167
|
+
{ name: "get_teach_run_recommendation", description: "Read a Teach recommendation.", inputSchema: input({ teachRunId: z.string().min(1) }), run: (args) => client.getTeachRunRecommendation(String(args.teachRunId)) },
|
|
168
|
+
{ name: "accept_teach_recommendation", description: "Accept a Teach recommendation for evaluation.", inputSchema: input({ teachRunId: z.string().min(1), actorId: z.string().min(1) }), effectful: true, run: (args) => client.acceptTeachRecommendation(String(args.teachRunId), String(args.actorId)) },
|
|
169
|
+
{ name: "reject_teach_recommendation", description: "Reject a Teach recommendation with a reason.", inputSchema: input({ teachRunId: z.string().min(1), reason: z.string().min(1) }), effectful: true, run: (args) => client.rejectTeachRecommendation(String(args.teachRunId), String(args.reason)) },
|
|
170
|
+
{ name: "edit_teach_recommendation", description: "Edit a Teach recommendation as a new immutable revision.", inputSchema: input({ teachRunId: z.string().min(1), revisionId: z.string().min(1), reason: z.string().min(1), behaviorSet: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.editTeachRecommendation(String(args.teachRunId), { revisionId: String(args.revisionId), reason: String(args.reason), behaviorSet: args.behaviorSet }) },
|
|
171
|
+
{ name: "request_teach_proposal_changes", description: "Request changes to a Teach proposal.", inputSchema: input({ proposalId: z.string().min(1), feedback: z.string().min(1) }), effectful: true, run: (args) => client.requestTeachProposalChanges(String(args.proposalId), String(args.feedback)) },
|
|
172
|
+
{ name: "start_evaluation", description: "Start a provider-backed evaluation.", inputSchema: input({ evaluation: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.startEvaluation(args.evaluation) },
|
|
173
|
+
{ name: "get_evaluation", description: "Read evaluation status, receipts and case results.", inputSchema: input({ evaluationId: z.string().min(1) }), run: (args) => client.getEvaluation(String(args.evaluationId)) },
|
|
174
|
+
{ name: "get_evaluation_comparison", description: "Read comparative evaluation arms and findings.", inputSchema: input({ evaluationId: z.string().min(1) }), run: (args) => client.getEvaluationComparison(String(args.evaluationId)) },
|
|
175
|
+
{ name: "review_comparative_finding", description: "Review a comparative finding.", inputSchema: input({ evaluationId: z.string().min(1), findingId: z.string().min(1), decision: z.enum(["ACCEPT", "REJECT", "EDIT", "MORE_EVIDENCE"]), reason: z.string().optional() }), effectful: true, run: (args) => client.reviewComparativeFinding(String(args.evaluationId), String(args.findingId), { decision: args.decision, reason: args.reason }) },
|
|
176
|
+
{ name: "create_evaluation_plan", description: "Create an immutable evaluation plan.", inputSchema: input({ plan: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createEvaluationPlan(args.plan) },
|
|
177
|
+
{ name: "get_evaluation_plan", description: "Read an evaluation plan.", inputSchema: input({ planId: z.string().min(1) }), run: (args) => client.getEvaluationPlan(String(args.planId)) },
|
|
178
|
+
{ name: "seal_evaluation_plan", description: "Seal an evaluation plan.", inputSchema: input({ planId: z.string().min(1) }), effectful: true, run: (args) => client.sealEvaluationPlan(String(args.planId)) },
|
|
179
|
+
{ name: "create_improvement_proposal", description: "Create a Teach improvement proposal from evaluation.", inputSchema: input({ evaluationId: z.string().min(1), proposal: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createImprovementProposal(String(args.evaluationId), args.proposal) },
|
|
180
|
+
{ name: "get_improvement_proposal", description: "Read an improvement proposal.", inputSchema: input({ proposalId: z.string().min(1) }), run: (args) => client.getImprovementProposal(String(args.proposalId)) },
|
|
181
|
+
{ name: "review_improvement_proposal", description: "Approve, reject, or request review for an improvement proposal.", inputSchema: input({ proposalId: z.string().min(1), action: z.enum(["request-review", "approve", "reject"]) }), effectful: true, run: (args) => client.reviewImprovementProposal(String(args.proposalId), args.action) },
|
|
182
|
+
{ name: "create_behavior_revision_candidate", description: "Create an immutable behavior revision candidate.", inputSchema: input({ candidate: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createBehaviorRevisionCandidate(args.candidate) },
|
|
183
|
+
{ name: "evaluate_behavior_revision_candidate", description: "Evaluate a candidate with a real dataset.", inputSchema: input({ candidateId: z.string().min(1), evaluation: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.evaluateBehaviorRevisionCandidate(String(args.candidateId), args.evaluation) },
|
|
184
|
+
{ name: "transition_behavior_revision_candidate", description: "Accept, reject, or promote a candidate revision.", inputSchema: input({ candidateId: z.string().min(1), transition: z.enum(["evaluate", "accept", "reject", "pack"]), input: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.transitionBehaviorRevisionCandidate(String(args.candidateId), args.transition, args.input ?? {}) },
|
|
185
|
+
{ name: "create_pack_revision", description: "Create a Pack Revision from an accepted candidate.", inputSchema: input({ revision: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createPackRevision(args.revision) },
|
|
186
|
+
{ name: "get_pack_revision", description: "Read Pack Revision status and lineage.", inputSchema: input({ revisionId: z.string().min(1) }), run: (args) => client.getPackRevision(String(args.revisionId)) },
|
|
187
|
+
{ name: "get_pack_revision_diff", description: "Read Pack Revision diff.", inputSchema: input({ revisionId: z.string().min(1) }), run: (args) => client.getPackRevisionDiff(String(args.revisionId)) },
|
|
188
|
+
{ name: "transition_pack_revision", description: "Validate, approve, release, or reject a Pack Revision.", inputSchema: input({ revisionId: z.string().min(1), transition: z.enum(["validate", "request-approval", "approve", "release", "reject"]) }), effectful: true, run: (args) => client.transitionPackRevision(String(args.revisionId), args.transition) },
|
|
189
|
+
{ name: "materialize_pack_revision", description: "Materialize an approved Pack Revision.", inputSchema: input({ revisionId: z.string().min(1), input: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.materializePackRevision(String(args.revisionId), args.input) },
|
|
190
|
+
{ name: "diagnose_pack", description: "Diagnose a Pack without changing authority.", inputSchema: input({ packId: z.string().min(1), input: z.record(z.string(), z.unknown()).optional() }), run: (args) => client.diagnosePack(String(args.packId), args.input ?? {}) },
|
|
191
|
+
{ name: "evaluate_pack", description: "Evaluate a Pack using server-owned execution.", inputSchema: input({ packId: z.string().min(1), evaluation: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.evaluatePack(String(args.packId), args.evaluation) },
|
|
192
|
+
{ name: "approve_pack", description: "Approve a passed Pack evaluation.", inputSchema: input({ packId: z.string().min(1), reason: z.string().optional() }), effectful: true, run: (args) => client.approvePack(String(args.packId), { manualApproval: true, reason: args.reason }) },
|
|
193
|
+
{ name: "compile_behavior_capsule", description: "Compile a Behavior Program capsule.", inputSchema: input({ programId: z.string().min(1), input: z.string().min(1), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.unknown()).optional() }), effectful: true, run: (args) => client.compileBehaviorCapsule(args) },
|
|
194
|
+
{ 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) }
|
|
113
195
|
];
|
|
196
|
+
if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
|
|
114
197
|
var authorize = async (tool, args) => {
|
|
115
198
|
if (!tool.effectful) return;
|
|
116
199
|
const response = await fetch(authorityUrl, {
|