@kozou/mcp 0.0.1 → 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.
Files changed (75) hide show
  1. package/LICENSE +202 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +69 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/index.d.ts +17 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +20 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/schemaCache.d.ts +18 -0
  11. package/dist/schemaCache.d.ts.map +1 -0
  12. package/dist/schemaCache.js +43 -0
  13. package/dist/schemaCache.js.map +1 -0
  14. package/dist/schemas/describe_table.d.ts +54 -0
  15. package/dist/schemas/describe_table.d.ts.map +1 -0
  16. package/dist/schemas/describe_table.js +41 -0
  17. package/dist/schemas/describe_table.js.map +1 -0
  18. package/dist/schemas/describe_view.d.ts +29 -0
  19. package/dist/schemas/describe_view.d.ts.map +1 -0
  20. package/dist/schemas/describe_view.js +30 -0
  21. package/dist/schemas/describe_view.js.map +1 -0
  22. package/dist/schemas/get_concept_context.d.ts +24 -0
  23. package/dist/schemas/get_concept_context.d.ts.map +1 -0
  24. package/dist/schemas/get_concept_context.js +24 -0
  25. package/dist/schemas/get_concept_context.js.map +1 -0
  26. package/dist/schemas/list_concepts.d.ts +13 -0
  27. package/dist/schemas/list_concepts.d.ts.map +1 -0
  28. package/dist/schemas/list_concepts.js +15 -0
  29. package/dist/schemas/list_concepts.js.map +1 -0
  30. package/dist/schemas/list_tables.d.ts +16 -0
  31. package/dist/schemas/list_tables.d.ts.map +1 -0
  32. package/dist/schemas/list_tables.js +14 -0
  33. package/dist/schemas/list_tables.js.map +1 -0
  34. package/dist/schemas/list_views.d.ts +14 -0
  35. package/dist/schemas/list_views.d.ts.map +1 -0
  36. package/dist/schemas/list_views.js +12 -0
  37. package/dist/schemas/list_views.js.map +1 -0
  38. package/dist/server.d.ts +4 -0
  39. package/dist/server.d.ts.map +1 -0
  40. package/dist/server.js +114 -0
  41. package/dist/server.js.map +1 -0
  42. package/dist/startHttpServer.d.ts +30 -0
  43. package/dist/startHttpServer.d.ts.map +1 -0
  44. package/dist/startHttpServer.js +176 -0
  45. package/dist/startHttpServer.js.map +1 -0
  46. package/dist/startStdioServer.d.ts +14 -0
  47. package/dist/startStdioServer.d.ts.map +1 -0
  48. package/dist/startStdioServer.js +25 -0
  49. package/dist/startStdioServer.js.map +1 -0
  50. package/dist/tools/describe_table.d.ts +4 -0
  51. package/dist/tools/describe_table.d.ts.map +1 -0
  52. package/dist/tools/describe_table.js +45 -0
  53. package/dist/tools/describe_table.js.map +1 -0
  54. package/dist/tools/describe_view.d.ts +4 -0
  55. package/dist/tools/describe_view.d.ts.map +1 -0
  56. package/dist/tools/describe_view.js +28 -0
  57. package/dist/tools/describe_view.js.map +1 -0
  58. package/dist/tools/get_concept_context.d.ts +4 -0
  59. package/dist/tools/get_concept_context.d.ts.map +1 -0
  60. package/dist/tools/get_concept_context.js +29 -0
  61. package/dist/tools/get_concept_context.js.map +1 -0
  62. package/dist/tools/list_concepts.d.ts +4 -0
  63. package/dist/tools/list_concepts.d.ts.map +1 -0
  64. package/dist/tools/list_concepts.js +13 -0
  65. package/dist/tools/list_concepts.js.map +1 -0
  66. package/dist/tools/list_tables.d.ts +4 -0
  67. package/dist/tools/list_tables.d.ts.map +1 -0
  68. package/dist/tools/list_tables.js +19 -0
  69. package/dist/tools/list_tables.js.map +1 -0
  70. package/dist/tools/list_views.d.ts +4 -0
  71. package/dist/tools/list_views.d.ts.map +1 -0
  72. package/dist/tools/list_views.js +15 -0
  73. package/dist/tools/list_views.js.map +1 -0
  74. package/package.json +49 -4
  75. package/README.md +0 -3
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,29 @@
1
+ import { getConceptContextInputSchema, } from '../schemas/get_concept_context.js';
2
+ export function getConceptContext(input, ctx) {
3
+ const parsed = getConceptContextInputSchema.parse(input);
4
+ const concept = ctx.concepts.find((c) => c.name === parsed.name);
5
+ if (!concept) {
6
+ throw new Error(`Concept not found: ${parsed.name}`);
7
+ }
8
+ const view = ctx.views.find((v) => v.name === concept.name);
9
+ const relatedTables = view ? view.underlyingTables.map((t) => `${t.schema}.${t.name}`) : [];
10
+ return {
11
+ name: concept.name,
12
+ label: concept.label,
13
+ description: concept.description,
14
+ aiNotes: concept.aiNotes,
15
+ preferredQuerySource: `FROM ${concept.name}`,
16
+ joinSuggestions: concept.joinSuggestions.map((j) => ({
17
+ table: j.table,
18
+ on: j.on,
19
+ purpose: '',
20
+ })),
21
+ relatedTables,
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,
27
+ };
28
+ }
29
+ //# sourceMappingURL=get_concept_context.js.map
@@ -0,0 +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,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"}
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from '@kozou/core';
2
+ import { type ListConceptsOutput } from '../schemas/list_concepts.js';
3
+ export declare function listConcepts(input: Record<string, unknown>, ctx: SchemaContext): ListConceptsOutput;
4
+ //# sourceMappingURL=list_concepts.d.ts.map
@@ -0,0 +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,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,aAAa,GACjB,kBAAkB,CAUpB"}
@@ -0,0 +1,13 @@
1
+ import { listConceptsInputSchema, } from '../schemas/list_concepts.js';
2
+ export function listConcepts(input, ctx) {
3
+ listConceptsInputSchema.parse(input);
4
+ return {
5
+ concepts: ctx.concepts.map((c) => ({
6
+ name: c.name,
7
+ label: c.label,
8
+ description: c.description,
9
+ kind: c.kind,
10
+ })),
11
+ };
12
+ }
13
+ //# sourceMappingURL=list_concepts.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from '@kozou/core';
2
+ import { type ListTablesInput, type ListTablesOutput } from '../schemas/list_tables.js';
3
+ export declare function listTables(input: ListTablesInput, ctx: SchemaContext): ListTablesOutput;
4
+ //# sourceMappingURL=list_tables.d.ts.map
@@ -0,0 +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,CAgBvF"}
@@ -0,0 +1,19 @@
1
+ import { listTablesInputSchema, } from '../schemas/list_tables.js';
2
+ export function listTables(input, ctx) {
3
+ const parsed = listTablesInputSchema.parse(input);
4
+ const schema = parsed.schema ?? 'public';
5
+ return {
6
+ tables: ctx.tables
7
+ .filter((t) => t.schema === schema)
8
+ .map((t) => ({
9
+ qualifiedName: t.qualifiedName,
10
+ label: t.label,
11
+ description: t.description,
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,
16
+ })),
17
+ };
18
+ }
19
+ //# sourceMappingURL=list_tables.js.map
@@ -0,0 +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,kDAAkD;YAClD,4DAA4D;YAC5D,mDAAmD;YACnD,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB;SAC9C,CAAC,CAAC;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from '@kozou/core';
2
+ import { type ListViewsInput, type ListViewsOutput } from '../schemas/list_views.js';
3
+ export declare function listViews(input: ListViewsInput, ctx: SchemaContext): ListViewsOutput;
4
+ //# sourceMappingURL=list_views.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list_views.d.ts","sourceRoot":"","sources":["../../src/tools/list_views.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,eAAe,CAYpF"}
@@ -0,0 +1,15 @@
1
+ import { listViewsInputSchema, } from '../schemas/list_views.js';
2
+ export function listViews(input, ctx) {
3
+ const parsed = listViewsInputSchema.parse(input);
4
+ const schema = parsed.schema ?? 'public';
5
+ return {
6
+ views: ctx.views
7
+ .filter((v) => v.schema === schema)
8
+ .map((v) => ({
9
+ qualifiedName: v.qualifiedName,
10
+ label: v.label,
11
+ purpose: v.purpose,
12
+ })),
13
+ };
14
+ }
15
+ //# sourceMappingURL=list_views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list_views.js","sourceRoot":"","sources":["../../src/tools/list_views.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU,SAAS,CAAC,KAAqB,EAAE,GAAkB;IACjE,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC;IACzC,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,KAAK;aACb,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,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC;KACN,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,52 @@
1
1
  {
2
2
  "name": "@kozou/mcp",
3
- "version": "0.0.1",
4
- "description": "Placeholder; v0.1.0 release lands via CI shortly.",
3
+ "version": "0.1.1",
4
+ "description": "Kozou MCP server for AI agents (stdio + HTTP)",
5
5
  "license": "Apache-2.0",
6
- "publishConfig": { "access": "public" }
7
- }
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kozou-dev/kozou.git",
9
+ "directory": "packages/mcp"
10
+ },
11
+ "homepage": "https://kozou.org",
12
+ "bugs": {
13
+ "url": "https://github.com/kozou-dev/kozou/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/index.js",
21
+ "types": "./dist/index.d.ts"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "bin": {
26
+ "kozou-mcp": "./dist/cli.js"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.0.0",
37
+ "pg": "^8.13.0",
38
+ "zod": "^4.4.3",
39
+ "@kozou/core": "0.1.1",
40
+ "@kozou/introspect": "0.1.1"
41
+ },
42
+ "devDependencies": {
43
+ "@types/pg": "^8.11.0",
44
+ "tsx": "^4.19.0",
45
+ "@kozou/test-utils": "0.0.0"
46
+ },
47
+ "scripts": {
48
+ "typecheck": "tsc --noEmit",
49
+ "build": "tsc",
50
+ "test": "vitest run --coverage"
51
+ }
52
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @kozou/mcp
2
-
3
- Placeholder publish. The real v0.1.0 release lands via CI shortly. See https://github.com/kozou-dev/kozou for the source.