@tryvira/mcp 0.1.44 → 0.1.47
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/README.md +9 -6
- package/dist/cli.js +28 -2
- package/dist/index.js +1 -1
- 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.
|
|
11
|
+
npx -y @tryvira/mcp@0.1.47
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
The package is a thin stdio MCP adapter over the public Vira API. It uses the
|
|
@@ -34,8 +34,8 @@ For example, an MCP client configuration uses the same names:
|
|
|
34
34
|
{"env":{"VIRA_API_URL":"https://api.example","VIRA_API_KEY":"<customer-api-key>","VIRA_ORGANIZATION_ID":"<org>","VIRA_PROJECT_ID":"<project>","VIRA_ENVIRONMENT_ID":"<environment>"}}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
The launcher uses MCP stdio. It exposes
|
|
38
|
-
|
|
37
|
+
The launcher uses MCP stdio. It exposes separate Vira Control tools for capability, semantic,
|
|
38
|
+
runtime, Pack, Strategy, TaskRun, BehaviorPoint, Behavior Program and Teach operations. The customer API key
|
|
39
39
|
and the three scope identifiers are required at startup. Calls that can change state or
|
|
40
40
|
execute behavior require approval from `VIRA_MCP_AUTHORITY_URL` (defaults to
|
|
41
41
|
`<VIRA_API_URL>/v1/mcp/authorize`).
|
|
@@ -45,12 +45,15 @@ 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.
|
|
48
|
+
Version `0.1.47` exposes API-backed tools including `list_packs`, `import_pack`,
|
|
49
|
+
`install_pack`, `release_pack`, `start_strategy_execution`, `list_host_tools`, and
|
|
50
|
+
`authorize_host_tool`, in addition to `list_capabilities`,
|
|
49
51
|
`list_semantic_tasks`, `list_behavior_points`, `list_behavior_programs`,
|
|
50
52
|
`list_behavior_strategies`, `resolve_semantic`, `resolve_runtime`,
|
|
51
53
|
`create_semantic_task`, `create_behavior_point`, `submit_teach_evidence`, and
|
|
52
|
-
`create_teach_proposal`.
|
|
53
|
-
|
|
54
|
+
`create_teach_proposal`. Host tools are not hardcoded: a host may provide
|
|
55
|
+
`VIRA_HOST_TOOL_DEFINITIONS` as a JSON catalog, and `authorize_host_tool` requests
|
|
56
|
+
server authorization while the callback remains in the host. Effectful tools require approval from
|
|
54
57
|
the configured authority endpoint and can be denied by scope, role, release state,
|
|
55
58
|
or policy.
|
|
56
59
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/cli.ts
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
5
5
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
6
6
|
import { ViraClient } from "@tryvira/sdk";
|
|
@@ -20,6 +20,14 @@ var scope = {
|
|
|
20
20
|
environmentId: required("VIRA_ENVIRONMENT_ID")
|
|
21
21
|
};
|
|
22
22
|
var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost });
|
|
23
|
+
var hostToolDefinitions = (() => {
|
|
24
|
+
try {
|
|
25
|
+
const parsed = JSON.parse(process.env.VIRA_HOST_TOOL_DEFINITIONS ?? "[]");
|
|
26
|
+
return Array.isArray(parsed) ? parsed.filter((item) => item && typeof item === "object" && typeof item.name === "string") : [];
|
|
27
|
+
} catch {
|
|
28
|
+
throw new Error("VIRA_HOST_TOOL_DEFINITIONS_INVALID");
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
23
31
|
var authorityUrl = process.env.VIRA_MCP_AUTHORITY_URL ?? `${baseUrl}/v1/mcp/authorize`;
|
|
24
32
|
var validateAuthorityUrl = (value) => {
|
|
25
33
|
let url;
|
|
@@ -54,6 +62,14 @@ var tools = [
|
|
|
54
62
|
{ name: "list_behavior_strategies", description: "List behavior strategies in the API key scope.", inputSchema: input(), run: () => client.listBehaviorStrategies() },
|
|
55
63
|
{ name: "resolve_semantic", description: "Resolve text using Vira semantic routing.", inputSchema: input({ input: z.string().min(1), profile: z.record(z.string(), z.unknown()).optional(), sessionId: z.string().optional(), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.string()).optional(), timeoutMs: z.number().positive().optional(), requestId: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), run: (args) => client.resolveSemantic(args) },
|
|
56
64
|
{ name: "resolve_runtime", description: "Resolve a BehaviorPoint through the governed runtime.", inputSchema: input({ behaviorPoint: z.string().min(1).optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), semanticContext: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.resolveRuntime(args) },
|
|
65
|
+
{ name: "resolve_task_run", description: "Preview the server-owned TaskRun route; AUTO is the default everyday mode.", inputSchema: input({ input: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), intentCount: z.number().int().positive().optional(), hostCapabilities: z.array(z.string()).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional() }), run: (args) => client.resolveTaskRun(args) },
|
|
66
|
+
{ name: "start_task_run", description: "Admit a registered TaskRun after server-side scope, release and authority checks; omit mode for AUTO.", inputSchema: input({ taskRunId: z.string().min(1), requestId: z.string().min(1), input: z.unknown(), ownerActorRef: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional(), compoundPlanId: z.string().optional(), conversationId: z.string().optional(), episodeId: z.string().optional(), traceRootRef: z.string().optional(), budget: z.object({ maxChildren: z.number().int().positive().optional(), maxCalls: z.number().int().positive().optional(), maxLatencyMs: z.number().int().positive().optional(), maxCostMicros: z.number().int().positive().optional() }).optional(), hostCapabilities: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
67
|
+
const { idempotencyKey, ...request } = args;
|
|
68
|
+
return client.startTaskRun(request, { idempotencyKey });
|
|
69
|
+
} },
|
|
70
|
+
{ name: "continue_task_run", description: "Continue a paused TaskRun with an expected state version.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), cursor: z.string().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.continueTaskRun(String(args.taskRunId), Number(args.expectedVersion), { cursor: args.cursor, idempotencyKey: args.idempotencyKey }) },
|
|
71
|
+
{ name: "cancel_task_run", description: "Cancel a TaskRun using optimistic state-version fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.cancelTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
72
|
+
{ name: "retry_task_run", description: "Retry a failed, blocked, or partial TaskRun using the same immutable plan and authority fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.retryTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
57
73
|
{ name: "create_semantic_task", description: "Create a Semantic Task for review in the API key scope.", inputSchema: input({ id: z.string().optional(), taskKey: z.string().min(1), description: z.string().optional(), version: z.number().int().positive().optional(), aliases: z.array(z.string()).optional(), examples: z.array(z.string()).optional(), negativeExamples: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
58
74
|
const { id, idempotencyKey, ...task } = args;
|
|
59
75
|
return client.createSemanticTask(task, { id, idempotencyKey });
|
|
@@ -69,6 +85,16 @@ var tools = [
|
|
|
69
85
|
{ name: "create_teach_proposal", description: "Create a Teach proposal from admitted evidence.", inputSchema: input({ evidenceId: z.string().min(1), controlPointId: z.string().min(1), summary: z.string().min(1), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
70
86
|
const { idempotencyKey, ...proposal } = args;
|
|
71
87
|
return client.createTeachProposal(proposal, { idempotencyKey });
|
|
88
|
+
} },
|
|
89
|
+
{ name: "list_packs", description: "List Behavior Packs in the API key scope.", inputSchema: input(), run: () => client.listPacks() },
|
|
90
|
+
{ name: "import_pack", description: "Import a Pack draft; release remains separately governed.", inputSchema: input({ manifest: z.unknown(), objects: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.importPack(args) },
|
|
91
|
+
{ name: "install_pack", description: "Install and materialize an approved Pack using direct variables.", inputSchema: input({ packId: z.string().min(1), variables: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.installPack(String(args.packId), args.variables ?? {}) },
|
|
92
|
+
{ name: "release_pack", description: "Release a separately evaluated and approved Pack.", inputSchema: input({ packId: z.string().min(1) }), effectful: true, run: (args) => client.releasePack(String(args.packId)) },
|
|
93
|
+
{ name: "start_strategy_execution", description: "Start a server-authorized immutable Strategy execution.", inputSchema: input({ artifactDigest: z.string().min(1), revisionId: z.string().min(1), idempotencyKey: z.string().min(1), nonce: z.string().min(1), expiresAt: z.number().positive(), decisionPlanId: z.string().min(1), candidates: z.array(z.record(z.string(), z.unknown())), policy: z.string().min(1), behaviorPoint: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.startStrategyExecution(args) },
|
|
94
|
+
{ name: "list_host_tools", description: "List host tools registered dynamically by the host; this MCP server defines no domain tools.", inputSchema: input(), run: async () => ({ tools: hostToolDefinitions }) },
|
|
95
|
+
{ name: "authorize_host_tool", description: "Request Vira server authorization for one dynamically registered host tool proposal.", inputSchema: input({ executionId: z.string().min(1), sessionId: 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(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
96
|
+
const { executionId, sessionId, context, proposal, approval, idempotencyKey } = args;
|
|
97
|
+
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), scope, context, proposal, approval }, { idempotencyKey });
|
|
72
98
|
} }
|
|
73
99
|
];
|
|
74
100
|
var authorize = async (tool, args) => {
|
|
@@ -81,7 +107,7 @@ var authorize = async (tool, args) => {
|
|
|
81
107
|
const decision = await response.json().catch(() => null);
|
|
82
108
|
if (!response.ok || decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
|
|
83
109
|
};
|
|
84
|
-
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.
|
|
110
|
+
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.47" }, { capabilities: { tools: {} } });
|
|
85
111
|
for (const tool of tools) {
|
|
86
112
|
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
|
|
87
113
|
const args = raw;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
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.51",
|
|
41
41
|
"zod": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|