@tryvira/mcp 0.1.13 → 0.1.14
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 +35 -35
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var __export = (target, all) => {
|
|
|
14
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// packages/domain/src/scope-composer.ts
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
function canonical(value) {
|
|
20
20
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -30,13 +30,13 @@ function assertComposedScopeIntegrity(composed) {
|
|
|
30
30
|
}
|
|
31
31
|
var digest;
|
|
32
32
|
var init_scope_composer = __esm({
|
|
33
|
-
"
|
|
33
|
+
"packages/domain/src/scope-composer.ts"() {
|
|
34
34
|
"use strict";
|
|
35
35
|
digest = (value) => createHash("sha256").update(canonical(value)).digest("hex");
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// packages/runtime/src/mcp-gateway.ts
|
|
40
40
|
import { createHash as createHash2 } from "node:crypto";
|
|
41
41
|
function canonicalMcpJson(value) {
|
|
42
42
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -143,13 +143,13 @@ async function invokeMcpTool(input) {
|
|
|
143
143
|
return Object.freeze({ ...body, provenanceDigest: createHash2("sha256").update(canonicalMcpJson(body)).digest("hex") });
|
|
144
144
|
}
|
|
145
145
|
var init_mcp_gateway = __esm({
|
|
146
|
-
"
|
|
146
|
+
"packages/runtime/src/mcp-gateway.ts"() {
|
|
147
147
|
"use strict";
|
|
148
148
|
init_scope_composer();
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
//
|
|
152
|
+
// packages/runtime/src/mcp-provenance.ts
|
|
153
153
|
import { createHash as createHash3 } from "node:crypto";
|
|
154
154
|
function verifyMcpResult2(result) {
|
|
155
155
|
const { provenanceDigest: stored, ...body } = result;
|
|
@@ -163,13 +163,13 @@ function createMcpResultFromResponse(input) {
|
|
|
163
163
|
return Object.freeze({ ...body, provenanceDigest: createHash3("sha256").update(canonicalMcpJson(body)).digest("hex") });
|
|
164
164
|
}
|
|
165
165
|
var init_mcp_provenance = __esm({
|
|
166
|
-
"
|
|
166
|
+
"packages/runtime/src/mcp-provenance.ts"() {
|
|
167
167
|
"use strict";
|
|
168
168
|
init_mcp_gateway();
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
|
|
172
|
-
//
|
|
172
|
+
// packages/runtime/src/mcp-session.ts
|
|
173
173
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
174
174
|
function assertMcpSession(session) {
|
|
175
175
|
const { sessionDigest, ...base } = session;
|
|
@@ -183,14 +183,14 @@ function assertMcpSessionActive(session) {
|
|
|
183
183
|
}
|
|
184
184
|
var canonical2, digest2;
|
|
185
185
|
var init_mcp_session = __esm({
|
|
186
|
-
"
|
|
186
|
+
"packages/runtime/src/mcp-session.ts"() {
|
|
187
187
|
"use strict";
|
|
188
188
|
canonical2 = (value) => value === null || typeof value !== "object" ? JSON.stringify(value) : Array.isArray(value) ? `[${value.map(canonical2).join(",")}]` : `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
|
|
189
189
|
digest2 = (value) => createHash4("sha256").update(canonical2(value)).digest("hex");
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
//
|
|
193
|
+
// apps/mcp-server/server.ts
|
|
194
194
|
import {
|
|
195
195
|
createServer
|
|
196
196
|
} from "node:http";
|
|
@@ -555,7 +555,7 @@ function readBody(request, limit) {
|
|
|
555
555
|
}
|
|
556
556
|
var requestToken, claimInvocation;
|
|
557
557
|
var init_server = __esm({
|
|
558
|
-
"
|
|
558
|
+
"apps/mcp-server/server.ts"() {
|
|
559
559
|
"use strict";
|
|
560
560
|
init_mcp_gateway();
|
|
561
561
|
init_mcp_provenance();
|
|
@@ -576,7 +576,7 @@ var init_server = __esm({
|
|
|
576
576
|
}
|
|
577
577
|
});
|
|
578
578
|
|
|
579
|
-
//
|
|
579
|
+
// packages/runtime/src/mcp-invocation-service.ts
|
|
580
580
|
import { createHash as createHash5 } from "node:crypto";
|
|
581
581
|
function assertReplayIdentity(invocation, authority, result) {
|
|
582
582
|
const argumentsDigest = createHash5("sha256").update(canonicalMcpJson(invocation.arguments)).digest("hex");
|
|
@@ -605,17 +605,17 @@ async function executeMcpInvocation(input) {
|
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
var init_mcp_invocation_service = __esm({
|
|
608
|
-
"
|
|
608
|
+
"packages/runtime/src/mcp-invocation-service.ts"() {
|
|
609
609
|
"use strict";
|
|
610
610
|
init_mcp_gateway();
|
|
611
611
|
init_mcp_gateway();
|
|
612
612
|
}
|
|
613
613
|
});
|
|
614
614
|
|
|
615
|
-
//
|
|
615
|
+
// packages/database/src/mcp-provenance-repository.ts
|
|
616
616
|
var assertClaimInput, McpProvenanceRepository, SqlMcpProvenanceRepository;
|
|
617
617
|
var init_mcp_provenance_repository = __esm({
|
|
618
|
-
"
|
|
618
|
+
"packages/database/src/mcp-provenance-repository.ts"() {
|
|
619
619
|
"use strict";
|
|
620
620
|
init_mcp_provenance();
|
|
621
621
|
init_scope_composer();
|
|
@@ -819,7 +819,7 @@ var init_mcp_provenance_repository = __esm({
|
|
|
819
819
|
}
|
|
820
820
|
});
|
|
821
821
|
|
|
822
|
-
//
|
|
822
|
+
// apps/mcp-server/vira-server.ts
|
|
823
823
|
function resolveViraMcpConfig(environment = process.env) {
|
|
824
824
|
const baseUrl = (environment.VIRA_API_URL ?? "http://127.0.0.1:4185").replace(/\/$/, "");
|
|
825
825
|
const apiKey = environment.VIRA_API_KEY ?? (environment.NODE_ENV === "production" ? "" : "vira_dev_local.local-development-only-32chars");
|
|
@@ -954,7 +954,7 @@ function createViraMcpOptions(config) {
|
|
|
954
954
|
}
|
|
955
955
|
var tools;
|
|
956
956
|
var init_vira_server = __esm({
|
|
957
|
-
"
|
|
957
|
+
"apps/mcp-server/vira-server.ts"() {
|
|
958
958
|
"use strict";
|
|
959
959
|
init_server();
|
|
960
960
|
init_mcp_invocation_service();
|
|
@@ -1009,10 +1009,10 @@ var init_vira_server = __esm({
|
|
|
1009
1009
|
}
|
|
1010
1010
|
});
|
|
1011
1011
|
|
|
1012
|
-
//
|
|
1012
|
+
// packages/database/src/mcp-session-repository.ts
|
|
1013
1013
|
var SqlMcpSessionRepository;
|
|
1014
1014
|
var init_mcp_session_repository = __esm({
|
|
1015
|
-
"
|
|
1015
|
+
"packages/database/src/mcp-session-repository.ts"() {
|
|
1016
1016
|
"use strict";
|
|
1017
1017
|
init_mcp_session();
|
|
1018
1018
|
SqlMcpSessionRepository = class {
|
|
@@ -1051,7 +1051,7 @@ var init_mcp_session_repository = __esm({
|
|
|
1051
1051
|
}
|
|
1052
1052
|
});
|
|
1053
1053
|
|
|
1054
|
-
//
|
|
1054
|
+
// apps/mcp-server/official-stdio.ts
|
|
1055
1055
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
1056
1056
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
1057
1057
|
import { z } from "zod";
|
|
@@ -1071,13 +1071,13 @@ function serveOfficialViraMcp(options) {
|
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
1073
|
var init_official_stdio = __esm({
|
|
1074
|
-
"
|
|
1074
|
+
"apps/mcp-server/official-stdio.ts"() {
|
|
1075
1075
|
"use strict";
|
|
1076
1076
|
init_mcp_gateway();
|
|
1077
1077
|
}
|
|
1078
1078
|
});
|
|
1079
1079
|
|
|
1080
|
-
//
|
|
1080
|
+
// packages/database/src/postgres-adapter.ts
|
|
1081
1081
|
import { Pool } from "pg";
|
|
1082
1082
|
function validateSql(sql) {
|
|
1083
1083
|
if (!sql.trim()) throw new Error("POSTGRES_SQL_REQUIRED");
|
|
@@ -1119,12 +1119,12 @@ function createPostgresPool(input = {}) {
|
|
|
1119
1119
|
return { pool, close: () => pool.end() };
|
|
1120
1120
|
}
|
|
1121
1121
|
var init_postgres_adapter = __esm({
|
|
1122
|
-
"
|
|
1122
|
+
"packages/database/src/postgres-adapter.ts"() {
|
|
1123
1123
|
"use strict";
|
|
1124
1124
|
}
|
|
1125
1125
|
});
|
|
1126
1126
|
|
|
1127
|
-
//
|
|
1127
|
+
// packages/database/src/postgres-migrations.ts
|
|
1128
1128
|
import { createHash as createHash6 } from "node:crypto";
|
|
1129
1129
|
function splitSql(sql) {
|
|
1130
1130
|
const statements = [];
|
|
@@ -1274,12 +1274,12 @@ async function applyPostgresMigrations(client, migrations) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
1276
1276
|
var init_postgres_migrations = __esm({
|
|
1277
|
-
"
|
|
1277
|
+
"packages/database/src/postgres-migrations.ts"() {
|
|
1278
1278
|
"use strict";
|
|
1279
1279
|
}
|
|
1280
1280
|
});
|
|
1281
1281
|
|
|
1282
|
-
//
|
|
1282
|
+
// packages/database/src/postgres-runtime.ts
|
|
1283
1283
|
import { readFile, readdir } from "node:fs/promises";
|
|
1284
1284
|
import { dirname, resolve } from "node:path";
|
|
1285
1285
|
import { fileURLToPath } from "node:url";
|
|
@@ -1311,7 +1311,7 @@ async function openPostgresRuntime(options = {}) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
var here;
|
|
1313
1313
|
var init_postgres_runtime = __esm({
|
|
1314
|
-
"
|
|
1314
|
+
"packages/database/src/postgres-runtime.ts"() {
|
|
1315
1315
|
"use strict";
|
|
1316
1316
|
init_postgres_adapter();
|
|
1317
1317
|
init_postgres_migrations();
|
|
@@ -1319,7 +1319,7 @@ var init_postgres_runtime = __esm({
|
|
|
1319
1319
|
}
|
|
1320
1320
|
});
|
|
1321
1321
|
|
|
1322
|
-
//
|
|
1322
|
+
// packages/database/src/production-sqlite.ts
|
|
1323
1323
|
import { access, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
1324
1324
|
import { existsSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
1325
1325
|
import { dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
@@ -1823,7 +1823,7 @@ async function openProductionSqlite({ databaseUrl = process.env.DATABASE_URL } =
|
|
|
1823
1823
|
}
|
|
1824
1824
|
var root, require2, migrationCandidates;
|
|
1825
1825
|
var init_production_sqlite = __esm({
|
|
1826
|
-
"
|
|
1826
|
+
"packages/database/src/production-sqlite.ts"() {
|
|
1827
1827
|
"use strict";
|
|
1828
1828
|
root = dirname2(fileURLToPath2(import.meta.url));
|
|
1829
1829
|
require2 = createRequire(import.meta.url);
|
|
@@ -1834,7 +1834,7 @@ var init_production_sqlite = __esm({
|
|
|
1834
1834
|
}
|
|
1835
1835
|
});
|
|
1836
1836
|
|
|
1837
|
-
//
|
|
1837
|
+
// packages/database/src/runtime-database.ts
|
|
1838
1838
|
var runtime_database_exports = {};
|
|
1839
1839
|
__export(runtime_database_exports, {
|
|
1840
1840
|
createProductionDatabase: () => createProductionDatabase,
|
|
@@ -1874,14 +1874,14 @@ async function openRuntimeDatabase(options = {}) {
|
|
|
1874
1874
|
throw new Error("DATABASE_URL_UNSUPPORTED");
|
|
1875
1875
|
}
|
|
1876
1876
|
var init_runtime_database = __esm({
|
|
1877
|
-
"
|
|
1877
|
+
"packages/database/src/runtime-database.ts"() {
|
|
1878
1878
|
"use strict";
|
|
1879
1879
|
init_postgres_runtime();
|
|
1880
1880
|
init_production_sqlite();
|
|
1881
1881
|
}
|
|
1882
1882
|
});
|
|
1883
1883
|
|
|
1884
|
-
//
|
|
1884
|
+
// packages/database/src/postgres-mcp-repository.ts
|
|
1885
1885
|
var postgres_mcp_repository_exports = {};
|
|
1886
1886
|
__export(postgres_mcp_repository_exports, {
|
|
1887
1887
|
PostgresMcpProvenanceRepository: () => PostgresMcpProvenanceRepository,
|
|
@@ -1889,7 +1889,7 @@ __export(postgres_mcp_repository_exports, {
|
|
|
1889
1889
|
});
|
|
1890
1890
|
var provenanceSelect, PostgresMcpProvenanceRepository, PostgresMcpSessionRepository;
|
|
1891
1891
|
var init_postgres_mcp_repository = __esm({
|
|
1892
|
-
"
|
|
1892
|
+
"packages/database/src/postgres-mcp-repository.ts"() {
|
|
1893
1893
|
"use strict";
|
|
1894
1894
|
init_mcp_provenance();
|
|
1895
1895
|
init_mcp_session();
|
|
@@ -1965,7 +1965,7 @@ var init_postgres_mcp_repository = __esm({
|
|
|
1965
1965
|
}
|
|
1966
1966
|
});
|
|
1967
1967
|
|
|
1968
|
-
//
|
|
1968
|
+
// apps/mcp-server/start.ts
|
|
1969
1969
|
var start_exports = {};
|
|
1970
1970
|
__export(start_exports, {
|
|
1971
1971
|
startMcpStdio: () => startMcpStdio
|
|
@@ -2011,7 +2011,7 @@ async function startMcpStdio() {
|
|
|
2011
2011
|
process.once("SIGINT", close);
|
|
2012
2012
|
}
|
|
2013
2013
|
var init_start = __esm({
|
|
2014
|
-
"
|
|
2014
|
+
"apps/mcp-server/start.ts"() {
|
|
2015
2015
|
"use strict";
|
|
2016
2016
|
init_server();
|
|
2017
2017
|
init_vira_server();
|
|
@@ -2023,7 +2023,7 @@ var init_start = __esm({
|
|
|
2023
2023
|
}
|
|
2024
2024
|
});
|
|
2025
2025
|
|
|
2026
|
-
// src/cli.ts
|
|
2026
|
+
// packages/mcp/src/cli.ts
|
|
2027
2027
|
init_vira_server();
|
|
2028
2028
|
if (process.argv.includes("--http") || process.env.VIRA_MCP_TRANSPORT === "http") {
|
|
2029
2029
|
await startHttp();
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// packages/runtime/src/mcp-gateway.ts
|
|
2
2
|
import { createHash as createHash2 } from "node:crypto";
|
|
3
3
|
import { isIP } from "node:net";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// packages/domain/src/scope-composer.ts
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
function canonical(value) {
|
|
8
8
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -18,7 +18,7 @@ function assertComposedScopeIntegrity(composed) {
|
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// packages/runtime/src/mcp-gateway.ts
|
|
22
22
|
var MCP_PROTOCOL_VERSIONS = ["2026-07-28", "2025-11-25", "2025-03-26"];
|
|
23
23
|
function negotiateMcpProtocolVersion(offered) {
|
|
24
24
|
const value = String(offered ?? "");
|