@tryvira/mcp 0.1.47 → 0.1.49
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 +7 -4
- package/dist/cli.js +17 -5
- package/package.json +1 -1
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.48
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
The package is a thin stdio MCP adapter over the public Vira API. It uses the
|
|
@@ -45,15 +45,18 @@ 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.48` exposes API-backed tools including `list_packs`, `import_pack`,
|
|
49
49
|
`install_pack`, `release_pack`, `start_strategy_execution`, `list_host_tools`, and
|
|
50
50
|
`authorize_host_tool`, in addition to `list_capabilities`,
|
|
51
51
|
`list_semantic_tasks`, `list_behavior_points`, `list_behavior_programs`,
|
|
52
52
|
`list_behavior_strategies`, `resolve_semantic`, `resolve_runtime`,
|
|
53
53
|
`create_semantic_task`, `create_behavior_point`, `submit_teach_evidence`, and
|
|
54
54
|
`create_teach_proposal`. Host tools are not hardcoded: a host may provide
|
|
55
|
-
`VIRA_HOST_TOOL_DEFINITIONS` as a JSON catalog
|
|
56
|
-
|
|
55
|
+
`VIRA_HOST_TOOL_DEFINITIONS` as a JSON catalog. Each entry must include an
|
|
56
|
+
`actionDefinition` binding (`stableKey`, `version`, `argumentSchemaDigest`, `hostKey`, and
|
|
57
|
+
`hostActionName`). `authorize_host_tool` matches the requested `toolName` and proposal's
|
|
58
|
+
`tool_key` to that registered binding before requesting server authorization; the callback remains
|
|
59
|
+
in the host. Effectful tools require approval from
|
|
57
60
|
the configured authority endpoint and can be denied by scope, role, release state,
|
|
58
61
|
or policy.
|
|
59
62
|
|
package/dist/cli.js
CHANGED
|
@@ -23,11 +23,21 @@ var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost });
|
|
|
23
23
|
var hostToolDefinitions = (() => {
|
|
24
24
|
try {
|
|
25
25
|
const parsed = JSON.parse(process.env.VIRA_HOST_TOOL_DEFINITIONS ?? "[]");
|
|
26
|
-
|
|
26
|
+
if (!Array.isArray(parsed)) return [];
|
|
27
|
+
return parsed.filter((item) => {
|
|
28
|
+
if (!item || typeof item !== "object" || typeof item.name !== "string") return false;
|
|
29
|
+
const definition = item.actionDefinition;
|
|
30
|
+
return !!definition && typeof definition === "object" && typeof definition.stableKey === "string" && Number.isInteger(definition.version) && typeof definition.argumentSchemaDigest === "string" && typeof definition.hostKey === "string" && typeof definition.hostActionName === "string";
|
|
31
|
+
});
|
|
27
32
|
} catch {
|
|
28
33
|
throw new Error("VIRA_HOST_TOOL_DEFINITIONS_INVALID");
|
|
29
34
|
}
|
|
30
35
|
})();
|
|
36
|
+
var hostToolDefinition = (name) => {
|
|
37
|
+
const definition = hostToolDefinitions.find((item) => item.name === name);
|
|
38
|
+
if (!definition?.actionDefinition) throw new Error("MCP_HOST_ACTION_DEFINITION_REQUIRED");
|
|
39
|
+
return definition;
|
|
40
|
+
};
|
|
31
41
|
var authorityUrl = process.env.VIRA_MCP_AUTHORITY_URL ?? `${baseUrl}/v1/mcp/authorize`;
|
|
32
42
|
var validateAuthorityUrl = (value) => {
|
|
33
43
|
let url;
|
|
@@ -91,9 +101,11 @@ var tools = [
|
|
|
91
101
|
{ 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
102
|
{ 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
103
|
{ 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;
|
|
104
|
+
{ name: "list_host_tools", description: "List host tools registered dynamically by the host with their ActionDefinition bindings; this MCP server defines no domain tools.", inputSchema: input(), run: async () => ({ tools: hostToolDefinitions }) },
|
|
105
|
+
{ 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), 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) => {
|
|
106
|
+
const { toolName, executionId, sessionId, context, proposal, approval, idempotencyKey } = args;
|
|
107
|
+
const registered = hostToolDefinition(String(toolName));
|
|
108
|
+
if (String(proposal.tool_key ?? "") !== registered.name) throw new Error("MCP_HOST_TOOL_DEFINITION_MISMATCH");
|
|
97
109
|
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), scope, context, proposal, approval }, { idempotencyKey });
|
|
98
110
|
} }
|
|
99
111
|
];
|
|
@@ -107,7 +119,7 @@ var authorize = async (tool, args) => {
|
|
|
107
119
|
const decision = await response.json().catch(() => null);
|
|
108
120
|
if (!response.ok || decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
|
|
109
121
|
};
|
|
110
|
-
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.
|
|
122
|
+
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.48" }, { capabilities: { tools: {} } });
|
|
111
123
|
for (const tool of tools) {
|
|
112
124
|
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
|
|
113
125
|
const args = raw;
|