@kozou/mcp 0.1.0 → 0.1.1
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 +39 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/describe_table.d.ts +11 -155
- package/dist/schemas/describe_table.d.ts.map +1 -1
- package/dist/schemas/describe_view.d.ts +6 -84
- package/dist/schemas/describe_view.d.ts.map +1 -1
- package/dist/schemas/get_concept_context.d.ts +6 -56
- package/dist/schemas/get_concept_context.d.ts.map +1 -1
- package/dist/schemas/list_concepts.d.ts +3 -27
- package/dist/schemas/list_concepts.d.ts.map +1 -1
- package/dist/schemas/list_concepts.js +5 -1
- package/dist/schemas/list_concepts.js.map +1 -1
- package/dist/schemas/list_tables.d.ts +3 -33
- package/dist/schemas/list_tables.d.ts.map +1 -1
- package/dist/schemas/list_views.d.ts +3 -27
- package/dist/schemas/list_views.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +10 -1
- package/dist/server.js.map +1 -1
- package/dist/startHttpServer.d.ts +30 -0
- package/dist/startHttpServer.d.ts.map +1 -0
- package/dist/startHttpServer.js +176 -0
- package/dist/startHttpServer.js.map +1 -0
- package/dist/tools/get_concept_context.d.ts.map +1 -1
- package/dist/tools/get_concept_context.js +5 -1
- package/dist/tools/get_concept_context.js.map +1 -1
- package/dist/tools/list_concepts.d.ts +2 -2
- package/dist/tools/list_concepts.d.ts.map +1 -1
- package/dist/tools/list_concepts.js.map +1 -1
- package/dist/tools/list_tables.d.ts.map +1 -1
- package/dist/tools/list_tables.js +4 -1
- package/dist/tools/list_tables.js.map +1 -1
- package/package.json +7 -6
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { SchemaCache } from './schemaCache.js';
|
|
3
3
|
import { startStdioServer } from './startStdioServer.js';
|
|
4
|
+
import { startHttpServer } from './startHttpServer.js';
|
|
4
5
|
function parseEnvNumber(value, fallback) {
|
|
5
6
|
if (value === undefined)
|
|
6
7
|
return fallback;
|
|
@@ -11,6 +12,35 @@ function parseEnvNumber(value, fallback) {
|
|
|
11
12
|
}
|
|
12
13
|
return n;
|
|
13
14
|
}
|
|
15
|
+
function parseArgs(argv) {
|
|
16
|
+
const args = { mode: 'stdio' };
|
|
17
|
+
for (let i = 0; i < argv.length; i++) {
|
|
18
|
+
const arg = argv[i];
|
|
19
|
+
switch (arg) {
|
|
20
|
+
case '--http':
|
|
21
|
+
args.mode = 'http';
|
|
22
|
+
break;
|
|
23
|
+
case '--stdio':
|
|
24
|
+
args.mode = 'stdio';
|
|
25
|
+
break;
|
|
26
|
+
case '--port':
|
|
27
|
+
args.port = Number(argv[++i]);
|
|
28
|
+
break;
|
|
29
|
+
case '--host':
|
|
30
|
+
args.host = argv[++i];
|
|
31
|
+
break;
|
|
32
|
+
default:
|
|
33
|
+
if (arg.startsWith('--port=')) {
|
|
34
|
+
args.port = Number(arg.slice('--port='.length));
|
|
35
|
+
}
|
|
36
|
+
else if (arg.startsWith('--host=')) {
|
|
37
|
+
args.host = arg.slice('--host='.length);
|
|
38
|
+
}
|
|
39
|
+
// Unknown flags are ignored so adopters can pass through extras.
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return args;
|
|
43
|
+
}
|
|
14
44
|
async function main() {
|
|
15
45
|
const connectionString = process.env.KOZOU_DATABASE_URL;
|
|
16
46
|
if (!connectionString) {
|
|
@@ -21,6 +51,15 @@ async function main() {
|
|
|
21
51
|
connection: connectionString,
|
|
22
52
|
ttlMs: parseEnvNumber(process.env.KOZOU_CACHE_TTL_MS, 60_000),
|
|
23
53
|
});
|
|
54
|
+
const args = parseArgs(process.argv.slice(2));
|
|
55
|
+
if (args.mode === 'http') {
|
|
56
|
+
if (args.port !== undefined && (!Number.isFinite(args.port) || args.port < 0)) {
|
|
57
|
+
console.error(`[@kozou/mcp] invalid --port "${args.port}"`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
await startHttpServer(cache, { port: args.port, host: args.host });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
24
63
|
await startStdioServer(cache);
|
|
25
64
|
}
|
|
26
65
|
main().catch((err) => {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,SAAS,cAAc,CAAC,KAAyB,EAAE,QAAgB;IACjE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACzC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,oCAAoC,KAAK,kBAAkB,QAAQ,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAUD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,C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,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC;KAC9D,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;YAC9E,OAAO,CAAC,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,eAAe,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACnE,OAAO;IACT,CAAC;IACD,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createMcpServer } from './server.js';
|
|
2
2
|
export { SchemaCache, type SchemaCacheOptions } from './schemaCache.js';
|
|
3
3
|
export { startStdioServer, type StartStdioServerOptions } from './startStdioServer.js';
|
|
4
|
+
export { startHttpServer, isLoopbackHost, type StartHttpServerOptions, type HttpServerHandle, } from './startHttpServer.js';
|
|
4
5
|
export { listTables } from './tools/list_tables.js';
|
|
5
6
|
export { describeTable } from './tools/describe_table.js';
|
|
6
7
|
export { listViews } from './tools/list_views.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EACL,eAAe,EACf,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { createMcpServer } from './server.js';
|
|
5
5
|
export { SchemaCache } from './schemaCache.js';
|
|
6
6
|
export { startStdioServer } from './startStdioServer.js';
|
|
7
|
+
export { startHttpServer, isLoopbackHost, } from './startHttpServer.js';
|
|
7
8
|
export { listTables } from './tools/list_tables.js';
|
|
8
9
|
export { describeTable } from './tools/describe_table.js';
|
|
9
10
|
export { listViews } from './tools/list_views.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,oEAAoE;AACpE,qCAAqC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAgC,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,oEAAoE;AACpE,qCAAqC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAgC,MAAM,uBAAuB,CAAC;AACvF,OAAO,EACL,eAAe,EACf,cAAc,GAGf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const describeTableInputSchema: z.ZodObject<{
|
|
3
3
|
qualifiedName: z.ZodString;
|
|
4
|
-
},
|
|
5
|
-
qualifiedName: string;
|
|
6
|
-
}, {
|
|
7
|
-
qualifiedName: string;
|
|
8
|
-
}>;
|
|
4
|
+
}, z.core.$strip>;
|
|
9
5
|
declare const columnSchema: z.ZodObject<{
|
|
10
6
|
name: z.ZodString;
|
|
11
7
|
dataType: z.ZodString;
|
|
@@ -13,51 +9,19 @@ declare const columnSchema: z.ZodObject<{
|
|
|
13
9
|
defaultExpr: z.ZodNullable<z.ZodString>;
|
|
14
10
|
description: z.ZodNullable<z.ZodString>;
|
|
15
11
|
aiDescription: z.ZodNullable<z.ZodString>;
|
|
16
|
-
enumValues: z.ZodNullable<z.ZodArray<z.ZodString
|
|
12
|
+
enumValues: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
17
13
|
isForeignKey: z.ZodBoolean;
|
|
18
14
|
references: z.ZodNullable<z.ZodObject<{
|
|
19
15
|
table: z.ZodString;
|
|
20
16
|
column: z.ZodString;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
column: string;
|
|
24
|
-
}, {
|
|
25
|
-
table: string;
|
|
26
|
-
column: string;
|
|
27
|
-
}>>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
description: string | null;
|
|
30
|
-
name: string;
|
|
31
|
-
dataType: string;
|
|
32
|
-
nullable: boolean;
|
|
33
|
-
defaultExpr: string | null;
|
|
34
|
-
aiDescription: string | null;
|
|
35
|
-
enumValues: string[] | null;
|
|
36
|
-
isForeignKey: boolean;
|
|
37
|
-
references: {
|
|
38
|
-
table: string;
|
|
39
|
-
column: string;
|
|
40
|
-
} | null;
|
|
41
|
-
}, {
|
|
42
|
-
description: string | null;
|
|
43
|
-
name: string;
|
|
44
|
-
dataType: string;
|
|
45
|
-
nullable: boolean;
|
|
46
|
-
defaultExpr: string | null;
|
|
47
|
-
aiDescription: string | null;
|
|
48
|
-
enumValues: string[] | null;
|
|
49
|
-
isForeignKey: boolean;
|
|
50
|
-
references: {
|
|
51
|
-
table: string;
|
|
52
|
-
column: string;
|
|
53
|
-
} | null;
|
|
54
|
-
}>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
55
19
|
export declare const describeTableOutputSchema: z.ZodObject<{
|
|
56
20
|
qualifiedName: z.ZodString;
|
|
57
21
|
label: z.ZodString;
|
|
58
22
|
description: z.ZodNullable<z.ZodString>;
|
|
59
23
|
aiDescription: z.ZodNullable<z.ZodString>;
|
|
60
|
-
primaryKey: z.ZodArray<z.ZodString
|
|
24
|
+
primaryKey: z.ZodArray<z.ZodString>;
|
|
61
25
|
columns: z.ZodArray<z.ZodObject<{
|
|
62
26
|
name: z.ZodString;
|
|
63
27
|
dataType: z.ZodString;
|
|
@@ -65,132 +29,24 @@ export declare const describeTableOutputSchema: z.ZodObject<{
|
|
|
65
29
|
defaultExpr: z.ZodNullable<z.ZodString>;
|
|
66
30
|
description: z.ZodNullable<z.ZodString>;
|
|
67
31
|
aiDescription: z.ZodNullable<z.ZodString>;
|
|
68
|
-
enumValues: z.ZodNullable<z.ZodArray<z.ZodString
|
|
32
|
+
enumValues: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
69
33
|
isForeignKey: z.ZodBoolean;
|
|
70
34
|
references: z.ZodNullable<z.ZodObject<{
|
|
71
35
|
table: z.ZodString;
|
|
72
36
|
column: z.ZodString;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
column: string;
|
|
76
|
-
}, {
|
|
77
|
-
table: string;
|
|
78
|
-
column: string;
|
|
79
|
-
}>>;
|
|
80
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
description: string | null;
|
|
82
|
-
name: string;
|
|
83
|
-
dataType: string;
|
|
84
|
-
nullable: boolean;
|
|
85
|
-
defaultExpr: string | null;
|
|
86
|
-
aiDescription: string | null;
|
|
87
|
-
enumValues: string[] | null;
|
|
88
|
-
isForeignKey: boolean;
|
|
89
|
-
references: {
|
|
90
|
-
table: string;
|
|
91
|
-
column: string;
|
|
92
|
-
} | null;
|
|
93
|
-
}, {
|
|
94
|
-
description: string | null;
|
|
95
|
-
name: string;
|
|
96
|
-
dataType: string;
|
|
97
|
-
nullable: boolean;
|
|
98
|
-
defaultExpr: string | null;
|
|
99
|
-
aiDescription: string | null;
|
|
100
|
-
enumValues: string[] | null;
|
|
101
|
-
isForeignKey: boolean;
|
|
102
|
-
references: {
|
|
103
|
-
table: string;
|
|
104
|
-
column: string;
|
|
105
|
-
} | null;
|
|
106
|
-
}>, "many">;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
107
39
|
relations: z.ZodArray<z.ZodObject<{
|
|
108
40
|
field: z.ZodString;
|
|
109
41
|
referencesTable: z.ZodString;
|
|
110
42
|
referencesColumn: z.ZodString;
|
|
111
43
|
meaning: z.ZodNullable<z.ZodString>;
|
|
112
|
-
},
|
|
113
|
-
field: string;
|
|
114
|
-
referencesTable: string;
|
|
115
|
-
referencesColumn: string;
|
|
116
|
-
meaning: string | null;
|
|
117
|
-
}, {
|
|
118
|
-
field: string;
|
|
119
|
-
referencesTable: string;
|
|
120
|
-
referencesColumn: string;
|
|
121
|
-
meaning: string | null;
|
|
122
|
-
}>, "many">;
|
|
44
|
+
}, z.core.$strip>>;
|
|
123
45
|
checkConstraints: z.ZodArray<z.ZodObject<{
|
|
124
46
|
name: z.ZodString;
|
|
125
47
|
expression: z.ZodString;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
expression: string;
|
|
129
|
-
}, {
|
|
130
|
-
name: string;
|
|
131
|
-
expression: string;
|
|
132
|
-
}>, "many">;
|
|
133
|
-
}, "strip", z.ZodTypeAny, {
|
|
134
|
-
qualifiedName: string;
|
|
135
|
-
label: string;
|
|
136
|
-
description: string | null;
|
|
137
|
-
aiDescription: string | null;
|
|
138
|
-
primaryKey: string[];
|
|
139
|
-
columns: {
|
|
140
|
-
description: string | null;
|
|
141
|
-
name: string;
|
|
142
|
-
dataType: string;
|
|
143
|
-
nullable: boolean;
|
|
144
|
-
defaultExpr: string | null;
|
|
145
|
-
aiDescription: string | null;
|
|
146
|
-
enumValues: string[] | null;
|
|
147
|
-
isForeignKey: boolean;
|
|
148
|
-
references: {
|
|
149
|
-
table: string;
|
|
150
|
-
column: string;
|
|
151
|
-
} | null;
|
|
152
|
-
}[];
|
|
153
|
-
relations: {
|
|
154
|
-
field: string;
|
|
155
|
-
referencesTable: string;
|
|
156
|
-
referencesColumn: string;
|
|
157
|
-
meaning: string | null;
|
|
158
|
-
}[];
|
|
159
|
-
checkConstraints: {
|
|
160
|
-
name: string;
|
|
161
|
-
expression: string;
|
|
162
|
-
}[];
|
|
163
|
-
}, {
|
|
164
|
-
qualifiedName: string;
|
|
165
|
-
label: string;
|
|
166
|
-
description: string | null;
|
|
167
|
-
aiDescription: string | null;
|
|
168
|
-
primaryKey: string[];
|
|
169
|
-
columns: {
|
|
170
|
-
description: string | null;
|
|
171
|
-
name: string;
|
|
172
|
-
dataType: string;
|
|
173
|
-
nullable: boolean;
|
|
174
|
-
defaultExpr: string | null;
|
|
175
|
-
aiDescription: string | null;
|
|
176
|
-
enumValues: string[] | null;
|
|
177
|
-
isForeignKey: boolean;
|
|
178
|
-
references: {
|
|
179
|
-
table: string;
|
|
180
|
-
column: string;
|
|
181
|
-
} | null;
|
|
182
|
-
}[];
|
|
183
|
-
relations: {
|
|
184
|
-
field: string;
|
|
185
|
-
referencesTable: string;
|
|
186
|
-
referencesColumn: string;
|
|
187
|
-
meaning: string | null;
|
|
188
|
-
}[];
|
|
189
|
-
checkConstraints: {
|
|
190
|
-
name: string;
|
|
191
|
-
expression: string;
|
|
192
|
-
}[];
|
|
193
|
-
}>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
194
50
|
export type DescribeTableInput = z.infer<typeof describeTableInputSchema>;
|
|
195
51
|
export type DescribeTableOutput = z.infer<typeof describeTableOutputSchema>;
|
|
196
52
|
export type DescribeTableColumn = z.infer<typeof columnSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe_table.d.ts","sourceRoot":"","sources":["../../src/schemas/describe_table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"describe_table.d.ts","sourceRoot":"","sources":["../../src/schemas/describe_table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;iBAEnC,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;;iBAehB,CAAC;AAcH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASpC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const describeViewInputSchema: z.ZodObject<{
|
|
3
3
|
qualifiedName: z.ZodString;
|
|
4
|
-
},
|
|
5
|
-
qualifiedName: string;
|
|
6
|
-
}, {
|
|
7
|
-
qualifiedName: string;
|
|
8
|
-
}>;
|
|
4
|
+
}, z.core.$strip>;
|
|
9
5
|
export declare const describeViewOutputSchema: z.ZodObject<{
|
|
10
6
|
qualifiedName: z.ZodString;
|
|
11
7
|
label: z.ZodString;
|
|
@@ -18,90 +14,16 @@ export declare const describeViewOutputSchema: z.ZodObject<{
|
|
|
18
14
|
defaultExpr: z.ZodNullable<z.ZodString>;
|
|
19
15
|
description: z.ZodNullable<z.ZodString>;
|
|
20
16
|
aiDescription: z.ZodNullable<z.ZodString>;
|
|
21
|
-
enumValues: z.ZodNullable<z.ZodArray<z.ZodString
|
|
17
|
+
enumValues: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
22
18
|
isForeignKey: z.ZodBoolean;
|
|
23
19
|
references: z.ZodNullable<z.ZodObject<{
|
|
24
20
|
table: z.ZodString;
|
|
25
21
|
column: z.ZodString;
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, {
|
|
30
|
-
table: string;
|
|
31
|
-
column: string;
|
|
32
|
-
}>>;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
description: string | null;
|
|
35
|
-
name: string;
|
|
36
|
-
dataType: string;
|
|
37
|
-
nullable: boolean;
|
|
38
|
-
defaultExpr: string | null;
|
|
39
|
-
aiDescription: string | null;
|
|
40
|
-
enumValues: string[] | null;
|
|
41
|
-
isForeignKey: boolean;
|
|
42
|
-
references: {
|
|
43
|
-
table: string;
|
|
44
|
-
column: string;
|
|
45
|
-
} | null;
|
|
46
|
-
}, {
|
|
47
|
-
description: string | null;
|
|
48
|
-
name: string;
|
|
49
|
-
dataType: string;
|
|
50
|
-
nullable: boolean;
|
|
51
|
-
defaultExpr: string | null;
|
|
52
|
-
aiDescription: string | null;
|
|
53
|
-
enumValues: string[] | null;
|
|
54
|
-
isForeignKey: boolean;
|
|
55
|
-
references: {
|
|
56
|
-
table: string;
|
|
57
|
-
column: string;
|
|
58
|
-
} | null;
|
|
59
|
-
}>, "many">;
|
|
60
|
-
underlyingTables: z.ZodArray<z.ZodString, "many">;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
underlyingTables: z.ZodArray<z.ZodString>;
|
|
61
25
|
definition: z.ZodString;
|
|
62
|
-
},
|
|
63
|
-
qualifiedName: string;
|
|
64
|
-
label: string;
|
|
65
|
-
description: string | null;
|
|
66
|
-
aiDescription: string | null;
|
|
67
|
-
columns: {
|
|
68
|
-
description: string | null;
|
|
69
|
-
name: string;
|
|
70
|
-
dataType: string;
|
|
71
|
-
nullable: boolean;
|
|
72
|
-
defaultExpr: string | null;
|
|
73
|
-
aiDescription: string | null;
|
|
74
|
-
enumValues: string[] | null;
|
|
75
|
-
isForeignKey: boolean;
|
|
76
|
-
references: {
|
|
77
|
-
table: string;
|
|
78
|
-
column: string;
|
|
79
|
-
} | null;
|
|
80
|
-
}[];
|
|
81
|
-
underlyingTables: string[];
|
|
82
|
-
definition: string;
|
|
83
|
-
}, {
|
|
84
|
-
qualifiedName: string;
|
|
85
|
-
label: string;
|
|
86
|
-
description: string | null;
|
|
87
|
-
aiDescription: string | null;
|
|
88
|
-
columns: {
|
|
89
|
-
description: string | null;
|
|
90
|
-
name: string;
|
|
91
|
-
dataType: string;
|
|
92
|
-
nullable: boolean;
|
|
93
|
-
defaultExpr: string | null;
|
|
94
|
-
aiDescription: string | null;
|
|
95
|
-
enumValues: string[] | null;
|
|
96
|
-
isForeignKey: boolean;
|
|
97
|
-
references: {
|
|
98
|
-
table: string;
|
|
99
|
-
column: string;
|
|
100
|
-
} | null;
|
|
101
|
-
}[];
|
|
102
|
-
underlyingTables: string[];
|
|
103
|
-
definition: string;
|
|
104
|
-
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
105
27
|
export type DescribeViewInput = z.infer<typeof describeViewInputSchema>;
|
|
106
28
|
export type DescribeViewOutput = z.infer<typeof describeViewOutputSchema>;
|
|
107
29
|
//# sourceMappingURL=describe_view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe_view.d.ts","sourceRoot":"","sources":["../../src/schemas/describe_view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"describe_view.d.ts","sourceRoot":"","sources":["../../src/schemas/describe_view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAmBH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,74 +1,24 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const getConceptContextInputSchema: z.ZodObject<{
|
|
3
3
|
name: z.ZodString;
|
|
4
|
-
},
|
|
5
|
-
name: string;
|
|
6
|
-
}, {
|
|
7
|
-
name: string;
|
|
8
|
-
}>;
|
|
4
|
+
}, z.core.$strip>;
|
|
9
5
|
export declare const getConceptContextOutputSchema: z.ZodObject<{
|
|
10
6
|
name: z.ZodString;
|
|
11
7
|
label: z.ZodString;
|
|
12
8
|
description: z.ZodNullable<z.ZodString>;
|
|
13
|
-
aiNotes: z.ZodArray<z.ZodString
|
|
9
|
+
aiNotes: z.ZodArray<z.ZodString>;
|
|
14
10
|
preferredQuerySource: z.ZodString;
|
|
15
11
|
joinSuggestions: z.ZodArray<z.ZodObject<{
|
|
16
12
|
table: z.ZodString;
|
|
17
13
|
on: z.ZodString;
|
|
18
14
|
purpose: z.ZodString;
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
purpose: string;
|
|
22
|
-
on: string;
|
|
23
|
-
}, {
|
|
24
|
-
table: string;
|
|
25
|
-
purpose: string;
|
|
26
|
-
on: string;
|
|
27
|
-
}>, "many">;
|
|
28
|
-
relatedTables: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
relatedTables: z.ZodArray<z.ZodString>;
|
|
29
17
|
exampleQueries: z.ZodArray<z.ZodObject<{
|
|
30
18
|
description: z.ZodString;
|
|
31
19
|
sql: z.ZodString;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
sql: string;
|
|
35
|
-
}, {
|
|
36
|
-
description: string;
|
|
37
|
-
sql: string;
|
|
38
|
-
}>, "many">;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
label: string;
|
|
41
|
-
description: string | null;
|
|
42
|
-
name: string;
|
|
43
|
-
aiNotes: string[];
|
|
44
|
-
preferredQuerySource: string;
|
|
45
|
-
joinSuggestions: {
|
|
46
|
-
table: string;
|
|
47
|
-
purpose: string;
|
|
48
|
-
on: string;
|
|
49
|
-
}[];
|
|
50
|
-
relatedTables: string[];
|
|
51
|
-
exampleQueries: {
|
|
52
|
-
description: string;
|
|
53
|
-
sql: string;
|
|
54
|
-
}[];
|
|
55
|
-
}, {
|
|
56
|
-
label: string;
|
|
57
|
-
description: string | null;
|
|
58
|
-
name: string;
|
|
59
|
-
aiNotes: string[];
|
|
60
|
-
preferredQuerySource: string;
|
|
61
|
-
joinSuggestions: {
|
|
62
|
-
table: string;
|
|
63
|
-
purpose: string;
|
|
64
|
-
on: string;
|
|
65
|
-
}[];
|
|
66
|
-
relatedTables: string[];
|
|
67
|
-
exampleQueries: {
|
|
68
|
-
description: string;
|
|
69
|
-
sql: string;
|
|
70
|
-
}[];
|
|
71
|
-
}>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
72
22
|
export type GetConceptContextInput = z.infer<typeof getConceptContextInputSchema>;
|
|
73
23
|
export type GetConceptContextOutput = z.infer<typeof getConceptContextOutputSchema>;
|
|
74
24
|
//# sourceMappingURL=get_concept_context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_concept_context.d.ts","sourceRoot":"","sources":["../../src/schemas/get_concept_context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"get_concept_context.d.ts","sourceRoot":"","sources":["../../src/schemas/get_concept_context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AAaH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;iBASxC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -1,37 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const listConceptsInputSchema: z.ZodObject<{},
|
|
2
|
+
export declare const listConceptsInputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
3
3
|
export declare const listConceptsOutputSchema: z.ZodObject<{
|
|
4
4
|
concepts: z.ZodArray<z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
label: z.ZodString;
|
|
7
7
|
description: z.ZodNullable<z.ZodString>;
|
|
8
8
|
kind: z.ZodLiteral<"VIEW">;
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
description: string | null;
|
|
12
|
-
name: string;
|
|
13
|
-
kind: "VIEW";
|
|
14
|
-
}, {
|
|
15
|
-
label: string;
|
|
16
|
-
description: string | null;
|
|
17
|
-
name: string;
|
|
18
|
-
kind: "VIEW";
|
|
19
|
-
}>, "many">;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
concepts: {
|
|
22
|
-
label: string;
|
|
23
|
-
description: string | null;
|
|
24
|
-
name: string;
|
|
25
|
-
kind: "VIEW";
|
|
26
|
-
}[];
|
|
27
|
-
}, {
|
|
28
|
-
concepts: {
|
|
29
|
-
label: string;
|
|
30
|
-
description: string | null;
|
|
31
|
-
name: string;
|
|
32
|
-
kind: "VIEW";
|
|
33
|
-
}[];
|
|
34
|
-
}>;
|
|
9
|
+
}, z.core.$strip>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
35
11
|
export type ListConceptsInput = z.infer<typeof listConceptsInputSchema>;
|
|
36
12
|
export type ListConceptsOutput = z.infer<typeof listConceptsOutputSchema>;
|
|
37
13
|
//# sourceMappingURL=list_concepts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_concepts.d.ts","sourceRoot":"","sources":["../../src/schemas/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"list_concepts.d.ts","sourceRoot":"","sources":["../../src/schemas/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,uBAAuB,iCAAqB,CAAC;AAE1D,eAAO,MAAM,wBAAwB;;;;;;;iBASnC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
// No inputs; reject any extra fields. zod 4 infers a strict empty object as
|
|
3
|
+
// `Record<string, never>`, so the tool fn takes the raw `Record<string,
|
|
4
|
+
// unknown>` args and validates them through this schema rather than typing
|
|
5
|
+
// its parameter as the inferred (and unassignable) empty-object type.
|
|
6
|
+
export const listConceptsInputSchema = z.strictObject({});
|
|
3
7
|
export const listConceptsOutputSchema = z.object({
|
|
4
8
|
concepts: z.array(z.object({
|
|
5
9
|
name: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_concepts.js","sourceRoot":"","sources":["../../src/schemas/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"list_concepts.js","sourceRoot":"","sources":["../../src/schemas/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;KACxB,CAAC,CACH;CACF,CAAC,CAAC"}
|
|
@@ -2,45 +2,15 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const listTablesInputSchema: z.ZodObject<{
|
|
3
3
|
schema: z.ZodOptional<z.ZodString>;
|
|
4
4
|
includeSystem: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
-
},
|
|
6
|
-
schema?: string | undefined;
|
|
7
|
-
includeSystem?: boolean | undefined;
|
|
8
|
-
}, {
|
|
9
|
-
schema?: string | undefined;
|
|
10
|
-
includeSystem?: boolean | undefined;
|
|
11
|
-
}>;
|
|
5
|
+
}, z.core.$strip>;
|
|
12
6
|
export declare const listTablesOutputSchema: z.ZodObject<{
|
|
13
7
|
tables: z.ZodArray<z.ZodObject<{
|
|
14
8
|
qualifiedName: z.ZodString;
|
|
15
9
|
label: z.ZodString;
|
|
16
10
|
description: z.ZodNullable<z.ZodString>;
|
|
17
11
|
rowCountEstimate: z.ZodNullable<z.ZodNumber>;
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
label: string;
|
|
21
|
-
description: string | null;
|
|
22
|
-
rowCountEstimate: number | null;
|
|
23
|
-
}, {
|
|
24
|
-
qualifiedName: string;
|
|
25
|
-
label: string;
|
|
26
|
-
description: string | null;
|
|
27
|
-
rowCountEstimate: number | null;
|
|
28
|
-
}>, "many">;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
tables: {
|
|
31
|
-
qualifiedName: string;
|
|
32
|
-
label: string;
|
|
33
|
-
description: string | null;
|
|
34
|
-
rowCountEstimate: number | null;
|
|
35
|
-
}[];
|
|
36
|
-
}, {
|
|
37
|
-
tables: {
|
|
38
|
-
qualifiedName: string;
|
|
39
|
-
label: string;
|
|
40
|
-
description: string | null;
|
|
41
|
-
rowCountEstimate: number | null;
|
|
42
|
-
}[];
|
|
43
|
-
}>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
44
14
|
export type ListTablesInput = z.infer<typeof listTablesInputSchema>;
|
|
45
15
|
export type ListTablesOutput = z.infer<typeof listTablesOutputSchema>;
|
|
46
16
|
//# sourceMappingURL=list_tables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_tables.d.ts","sourceRoot":"","sources":["../../src/schemas/list_tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"list_tables.d.ts","sourceRoot":"","sources":["../../src/schemas/list_tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;iBASjC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const listViewsInputSchema: z.ZodObject<{
|
|
3
3
|
schema: z.ZodOptional<z.ZodString>;
|
|
4
|
-
},
|
|
5
|
-
schema?: string | undefined;
|
|
6
|
-
}, {
|
|
7
|
-
schema?: string | undefined;
|
|
8
|
-
}>;
|
|
4
|
+
}, z.core.$strip>;
|
|
9
5
|
export declare const listViewsOutputSchema: z.ZodObject<{
|
|
10
6
|
views: z.ZodArray<z.ZodObject<{
|
|
11
7
|
qualifiedName: z.ZodString;
|
|
12
8
|
label: z.ZodString;
|
|
13
9
|
purpose: z.ZodNullable<z.ZodString>;
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
label: string;
|
|
17
|
-
purpose: string | null;
|
|
18
|
-
}, {
|
|
19
|
-
qualifiedName: string;
|
|
20
|
-
label: string;
|
|
21
|
-
purpose: string | null;
|
|
22
|
-
}>, "many">;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
views: {
|
|
25
|
-
qualifiedName: string;
|
|
26
|
-
label: string;
|
|
27
|
-
purpose: string | null;
|
|
28
|
-
}[];
|
|
29
|
-
}, {
|
|
30
|
-
views: {
|
|
31
|
-
qualifiedName: string;
|
|
32
|
-
label: string;
|
|
33
|
-
purpose: string | null;
|
|
34
|
-
}[];
|
|
35
|
-
}>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
36
12
|
export type ListViewsInput = z.infer<typeof listViewsInputSchema>;
|
|
37
13
|
export type ListViewsOutput = z.infer<typeof listViewsOutputSchema>;
|
|
38
14
|
//# sourceMappingURL=list_views.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_views.d.ts","sourceRoot":"","sources":["../../src/schemas/list_views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"list_views.d.ts","sourceRoot":"","sources":["../../src/schemas/list_views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;iBAQhC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA+EpD,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAwC1D"}
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
1
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
3
5
|
import { listTables } from './tools/list_tables.js';
|
|
@@ -6,6 +8,13 @@ import { listViews } from './tools/list_views.js';
|
|
|
6
8
|
import { describeView } from './tools/describe_view.js';
|
|
7
9
|
import { listConcepts } from './tools/list_concepts.js';
|
|
8
10
|
import { getConceptContext } from './tools/get_concept_context.js';
|
|
11
|
+
// Read the advertised server version from this package's package.json so
|
|
12
|
+
// it tracks a release bump automatically instead of being hardcoded.
|
|
13
|
+
// `../package.json` resolves to packages/mcp/package.json from the
|
|
14
|
+
// compiled dist/server.js; npm always ships package.json in the tarball.
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const pkg = JSON.parse(readFileSync(require.resolve('../package.json'), 'utf8'));
|
|
17
|
+
const SERVER_VERSION = pkg.version;
|
|
9
18
|
const TOOL_DEFINITIONS = [
|
|
10
19
|
{
|
|
11
20
|
name: 'list_tables',
|
|
@@ -69,7 +78,7 @@ function errorResult(message) {
|
|
|
69
78
|
};
|
|
70
79
|
}
|
|
71
80
|
export function createMcpServer(cache) {
|
|
72
|
-
const server = new Server({ name: 'kozou', version:
|
|
81
|
+
const server = new Server({ name: 'kozou', version: SERVER_VERSION }, { capabilities: { tools: {} } });
|
|
73
82
|
server.setRequestHandler(ListToolsRequestSchema, () => Promise.resolve({ tools: TOOL_DEFINITIONS.map((t) => ({ ...t })) }));
|
|
74
83
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
75
84
|
const name = request.params.name;
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC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b,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC;YAC1C,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC,GAAG,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SchemaCache } from './schemaCache.js';
|
|
2
|
+
export type StartHttpServerOptions = {
|
|
3
|
+
/** TCP port to listen on. Default: 3334 (Kozou v0.1 spec §7.1). */
|
|
4
|
+
port?: number;
|
|
5
|
+
/** Host/interface to bind. Default: 127.0.0.1 (loopback only). */
|
|
6
|
+
host?: string;
|
|
7
|
+
/** Path that serves the MCP Streamable HTTP endpoint. Default: '/mcp'. */
|
|
8
|
+
mcpPath?: string;
|
|
9
|
+
/** Prefix used in stderr log lines. Default: '[@kozou/mcp]'. */
|
|
10
|
+
logPrefix?: string;
|
|
11
|
+
};
|
|
12
|
+
export type HttpServerHandle = {
|
|
13
|
+
/** The actual bound port (resolves an ephemeral `0` to the real port). */
|
|
14
|
+
port: number;
|
|
15
|
+
/** The host the server is bound to. */
|
|
16
|
+
host: string;
|
|
17
|
+
/** Stop accepting connections and resolve once the server has closed. */
|
|
18
|
+
close: () => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Start the MCP server over Streamable HTTP, bound to the given
|
|
23
|
+
* SchemaCache. Resolves once the server is listening.
|
|
24
|
+
*
|
|
25
|
+
* Routes:
|
|
26
|
+
* - `<mcpPath>` (default `/mcp`) — MCP Streamable HTTP endpoint
|
|
27
|
+
* - `POST /admin/refresh` — invalidate the schema cache
|
|
28
|
+
*/
|
|
29
|
+
export declare function startHttpServer(cache: SchemaCache, opts?: StartHttpServerOptions): Promise<HttpServerHandle>;
|
|
30
|
+
//# sourceMappingURL=startHttpServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startHttpServer.d.ts","sourceRoot":"","sources":["../src/startHttpServer.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG;IACnC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AASF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAYD;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,WAAW,EAClB,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,gBAAgB,CAAC,CA6C3B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Convenience helper to start an MCP server with the Streamable HTTP
|
|
2
|
+
// transport (Kozou v0.1 spec §7.1). Mirrors startStdioServer so callers
|
|
3
|
+
// (the bundled kozou CLI and adopters embedding the server) do not need
|
|
4
|
+
// to depend on @modelcontextprotocol/sdk or node:http directly.
|
|
5
|
+
//
|
|
6
|
+
// Design notes:
|
|
7
|
+
// - The server is *stateful*: an MCP client initialises a session, the
|
|
8
|
+
// transport issues an `mcp-session-id`, and subsequent requests reuse
|
|
9
|
+
// the matching transport. This is the transport mode the standard MCP
|
|
10
|
+
// client (Claude Desktop / Claude Code) speaks. Sessions are torn
|
|
11
|
+
// down on transport close so nothing accumulates.
|
|
12
|
+
// - Cache invalidation is exposed over HTTP via `POST /admin/refresh`
|
|
13
|
+
// (Kozou v0.1 spec §7.5), the HTTP-mode counterpart to the stdio
|
|
14
|
+
// server's SIGHUP handler.
|
|
15
|
+
// - v0.1 MCP HTTP ships with **no authentication** (spec §18.5), so the
|
|
16
|
+
// server binds to localhost by default and prints a loud warning when
|
|
17
|
+
// bound to a non-loopback host. The tools only expose schema
|
|
18
|
+
// metadata (no SQL execution, no data access), which bounds the blast
|
|
19
|
+
// radius, but operators must still avoid exposing it on a public
|
|
20
|
+
// interface.
|
|
21
|
+
import { randomUUID } from 'node:crypto';
|
|
22
|
+
import { createServer } from 'node:http';
|
|
23
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
24
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
25
|
+
import { createMcpServer } from './server.js';
|
|
26
|
+
const DEFAULT_PORT = 3334;
|
|
27
|
+
const DEFAULT_HOST = '127.0.0.1';
|
|
28
|
+
const DEFAULT_MCP_PATH = '/mcp';
|
|
29
|
+
const REFRESH_PATH = '/admin/refresh';
|
|
30
|
+
const LOOPBACK_HOSTS = new Set(['127.0.0.1', '::1', 'localhost', '::ffff:127.0.0.1']);
|
|
31
|
+
export function isLoopbackHost(host) {
|
|
32
|
+
return LOOPBACK_HOSTS.has(host);
|
|
33
|
+
}
|
|
34
|
+
function nonLoopbackWarning(host, prefix) {
|
|
35
|
+
return (`${prefix} WARNING: MCP HTTP server bound to non-loopback host "${host}".\n` +
|
|
36
|
+
`${prefix} v0.1 MCP HTTP has NO authentication (spec §18.5). Anyone who can\n` +
|
|
37
|
+
`${prefix} reach ${host} can read this database's schema metadata. Bind to\n` +
|
|
38
|
+
`${prefix} 127.0.0.1 (the default) unless you have a trusted network and an\n` +
|
|
39
|
+
`${prefix} external auth/proxy layer in front.\n`);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Start the MCP server over Streamable HTTP, bound to the given
|
|
43
|
+
* SchemaCache. Resolves once the server is listening.
|
|
44
|
+
*
|
|
45
|
+
* Routes:
|
|
46
|
+
* - `<mcpPath>` (default `/mcp`) — MCP Streamable HTTP endpoint
|
|
47
|
+
* - `POST /admin/refresh` — invalidate the schema cache
|
|
48
|
+
*/
|
|
49
|
+
export async function startHttpServer(cache, opts = {}) {
|
|
50
|
+
const prefix = opts.logPrefix ?? '[@kozou/mcp]';
|
|
51
|
+
const host = opts.host ?? DEFAULT_HOST;
|
|
52
|
+
const port = opts.port ?? DEFAULT_PORT;
|
|
53
|
+
const mcpPath = opts.mcpPath ?? DEFAULT_MCP_PATH;
|
|
54
|
+
if (!isLoopbackHost(host)) {
|
|
55
|
+
process.stderr.write(nonLoopbackWarning(host, prefix));
|
|
56
|
+
}
|
|
57
|
+
// Active MCP sessions, keyed by the transport-issued session id.
|
|
58
|
+
const transports = new Map();
|
|
59
|
+
const httpServer = createServer((req, res) => {
|
|
60
|
+
handleRequest(req, res, cache, mcpPath, transports).catch((err) => {
|
|
61
|
+
respondError(res, 500, err instanceof Error ? err.message : String(err));
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
await new Promise((resolve, reject) => {
|
|
65
|
+
const onError = (err) => reject(err);
|
|
66
|
+
httpServer.once('error', onError);
|
|
67
|
+
httpServer.listen(port, host, () => {
|
|
68
|
+
httpServer.removeListener('error', onError);
|
|
69
|
+
resolve();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const boundPort = httpServer.address().port;
|
|
73
|
+
process.stderr.write(`${prefix} MCP HTTP listening on http://${host}:${boundPort}` +
|
|
74
|
+
` (MCP: ${mcpPath}, refresh: POST ${REFRESH_PATH})\n`);
|
|
75
|
+
return {
|
|
76
|
+
port: boundPort,
|
|
77
|
+
host,
|
|
78
|
+
close: async () => {
|
|
79
|
+
for (const transport of transports.values()) {
|
|
80
|
+
await transport.close();
|
|
81
|
+
}
|
|
82
|
+
transports.clear();
|
|
83
|
+
await closeServer(httpServer);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function handleRequest(req, res, cache, mcpPath, transports) {
|
|
88
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
89
|
+
if (url.pathname === REFRESH_PATH) {
|
|
90
|
+
if (req.method !== 'POST') {
|
|
91
|
+
respondError(res, 405, 'Method Not Allowed: use POST /admin/refresh');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
cache.invalidate();
|
|
95
|
+
res.writeHead(200, { 'content-type': 'application/json' });
|
|
96
|
+
res.end(JSON.stringify({ ok: true }));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (url.pathname === mcpPath) {
|
|
100
|
+
await handleMcp(req, res, cache, transports);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
respondError(res, 404, `Not Found: ${url.pathname}`);
|
|
104
|
+
}
|
|
105
|
+
async function handleMcp(req, res, cache, transports) {
|
|
106
|
+
const sessionId = headerValue(req.headers['mcp-session-id']);
|
|
107
|
+
// Existing session: reuse its transport (and the MCP server bound to it).
|
|
108
|
+
if (sessionId !== undefined) {
|
|
109
|
+
const existing = transports.get(sessionId);
|
|
110
|
+
if (existing === undefined) {
|
|
111
|
+
respondError(res, 404, `Unknown MCP session: ${sessionId}`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
await existing.handleRequest(req, res);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// No session id: this must be an initialize request that opens a new
|
|
118
|
+
// session. The body is read once here so we can both classify it and
|
|
119
|
+
// hand it to the transport (which would otherwise consume the stream).
|
|
120
|
+
const body = await readJsonBody(req);
|
|
121
|
+
if (!isInitializeRequest(body)) {
|
|
122
|
+
respondError(res, 400, 'Bad Request: missing mcp-session-id header (no active session)');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const transport = new StreamableHTTPServerTransport({
|
|
126
|
+
sessionIdGenerator: () => randomUUID(),
|
|
127
|
+
enableJsonResponse: true,
|
|
128
|
+
onsessioninitialized: (sid) => {
|
|
129
|
+
transports.set(sid, transport);
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
transport.onclose = () => {
|
|
133
|
+
if (transport.sessionId !== undefined) {
|
|
134
|
+
transports.delete(transport.sessionId);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const server = createMcpServer(cache);
|
|
138
|
+
await server.connect(transport);
|
|
139
|
+
await transport.handleRequest(req, res, body);
|
|
140
|
+
}
|
|
141
|
+
function headerValue(value) {
|
|
142
|
+
if (Array.isArray(value))
|
|
143
|
+
return value[0];
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
async function readJsonBody(req) {
|
|
147
|
+
const chunks = [];
|
|
148
|
+
for await (const chunk of req) {
|
|
149
|
+
chunks.push(chunk);
|
|
150
|
+
}
|
|
151
|
+
if (chunks.length === 0)
|
|
152
|
+
return undefined;
|
|
153
|
+
const raw = Buffer.concat(chunks).toString('utf8');
|
|
154
|
+
if (raw.length === 0)
|
|
155
|
+
return undefined;
|
|
156
|
+
try {
|
|
157
|
+
return JSON.parse(raw);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function respondError(res, status, message) {
|
|
164
|
+
if (res.headersSent) {
|
|
165
|
+
res.end();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
res.writeHead(status, { 'content-type': 'application/json' });
|
|
169
|
+
res.end(JSON.stringify({ error: message }));
|
|
170
|
+
}
|
|
171
|
+
function closeServer(httpServer) {
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
httpServer.close((err) => (err ? reject(err) : resolve()));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=startHttpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startHttpServer.js","sourceRoot":"","sources":["../src/startHttpServer.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,wEAAwE;AACxE,gEAAgE;AAChE,EAAE;AACF,gBAAgB;AAChB,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,sEAAsE;AACtE,sDAAsD;AACtD,wEAAwE;AACxE,qEAAqE;AACrE,+BAA+B;AAC/B,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AACjE,0EAA0E;AAC1E,qEAAqE;AACrE,iBAAiB;AAEjB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAwE,MAAM,WAAW,CAAC;AAG/G,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuB9C,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEtF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,cAAc,CAAC,GAAG,CAAC,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B,
|
|
1
|
+
{"version":3,"file":"get_concept_context.d.ts","sourceRoot":"","sources":["../../src/tools/get_concept_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAE3C,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,EAC7B,GAAG,EAAE,aAAa,GACjB,uBAAuB,CA0BzB"}
|
|
@@ -19,7 +19,11 @@ export function getConceptContext(input, ctx) {
|
|
|
19
19
|
purpose: '',
|
|
20
20
|
})),
|
|
21
21
|
relatedTables,
|
|
22
|
-
|
|
22
|
+
// `@example:` blocks captured on the VIEW's COMMENT by
|
|
23
|
+
// @kozou/core (Kozou v0.1 spec §7.3.6). Each entry is
|
|
24
|
+
// `{ description, sql }`: the line after `@example:` is the
|
|
25
|
+
// description, the indented continuation block is the SQL.
|
|
26
|
+
exampleQueries: concept.exampleQueries,
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
//# sourceMappingURL=get_concept_context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_concept_context.js","sourceRoot":"","sources":["../../src/tools/get_concept_context.ts"],"names":[],"mappings":"AACA,OAAO,EACL,4BAA4B,GAG7B,MAAM,mCAAmC,CAAC;AAE3C,MAAM,UAAU,iBAAiB,CAC/B,KAA6B,EAC7B,GAAkB;IAElB,MAAM,MAAM,GAAG,4BAA4B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;IACjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,IAAI,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jE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5F,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB,EAAE,QAAQ,OAAO,CAAC,IAAI,EAAE;QAC5C,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnD,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;QACH,aAAa;QACb,uDAAuD;QACvD,sDAAsD;QACtD,4DAA4D;QAC5D,2DAA2D;QAC3D,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SchemaContext } from '@kozou/core';
|
|
2
|
-
import { type
|
|
3
|
-
export declare function listConcepts(input:
|
|
2
|
+
import { type ListConceptsOutput } from '../schemas/list_concepts.js';
|
|
3
|
+
export declare function listConcepts(input: Record<string, unknown>, ctx: SchemaContext): ListConceptsOutput;
|
|
4
4
|
//# sourceMappingURL=list_concepts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_concepts.d.ts","sourceRoot":"","sources":["../../src/tools/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"list_concepts.d.ts","sourceRoot":"","sources":["../../src/tools/list_concepts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,aAAa,GACjB,kBAAkB,CAUpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_concepts.js","sourceRoot":"","sources":["../../src/tools/list_concepts.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"list_concepts.js","sourceRoot":"","sources":["../../src/tools/list_concepts.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,GAExB,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,YAAY,CAC1B,KAA8B,EAC9B,GAAkB;IAElB,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_tables.d.ts","sourceRoot":"","sources":["../../src/tools/list_tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"list_tables.d.ts","sourceRoot":"","sources":["../../src/tools/list_tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,GAAG,gBAAgB,CAgBvF"}
|
|
@@ -9,7 +9,10 @@ export function listTables(input, ctx) {
|
|
|
9
9
|
qualifiedName: t.qualifiedName,
|
|
10
10
|
label: t.label,
|
|
11
11
|
description: t.description,
|
|
12
|
-
|
|
12
|
+
// Planner estimate threaded through introspect ->
|
|
13
|
+
// RawTable.rowCountEstimate. `null` when PostgreSQL has not
|
|
14
|
+
// analyzed the table yet (Kozou v0.1 spec §7.3.1).
|
|
15
|
+
rowCountEstimate: t.rawTable.rowCountEstimate,
|
|
13
16
|
})),
|
|
14
17
|
};
|
|
15
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_tables.js","sourceRoot":"","sources":["../../src/tools/list_tables.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAGtB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,UAAU,UAAU,CAAC,KAAsB,EAAE,GAAkB;IACnE,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;IACzC,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC;aAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"list_tables.js","sourceRoot":"","sources":["../../src/tools/list_tables.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAGtB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,UAAU,UAAU,CAAC,KAAsB,EAAE,GAAkB;IACnE,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;IACzC,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC;aAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,kDAAkD;YAClD,4DAA4D;YAC5D,mDAAmD;YACnD,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB;SAC9C,CAAC,CAAC;KACN,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kozou/mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Kozou MCP server for AI agents (stdio
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Kozou MCP server for AI agents (stdio + HTTP)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
37
37
|
"pg": "^8.13.0",
|
|
38
|
-
"zod": "^
|
|
39
|
-
"@kozou/core": "0.1.
|
|
40
|
-
"@kozou/introspect": "0.1.
|
|
38
|
+
"zod": "^4.4.3",
|
|
39
|
+
"@kozou/core": "0.1.1",
|
|
40
|
+
"@kozou/introspect": "0.1.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/pg": "^8.11.0",
|
|
44
|
-
"tsx": "^4.19.0"
|
|
44
|
+
"tsx": "^4.19.0",
|
|
45
|
+
"@kozou/test-utils": "0.0.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"typecheck": "tsc --noEmit",
|