@kozou/mcp 0.0.1 → 0.1.0
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/LICENSE +202 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +30 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/schemaCache.d.ts +18 -0
- package/dist/schemaCache.d.ts.map +1 -0
- package/dist/schemaCache.js +43 -0
- package/dist/schemaCache.js.map +1 -0
- package/dist/schemas/describe_table.d.ts +198 -0
- package/dist/schemas/describe_table.d.ts.map +1 -0
- package/dist/schemas/describe_table.js +41 -0
- package/dist/schemas/describe_table.js.map +1 -0
- package/dist/schemas/describe_view.d.ts +107 -0
- package/dist/schemas/describe_view.d.ts.map +1 -0
- package/dist/schemas/describe_view.js +30 -0
- package/dist/schemas/describe_view.js.map +1 -0
- package/dist/schemas/get_concept_context.d.ts +74 -0
- package/dist/schemas/get_concept_context.d.ts.map +1 -0
- package/dist/schemas/get_concept_context.js +24 -0
- package/dist/schemas/get_concept_context.js.map +1 -0
- package/dist/schemas/list_concepts.d.ts +37 -0
- package/dist/schemas/list_concepts.d.ts.map +1 -0
- package/dist/schemas/list_concepts.js +11 -0
- package/dist/schemas/list_concepts.js.map +1 -0
- package/dist/schemas/list_tables.d.ts +46 -0
- package/dist/schemas/list_tables.d.ts.map +1 -0
- package/dist/schemas/list_tables.js +14 -0
- package/dist/schemas/list_tables.js.map +1 -0
- package/dist/schemas/list_views.d.ts +38 -0
- package/dist/schemas/list_views.d.ts.map +1 -0
- package/dist/schemas/list_views.js +12 -0
- package/dist/schemas/list_views.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +105 -0
- package/dist/server.js.map +1 -0
- package/dist/startStdioServer.d.ts +14 -0
- package/dist/startStdioServer.d.ts.map +1 -0
- package/dist/startStdioServer.js +25 -0
- package/dist/startStdioServer.js.map +1 -0
- package/dist/tools/describe_table.d.ts +4 -0
- package/dist/tools/describe_table.d.ts.map +1 -0
- package/dist/tools/describe_table.js +45 -0
- package/dist/tools/describe_table.js.map +1 -0
- package/dist/tools/describe_view.d.ts +4 -0
- package/dist/tools/describe_view.d.ts.map +1 -0
- package/dist/tools/describe_view.js +28 -0
- package/dist/tools/describe_view.js.map +1 -0
- package/dist/tools/get_concept_context.d.ts +4 -0
- package/dist/tools/get_concept_context.d.ts.map +1 -0
- package/dist/tools/get_concept_context.js +25 -0
- package/dist/tools/get_concept_context.js.map +1 -0
- package/dist/tools/list_concepts.d.ts +4 -0
- package/dist/tools/list_concepts.d.ts.map +1 -0
- package/dist/tools/list_concepts.js +13 -0
- package/dist/tools/list_concepts.js.map +1 -0
- package/dist/tools/list_tables.d.ts +4 -0
- package/dist/tools/list_tables.d.ts.map +1 -0
- package/dist/tools/list_tables.js +16 -0
- package/dist/tools/list_tables.js.map +1 -0
- package/dist/tools/list_views.d.ts +4 -0
- package/dist/tools/list_views.d.ts.map +1 -0
- package/dist/tools/list_views.js +15 -0
- package/dist/tools/list_views.js.map +1 -0
- package/package.json +48 -4
- package/README.md +0 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const describeViewInputSchema: z.ZodObject<{
|
|
3
|
+
qualifiedName: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
qualifiedName: string;
|
|
6
|
+
}, {
|
|
7
|
+
qualifiedName: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const describeViewOutputSchema: z.ZodObject<{
|
|
10
|
+
qualifiedName: z.ZodString;
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
description: z.ZodNullable<z.ZodString>;
|
|
13
|
+
aiDescription: z.ZodNullable<z.ZodString>;
|
|
14
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
dataType: z.ZodString;
|
|
17
|
+
nullable: z.ZodBoolean;
|
|
18
|
+
defaultExpr: z.ZodNullable<z.ZodString>;
|
|
19
|
+
description: z.ZodNullable<z.ZodString>;
|
|
20
|
+
aiDescription: z.ZodNullable<z.ZodString>;
|
|
21
|
+
enumValues: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
isForeignKey: z.ZodBoolean;
|
|
23
|
+
references: z.ZodNullable<z.ZodObject<{
|
|
24
|
+
table: z.ZodString;
|
|
25
|
+
column: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
table: string;
|
|
28
|
+
column: string;
|
|
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">;
|
|
61
|
+
definition: z.ZodString;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
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
|
+
}>;
|
|
105
|
+
export type DescribeViewInput = z.infer<typeof describeViewInputSchema>;
|
|
106
|
+
export type DescribeViewOutput = z.infer<typeof describeViewOutputSchema>;
|
|
107
|
+
//# sourceMappingURL=describe_view.d.ts.map
|
|
@@ -0,0 +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;;;;;;EAElC,CAAC;AAmBH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQnC,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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const describeViewInputSchema = z.object({
|
|
3
|
+
qualifiedName: z.string().min(1),
|
|
4
|
+
});
|
|
5
|
+
const viewColumnSchema = z.object({
|
|
6
|
+
name: z.string(),
|
|
7
|
+
dataType: z.string(),
|
|
8
|
+
nullable: z.boolean(),
|
|
9
|
+
defaultExpr: z.string().nullable(),
|
|
10
|
+
description: z.string().nullable(),
|
|
11
|
+
aiDescription: z.string().nullable(),
|
|
12
|
+
enumValues: z.array(z.string()).nullable(),
|
|
13
|
+
isForeignKey: z.boolean(),
|
|
14
|
+
references: z
|
|
15
|
+
.object({
|
|
16
|
+
table: z.string(),
|
|
17
|
+
column: z.string(),
|
|
18
|
+
})
|
|
19
|
+
.nullable(),
|
|
20
|
+
});
|
|
21
|
+
export const describeViewOutputSchema = z.object({
|
|
22
|
+
qualifiedName: z.string(),
|
|
23
|
+
label: z.string(),
|
|
24
|
+
description: z.string().nullable(),
|
|
25
|
+
aiDescription: z.string().nullable(),
|
|
26
|
+
columns: z.array(viewColumnSchema),
|
|
27
|
+
underlyingTables: z.array(z.string()),
|
|
28
|
+
definition: z.string(),
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=describe_view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe_view.js","sourceRoot":"","sources":["../../src/schemas/describe_view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,E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AM,EAAE,CAAC;IACrC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getConceptContextInputSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
name: string;
|
|
6
|
+
}, {
|
|
7
|
+
name: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getConceptContextOutputSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
description: z.ZodNullable<z.ZodString>;
|
|
13
|
+
aiNotes: z.ZodArray<z.ZodString, "many">;
|
|
14
|
+
preferredQuerySource: z.ZodString;
|
|
15
|
+
joinSuggestions: z.ZodArray<z.ZodObject<{
|
|
16
|
+
table: z.ZodString;
|
|
17
|
+
on: z.ZodString;
|
|
18
|
+
purpose: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
table: string;
|
|
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">;
|
|
29
|
+
exampleQueries: z.ZodArray<z.ZodObject<{
|
|
30
|
+
description: z.ZodString;
|
|
31
|
+
sql: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
description: string;
|
|
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
|
+
}>;
|
|
72
|
+
export type GetConceptContextInput = z.infer<typeof getConceptContextInputSchema>;
|
|
73
|
+
export type GetConceptContextOutput = z.infer<typeof getConceptContextOutputSchema>;
|
|
74
|
+
//# sourceMappingURL=get_concept_context.d.ts.map
|
|
@@ -0,0 +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;;;;;;EAEvC,CAAC;AAaH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const getConceptContextInputSchema = z.object({
|
|
3
|
+
name: z.string().min(1),
|
|
4
|
+
});
|
|
5
|
+
const joinSuggestionSchema = z.object({
|
|
6
|
+
table: z.string(),
|
|
7
|
+
on: z.string(),
|
|
8
|
+
purpose: z.string(),
|
|
9
|
+
});
|
|
10
|
+
const exampleQuerySchema = z.object({
|
|
11
|
+
description: z.string(),
|
|
12
|
+
sql: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const getConceptContextOutputSchema = z.object({
|
|
15
|
+
name: z.string(),
|
|
16
|
+
label: z.string(),
|
|
17
|
+
description: z.string().nullable(),
|
|
18
|
+
aiNotes: z.array(z.string()),
|
|
19
|
+
preferredQuerySource: z.string(),
|
|
20
|
+
joinSuggestions: z.array(joinSuggestionSchema),
|
|
21
|
+
relatedTables: z.array(z.string()),
|
|
22
|
+
exampleQueries: z.array(exampleQuerySchema),
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=get_concept_context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_concept_context.js","sourceRoot":"","sources":["../../src/schemas/get_concept_context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;IAChC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAC9C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listConceptsInputSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
3
|
+
export declare const listConceptsOutputSchema: z.ZodObject<{
|
|
4
|
+
concepts: z.ZodArray<z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
description: z.ZodNullable<z.ZodString>;
|
|
8
|
+
kind: z.ZodLiteral<"VIEW">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
label: string;
|
|
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
|
+
}>;
|
|
35
|
+
export type ListConceptsInput = z.infer<typeof listConceptsInputSchema>;
|
|
36
|
+
export type ListConceptsOutput = z.infer<typeof listConceptsOutputSchema>;
|
|
37
|
+
//# sourceMappingURL=list_concepts.d.ts.map
|
|
@@ -0,0 +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;AAExB,eAAO,MAAM,uBAAuB,iDAAwB,CAAC;AAE7D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const listConceptsInputSchema = z.object({}).strict();
|
|
3
|
+
export const listConceptsOutputSchema = z.object({
|
|
4
|
+
concepts: z.array(z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
label: z.string(),
|
|
7
|
+
description: z.string().nullable(),
|
|
8
|
+
kind: z.literal('VIEW'),
|
|
9
|
+
})),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=list_concepts.js.map
|
|
@@ -0,0 +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,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE7D,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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listTablesInputSchema: z.ZodObject<{
|
|
3
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
includeSystem: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
schema?: string | undefined;
|
|
7
|
+
includeSystem?: boolean | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
schema?: string | undefined;
|
|
10
|
+
includeSystem?: boolean | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const listTablesOutputSchema: z.ZodObject<{
|
|
13
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
14
|
+
qualifiedName: z.ZodString;
|
|
15
|
+
label: z.ZodString;
|
|
16
|
+
description: z.ZodNullable<z.ZodString>;
|
|
17
|
+
rowCountEstimate: z.ZodNullable<z.ZodNumber>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
qualifiedName: string;
|
|
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
|
+
}>;
|
|
44
|
+
export type ListTablesInput = z.infer<typeof listTablesInputSchema>;
|
|
45
|
+
export type ListTablesOutput = z.infer<typeof listTablesOutputSchema>;
|
|
46
|
+
//# sourceMappingURL=list_tables.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASjC,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const listTablesInputSchema = z.object({
|
|
3
|
+
schema: z.string().optional(),
|
|
4
|
+
includeSystem: z.boolean().optional(),
|
|
5
|
+
});
|
|
6
|
+
export const listTablesOutputSchema = z.object({
|
|
7
|
+
tables: z.array(z.object({
|
|
8
|
+
qualifiedName: z.string(),
|
|
9
|
+
label: z.string(),
|
|
10
|
+
description: z.string().nullable(),
|
|
11
|
+
rowCountEstimate: z.number().nullable(),
|
|
12
|
+
})),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=list_tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_tables.js","sourceRoot":"","sources":["../../src/schemas/list_tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,MAAM,CAAC;QACP,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACxC,CAAC,CACH;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listViewsInputSchema: z.ZodObject<{
|
|
3
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
schema?: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
schema?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const listViewsOutputSchema: z.ZodObject<{
|
|
10
|
+
views: z.ZodArray<z.ZodObject<{
|
|
11
|
+
qualifiedName: z.ZodString;
|
|
12
|
+
label: z.ZodString;
|
|
13
|
+
purpose: z.ZodNullable<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
qualifiedName: string;
|
|
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
|
+
}>;
|
|
36
|
+
export type ListViewsInput = z.infer<typeof listViewsInputSchema>;
|
|
37
|
+
export type ListViewsOutput = z.infer<typeof listViewsOutputSchema>;
|
|
38
|
+
//# sourceMappingURL=list_views.d.ts.map
|
|
@@ -0,0 +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;;;;;;EAE/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;EAQhC,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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const listViewsInputSchema = z.object({
|
|
3
|
+
schema: z.string().optional(),
|
|
4
|
+
});
|
|
5
|
+
export const listViewsOutputSchema = z.object({
|
|
6
|
+
views: z.array(z.object({
|
|
7
|
+
qualifiedName: z.string(),
|
|
8
|
+
label: z.string(),
|
|
9
|
+
purpose: z.string().nullable(),
|
|
10
|
+
})),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=list_views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_views.js","sourceRoot":"","sources":["../../src/schemas/list_views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqEpD,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAwC1D"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { listTables } from './tools/list_tables.js';
|
|
4
|
+
import { describeTable } from './tools/describe_table.js';
|
|
5
|
+
import { listViews } from './tools/list_views.js';
|
|
6
|
+
import { describeView } from './tools/describe_view.js';
|
|
7
|
+
import { listConcepts } from './tools/list_concepts.js';
|
|
8
|
+
import { getConceptContext } from './tools/get_concept_context.js';
|
|
9
|
+
const TOOL_DEFINITIONS = [
|
|
10
|
+
{
|
|
11
|
+
name: 'list_tables',
|
|
12
|
+
description: 'List tables with their labels and descriptions',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
schema: { type: 'string', description: 'Target schema (default: public)' },
|
|
17
|
+
includeSystem: { type: 'boolean', description: 'Include system schemas (ignored in v0.1)' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'describe_table',
|
|
23
|
+
description: 'Return the full schema + COMMENT for the given table',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: { qualifiedName: { type: 'string', description: 'e.g. public.users' } },
|
|
27
|
+
required: ['qualifiedName'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'list_views',
|
|
32
|
+
description: 'List views with their labels and purposes',
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: { schema: { type: 'string', description: 'Target schema (default: public)' } },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'describe_view',
|
|
40
|
+
description: 'Return columns + purpose + underlying tables + definition for the given view',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: { qualifiedName: { type: 'string', description: 'e.g. public.vw_active_users' } },
|
|
44
|
+
required: ['qualifiedName'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'list_concepts',
|
|
49
|
+
description: 'List domain concepts (each backed by a VIEW)',
|
|
50
|
+
inputSchema: { type: 'object', properties: {} },
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'get_concept_context',
|
|
54
|
+
description: 'Return related tables + recommended query path for the given concept',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: { name: { type: 'string', description: 'Matches the VIEW name' } },
|
|
58
|
+
required: ['name'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
function successResult(payload) {
|
|
63
|
+
return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }] };
|
|
64
|
+
}
|
|
65
|
+
function errorResult(message) {
|
|
66
|
+
return {
|
|
67
|
+
isError: true,
|
|
68
|
+
content: [{ type: 'text', text: message }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function createMcpServer(cache) {
|
|
72
|
+
const server = new Server({ name: 'kozou', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
73
|
+
server.setRequestHandler(ListToolsRequestSchema, () => Promise.resolve({ tools: TOOL_DEFINITIONS.map((t) => ({ ...t })) }));
|
|
74
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
75
|
+
const name = request.params.name;
|
|
76
|
+
const args = (request.params.arguments ?? {});
|
|
77
|
+
try {
|
|
78
|
+
const ctx = await cache.get();
|
|
79
|
+
switch (name) {
|
|
80
|
+
case 'list_tables':
|
|
81
|
+
return successResult(listTables(args, ctx));
|
|
82
|
+
case 'describe_table':
|
|
83
|
+
return successResult(describeTable(args, ctx));
|
|
84
|
+
case 'list_views':
|
|
85
|
+
return successResult(listViews(args, ctx));
|
|
86
|
+
case 'describe_view':
|
|
87
|
+
return successResult(describeView(args, ctx));
|
|
88
|
+
case 'list_concepts':
|
|
89
|
+
return successResult(listConcepts(args, ctx));
|
|
90
|
+
case 'get_concept_context':
|
|
91
|
+
return successResult(getConceptContext(args, ctx));
|
|
92
|
+
default:
|
|
93
|
+
return errorResult(`Unknown tool: ${name}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
const dev = process.env.KOZOU_DEV === '1';
|
|
98
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
99
|
+
const detail = dev && err instanceof Error && err.stack ? `\n${err.stack}` : '';
|
|
100
|
+
return errorResult(`${msg}${detail}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return server;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +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;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,MAAM,gBAAgB,GAAG;IACvB;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,gDAAgD;QAC7D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;gBAC1E,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0CAA0C,EAAE;aAC5F;SACF;KACF;IACD;QACE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,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC7C,KAAK,eAAe;oBAClB,OAAO,aAAa,CAAC,YAAY,CAAC,IAAiC,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC7E,KAAK,eAAe;oBAClB,OAAO,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;gBAChD,KAAK,qBAAqB;oBACxB,OAAO,aAAa,CAAC,iBAAiB,CAAC,IAAwB,EAAE,GAAG,CAAC,CAAC,CAAC;gBACzE;oBACE,OAAO,WAAW,CAAC,iBAAiB,IAAc,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,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,14 @@
|
|
|
1
|
+
import type { SchemaCache } from './schemaCache.js';
|
|
2
|
+
export type StartStdioServerOptions = {
|
|
3
|
+
/** Prefix used in stderr log lines. Default: '[@kozou/mcp]'. */
|
|
4
|
+
logPrefix?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Start the MCP server bound to the given SchemaCache, using a stdio
|
|
8
|
+
* transport. Installs a SIGHUP handler that invalidates the cache, so
|
|
9
|
+
* adopters can refresh the schema without restarting the process.
|
|
10
|
+
*
|
|
11
|
+
* Resolves once the underlying transport finishes connecting.
|
|
12
|
+
*/
|
|
13
|
+
export declare function startStdioServer(cache: SchemaCache, opts?: StartStdioServerOptions): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=startStdioServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startStdioServer.d.ts","sourceRoot":"","sources":["../src/startStdioServer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG;IACpC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,WAAW,EAClB,IAAI,GAAE,uBAA4B,GACjC,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Convenience helper to start an MCP server with the stdio transport.
|
|
2
|
+
//
|
|
3
|
+
// This lives in @kozou/mcp so callers (the bundled kozou CLI as well as
|
|
4
|
+
// adopters embedding the MCP server in their own scripts) do not need to
|
|
5
|
+
// depend on @modelcontextprotocol/sdk directly.
|
|
6
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
7
|
+
import { createMcpServer } from './server.js';
|
|
8
|
+
/**
|
|
9
|
+
* Start the MCP server bound to the given SchemaCache, using a stdio
|
|
10
|
+
* transport. Installs a SIGHUP handler that invalidates the cache, so
|
|
11
|
+
* adopters can refresh the schema without restarting the process.
|
|
12
|
+
*
|
|
13
|
+
* Resolves once the underlying transport finishes connecting.
|
|
14
|
+
*/
|
|
15
|
+
export async function startStdioServer(cache, opts = {}) {
|
|
16
|
+
const prefix = opts.logPrefix ?? '[@kozou/mcp]';
|
|
17
|
+
const server = createMcpServer(cache);
|
|
18
|
+
process.on('SIGHUP', () => {
|
|
19
|
+
cache.invalidate();
|
|
20
|
+
process.stderr.write(`${prefix} SIGHUP received, cache invalidated\n`);
|
|
21
|
+
});
|
|
22
|
+
const transport = new StdioServerTransport();
|
|
23
|
+
await server.connect(transport);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=startStdioServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startStdioServer.js","sourceRoot":"","sources":["../src/startStdioServer.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,gDAAgD;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQ9C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAkB,EAClB,OAAgC,EAAE;IAElC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,IAAI,cAAc,CAAC;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,uCAAuC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SchemaContext } from '@kozou/core';
|
|
2
|
+
import { type DescribeTableInput, type DescribeTableOutput } from '../schemas/describe_table.js';
|
|
3
|
+
export declare function describeTable(input: DescribeTableInput, ctx: SchemaContext): DescribeTableOutput;
|
|
4
|
+
//# sourceMappingURL=describe_table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe_table.d.ts","sourceRoot":"","sources":["../../src/tools/describe_table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAEzB,MAAM,8BAA8B,CAAC;AAEtC,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,aAAa,GAAG,mBAAmB,CA6ChG"}
|