@tryvira/mcp 0.1.21 → 0.1.23
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 +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -826,7 +826,7 @@ function resolveViraMcpConfig(environment = process.env) {
|
|
|
826
826
|
if (!apiKey) throw new Error("VIRA_API_KEY_REQUIRED_IN_PRODUCTION");
|
|
827
827
|
const authorityUrl = environment.VIRA_MCP_AUTHORITY_URL;
|
|
828
828
|
return { baseUrl, apiKey, authorityUrl, serverName: environment.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", requestAuthToken: environment.VIRA_MCP_AUTH_TOKEN, ...authorityUrl ? { authorizeEffectful: async (input) => {
|
|
829
|
-
const response = await fetch(`${authorityUrl}`, { method: "POST", headers: { authorization: `Bearer ${apiKey}`, "content-type": "application/json" }, body: JSON.stringify(input) });
|
|
829
|
+
const response = await fetch(`${authorityUrl}`, { method: "POST", headers: { authorization: `Bearer ${apiKey}`, "x-vira-api-key": apiKey, "content-type": "application/json" }, body: JSON.stringify(input) });
|
|
830
830
|
const payload = await response.json().catch(() => null);
|
|
831
831
|
return { allowed: response.ok && payload?.allowed === true, decisionDigest: payload?.decisionDigest ?? "", ...payload?.reason ? { reason: payload.reason } : {} };
|
|
832
832
|
} } : {} };
|
|
@@ -841,7 +841,7 @@ function createViraMcpOptions(config) {
|
|
|
841
841
|
if (!config.baseUrl?.trim() || !config.apiKey?.trim()) throw new Error("VIRA_MCP_CONFIG_REQUIRED");
|
|
842
842
|
const fetcher = config.fetcher ?? fetch;
|
|
843
843
|
const api = async (path, body, requestId, method) => {
|
|
844
|
-
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: method ?? (body ? "POST" : "GET"), headers: { authorization: `Bearer ${config.apiKey}`, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
844
|
+
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: method ?? (body ? "POST" : "GET"), headers: { authorization: `Bearer ${config.apiKey}`, "x-vira-api-key": config.apiKey, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
845
845
|
const payload = await response.json().catch(() => null);
|
|
846
846
|
if (!response.ok) return { error: `VIRA_API_${response.status}`, result: payload };
|
|
847
847
|
return { result: payload };
|