@tryvira/mcp 0.1.43 → 0.1.44
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 +3 -2
- package/dist/cli.js +46 -15
- 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.44
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
The package is a thin stdio MCP adapter over the public Vira API. It uses the
|
|
@@ -21,6 +21,7 @@ client's `env` configuration:
|
|
|
21
21
|
|
|
22
22
|
```dotenv
|
|
23
23
|
VIRA_API_URL=http://127.0.0.1:4185
|
|
24
|
+
VIRA_ALLOW_INSECURE_LOCALHOST=true
|
|
24
25
|
VIRA_API_KEY=vira_dev_local.local-development-only-32chars
|
|
25
26
|
VIRA_ORGANIZATION_ID=local-org
|
|
26
27
|
VIRA_PROJECT_ID=local-project
|
|
@@ -44,7 +45,7 @@ policy, evaluation, and release eligibility. The server does not bypass those ch
|
|
|
44
45
|
|
|
45
46
|
## What a client can discover
|
|
46
47
|
|
|
47
|
-
Version `0.1.
|
|
48
|
+
Version `0.1.44` exposes these API-backed tools: `list_capabilities`,
|
|
48
49
|
`list_semantic_tasks`, `list_behavior_points`, `list_behavior_programs`,
|
|
49
50
|
`list_behavior_strategies`, `resolve_semantic`, `resolve_runtime`,
|
|
50
51
|
`create_semantic_task`, `create_behavior_point`, `submit_teach_evidence`, and
|
package/dist/cli.js
CHANGED
|
@@ -12,15 +12,34 @@ var required = (key) => {
|
|
|
12
12
|
};
|
|
13
13
|
var baseUrl = (process.env.VIRA_API_URL ?? "").replace(/\/$/, "");
|
|
14
14
|
if (!baseUrl) throw new Error("VIRA_API_URL_REQUIRED");
|
|
15
|
+
var allowInsecureLocalhost = process.env.VIRA_ALLOW_INSECURE_LOCALHOST === "true";
|
|
15
16
|
var apiKey = required("VIRA_API_KEY");
|
|
16
17
|
var scope = {
|
|
17
18
|
organizationId: required("VIRA_ORGANIZATION_ID"),
|
|
18
19
|
projectId: required("VIRA_PROJECT_ID"),
|
|
19
20
|
environmentId: required("VIRA_ENVIRONMENT_ID")
|
|
20
21
|
};
|
|
21
|
-
var client = new ViraClient({ baseUrl, apiKey });
|
|
22
|
+
var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost });
|
|
22
23
|
var authorityUrl = process.env.VIRA_MCP_AUTHORITY_URL ?? `${baseUrl}/v1/mcp/authorize`;
|
|
23
|
-
var
|
|
24
|
+
var validateAuthorityUrl = (value) => {
|
|
25
|
+
let url;
|
|
26
|
+
try {
|
|
27
|
+
url = new URL(value);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error("VIRA_MCP_AUTHORITY_URL_INVALID");
|
|
30
|
+
}
|
|
31
|
+
const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname.toLowerCase());
|
|
32
|
+
if (url.username || url.password || url.search || url.hash) throw new Error("VIRA_MCP_AUTHORITY_URL_INVALID");
|
|
33
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && local && allowInsecureLocalhost)) throw new Error("VIRA_MCP_AUTHORITY_HTTPS_REQUIRED");
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
36
|
+
validateAuthorityUrl(authorityUrl);
|
|
37
|
+
var scopeFields = {
|
|
38
|
+
organizationId: z.string().optional(),
|
|
39
|
+
projectId: z.string().optional(),
|
|
40
|
+
environmentId: z.string().optional()
|
|
41
|
+
};
|
|
42
|
+
var input = (shape = {}) => z.object({ ...scopeFields, ...shape }).strict();
|
|
24
43
|
var scopeQuery = (args) => {
|
|
25
44
|
for (const key of Object.keys(scope)) {
|
|
26
45
|
const supplied = args[key];
|
|
@@ -28,17 +47,29 @@ var scopeQuery = (args) => {
|
|
|
28
47
|
}
|
|
29
48
|
};
|
|
30
49
|
var tools = [
|
|
31
|
-
{ name: "list_capabilities", description: "List capabilities available to this API key.", run: () => client.listCapabilities({ surface: "mcp" }) },
|
|
32
|
-
{ name: "list_semantic_tasks", description: "List Semantic Tasks in the API key scope.", run: () => client.listSemanticTasks() },
|
|
33
|
-
{ name: "list_behavior_points", description: "List BehaviorPoints in the API key scope.", run: () => client.listBehaviorPoints() },
|
|
34
|
-
{ name: "list_behavior_programs", description: "List behavior programs in the API key scope.", run: () => client.listBehaviorPrograms() },
|
|
35
|
-
{ name: "list_behavior_strategies", description: "List behavior strategies in the API key scope.", run: () => client.listBehaviorStrategies() },
|
|
36
|
-
{ name: "resolve_semantic", description: "Resolve text using Vira semantic routing.", run: (args) => client.resolveSemantic(args) },
|
|
37
|
-
{ name: "resolve_runtime", description: "Resolve a BehaviorPoint through the governed runtime.", effectful: true, run: (args) => client.resolveRuntime(args) },
|
|
38
|
-
{ name: "create_semantic_task", description: "Create a Semantic Task for review in the API key scope.",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
{ name: "list_capabilities", description: "List capabilities available to this API key.", inputSchema: input(), run: () => client.listCapabilities({ surface: "mcp" }) },
|
|
51
|
+
{ name: "list_semantic_tasks", description: "List Semantic Tasks in the API key scope.", inputSchema: input(), run: () => client.listSemanticTasks() },
|
|
52
|
+
{ name: "list_behavior_points", description: "List BehaviorPoints in the API key scope.", inputSchema: input(), run: () => client.listBehaviorPoints() },
|
|
53
|
+
{ name: "list_behavior_programs", description: "List behavior programs in the API key scope.", inputSchema: input(), run: () => client.listBehaviorPrograms() },
|
|
54
|
+
{ name: "list_behavior_strategies", description: "List behavior strategies in the API key scope.", inputSchema: input(), run: () => client.listBehaviorStrategies() },
|
|
55
|
+
{ 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
|
+
{ 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) },
|
|
57
|
+
{ 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
|
+
const { id, idempotencyKey, ...task } = args;
|
|
59
|
+
return client.createSemanticTask(task, { id, idempotencyKey });
|
|
60
|
+
} },
|
|
61
|
+
{ name: "create_behavior_point", description: "Create a BehaviorPoint in the API key scope.", inputSchema: input({ id: z.string().optional(), key: z.string().min(1), taskId: z.string().optional(), taskIds: z.array(z.string()).optional(), constraints: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
62
|
+
const { id, idempotencyKey, ...point } = args;
|
|
63
|
+
return client.createBehaviorPoint(point, { id, idempotencyKey });
|
|
64
|
+
} },
|
|
65
|
+
{ name: "submit_teach_evidence", description: "Submit consented evidence to the Teach lifecycle.", inputSchema: input({ evidenceId: z.string().optional(), source: z.string().min(1), content: z.string().min(1), consent: z.literal(true), privacy: z.string().optional(), conversationId: z.string().optional(), controlPointId: z.string().optional(), summary: z.string().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
66
|
+
const { idempotencyKey, ...evidence } = args;
|
|
67
|
+
return client.submitTeachEvidence(evidence, { idempotencyKey });
|
|
68
|
+
} },
|
|
69
|
+
{ 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
|
+
const { idempotencyKey, ...proposal } = args;
|
|
71
|
+
return client.createTeachProposal(proposal, { idempotencyKey });
|
|
72
|
+
} }
|
|
42
73
|
];
|
|
43
74
|
var authorize = async (tool, args) => {
|
|
44
75
|
if (!tool.effectful) return;
|
|
@@ -50,9 +81,9 @@ var authorize = async (tool, args) => {
|
|
|
50
81
|
const decision = await response.json().catch(() => null);
|
|
51
82
|
if (!response.ok || decision?.allowed !== true) throw new Error(decision?.reason ?? "MCP_AUTHORITY_DENIED");
|
|
52
83
|
};
|
|
53
|
-
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.
|
|
84
|
+
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", version: "0.1.44" }, { capabilities: { tools: {} } });
|
|
54
85
|
for (const tool of tools) {
|
|
55
|
-
server.registerTool(tool.name, { description: tool.description, inputSchema:
|
|
86
|
+
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, async (raw) => {
|
|
56
87
|
const args = raw;
|
|
57
88
|
scopeQuery(args);
|
|
58
89
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
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.43",
|
|
41
41
|
"zod": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|