@tryvira/mcp 0.1.46 → 0.1.48
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 +12 -6
- package/dist/cli.js +31 -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.48
|
|
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,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
|
+
`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. 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
|
|
54
60
|
the configured authority endpoint and can be denied by scope, role, release state,
|
|
55
61
|
or policy.
|
|
56
62
|
|
package/dist/cli.js
CHANGED
|
@@ -20,6 +20,24 @@ 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
|
+
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
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
throw new Error("VIRA_HOST_TOOL_DEFINITIONS_INVALID");
|
|
34
|
+
}
|
|
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
|
+
};
|
|
23
41
|
var authorityUrl = process.env.VIRA_MCP_AUTHORITY_URL ?? `${baseUrl}/v1/mcp/authorize`;
|
|
24
42
|
var validateAuthorityUrl = (value) => {
|
|
25
43
|
let url;
|
|
@@ -77,6 +95,18 @@ var tools = [
|
|
|
77
95
|
{ 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) => {
|
|
78
96
|
const { idempotencyKey, ...proposal } = args;
|
|
79
97
|
return client.createTeachProposal(proposal, { idempotencyKey });
|
|
98
|
+
} },
|
|
99
|
+
{ name: "list_packs", description: "List Behavior Packs in the API key scope.", inputSchema: input(), run: () => client.listPacks() },
|
|
100
|
+
{ 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) },
|
|
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 ?? {}) },
|
|
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)) },
|
|
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) },
|
|
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");
|
|
109
|
+
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), scope, context, proposal, approval }, { idempotencyKey });
|
|
80
110
|
} }
|
|
81
111
|
];
|
|
82
112
|
var authorize = async (tool, args) => {
|
|
@@ -89,7 +119,7 @@ var authorize = async (tool, args) => {
|
|
|
89
119
|
const decision = await response.json().catch(() => null);
|
|
90
120
|
if (!response.ok || decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
|
|
91
121
|
};
|
|
92
|
-
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: {} } });
|
|
93
123
|
for (const tool of tools) {
|
|
94
124
|
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
|
|
95
125
|
const args = raw;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
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": {
|