@tryvira/mcp 0.1.15 → 0.1.17
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 +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1096,11 +1096,13 @@ import { McpServer } from "@modelcontextprotocol/server";
|
|
|
1096
1096
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
1097
1097
|
import { z } from "zod";
|
|
1098
1098
|
function serveOfficialViraMcp(options) {
|
|
1099
|
+
let invocationSequence = 0;
|
|
1099
1100
|
return serveStdio(() => {
|
|
1100
1101
|
const server = new McpServer({ name: options.serverName, version: "1.0.0" }, { capabilities: { tools: {}, resources: options.resources ? {} : void 0, prompts: options.prompts ? {} : void 0 } });
|
|
1101
1102
|
for (const definition of options.tools) {
|
|
1102
1103
|
server.registerTool(definition.name, { description: definition.description, inputSchema: z.record(z.string(), z.unknown()) }, async (argumentsValue) => {
|
|
1103
|
-
const
|
|
1104
|
+
const sequence = ++invocationSequence;
|
|
1105
|
+
const invocation = { ...options.invocation, id: `${options.invocation.id}:${sequence}`, receiptId: `${options.invocation.receiptId}:${sequence}`, idempotencyKey: `${options.invocation.idempotencyKey}:${sequence}`, server: options.serverName, tool: definition.name, arguments: argumentsValue };
|
|
1104
1106
|
const authority = definition.effectful ? await options.authorize?.({ invocation, definition }) ?? { allowed: false, decisionDigest: "", reason: "MCP_AUTHORITY_REQUIRED" } : { allowed: true, decisionDigest: "read-only" };
|
|
1105
1107
|
if (!authority.allowed) return { isError: true, content: [{ type: "text", text: authority.reason ?? "MCP_AUTHORITY_DENIED" }] };
|
|
1106
1108
|
const result = options.invocationExecutor ? await options.invocationExecutor({ invocation, authority }) : await invokeMcpTool({ invocation, authority, transport: options.transport });
|