@kubun/mcp 0.4.1 → 0.4.2
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/lib/tools/cluster.js +2 -1
- package/lib/tools/graph.d.ts.map +1 -1
- package/lib/tools/graph.js +36 -13
- package/package.json +7 -7
package/lib/tools/cluster.js
CHANGED
package/lib/tools/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/tools/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAA;AAG/D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/tools/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAA;AAG/D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AA0BnD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAsMpF"}
|
package/lib/tools/graph.js
CHANGED
|
@@ -2,11 +2,8 @@ import { createSchema } from '@kubun/graphql';
|
|
|
2
2
|
import { createTool } from '@mokei/context-server';
|
|
3
3
|
import { printSchema } from 'graphql';
|
|
4
4
|
function getModelsInfo(result) {
|
|
5
|
-
if (result.models == null) {
|
|
6
|
-
return {};
|
|
7
|
-
}
|
|
8
5
|
const aliases = result.aliases ?? {};
|
|
9
|
-
return Object.entries(result.
|
|
6
|
+
return Object.entries(result.record).reduce((acc, [id, model])=>{
|
|
10
7
|
const alias = aliases[id] ?? model.name;
|
|
11
8
|
acc[alias] = {
|
|
12
9
|
id,
|
|
@@ -51,9 +48,6 @@ export function createGraphTools(client) {
|
|
|
51
48
|
const result = await client.loadGraph({
|
|
52
49
|
id: ctx.arguments.id
|
|
53
50
|
});
|
|
54
|
-
if (result.models == null) {
|
|
55
|
-
throw new Error(`Models not found for graph: ${ctx.arguments.id}`);
|
|
56
|
-
}
|
|
57
51
|
const info = getModelsInfo(result);
|
|
58
52
|
return {
|
|
59
53
|
content: [
|
|
@@ -76,11 +70,35 @@ export function createGraphTools(client) {
|
|
|
76
70
|
};
|
|
77
71
|
}
|
|
78
72
|
});
|
|
79
|
-
const graph_schema = createTool('Get the GraphQL schema for the given graph ID', {
|
|
73
|
+
const graph_schema = createTool('Get the GraphQL schema for the given graph ID. Supports selective generation to reduce schema size for LLM context.', {
|
|
80
74
|
type: 'object',
|
|
81
75
|
properties: {
|
|
82
76
|
id: {
|
|
83
|
-
type: 'string'
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'The graph ID'
|
|
79
|
+
},
|
|
80
|
+
onlyModels: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
items: {
|
|
83
|
+
type: 'string'
|
|
84
|
+
},
|
|
85
|
+
description: 'Optional array of model IDs or aliases to include in schema. If not provided, all models are included.'
|
|
86
|
+
},
|
|
87
|
+
includeInterfaceDependencies: {
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
description: 'Whether to include interface dependencies (default: true)'
|
|
90
|
+
},
|
|
91
|
+
includeRelationDependencies: {
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
description: 'Whether to include relation dependencies (default: true)'
|
|
94
|
+
},
|
|
95
|
+
includeMutations: {
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
description: 'Whether to include mutations in the schema (default: true)'
|
|
98
|
+
},
|
|
99
|
+
includeSubscriptions: {
|
|
100
|
+
type: 'boolean',
|
|
101
|
+
description: 'Whether to include subscriptions in the schema (default: true)'
|
|
84
102
|
}
|
|
85
103
|
},
|
|
86
104
|
required: [
|
|
@@ -92,10 +110,15 @@ export function createGraphTools(client) {
|
|
|
92
110
|
const result = await client.loadGraph({
|
|
93
111
|
id: ctx.arguments.id
|
|
94
112
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
const schema = createSchema({
|
|
114
|
+
record: result.record,
|
|
115
|
+
aliases: result.aliases,
|
|
116
|
+
onlyModels: ctx.arguments.onlyModels,
|
|
117
|
+
includeInterfaceDependencies: ctx.arguments.includeInterfaceDependencies,
|
|
118
|
+
includeRelationDependencies: ctx.arguments.includeRelationDependencies,
|
|
119
|
+
includeMutations: ctx.arguments.includeMutations,
|
|
120
|
+
includeSubscriptions: ctx.arguments.includeSubscriptions
|
|
121
|
+
});
|
|
99
122
|
return {
|
|
100
123
|
content: [
|
|
101
124
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "MCP server for Kubun",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"type": "module",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"@enkaku/token": "0.12.3",
|
|
22
22
|
"@mokei/context-server": "^0.5.0",
|
|
23
23
|
"graphql": "^16.12.0",
|
|
24
|
-
"@kubun/db": "^0.4.0",
|
|
25
24
|
"@kubun/db-postgres": "^0.4.0",
|
|
26
25
|
"@kubun/db-sqlite": "^0.4.0",
|
|
27
|
-
"@kubun/
|
|
28
|
-
"@kubun/
|
|
29
|
-
"@kubun/protocol": "^0.4.
|
|
30
|
-
"@kubun/
|
|
26
|
+
"@kubun/db": "^0.4.0",
|
|
27
|
+
"@kubun/server": "^0.4.3",
|
|
28
|
+
"@kubun/protocol": "^0.4.1",
|
|
29
|
+
"@kubun/graphql": "^0.4.5",
|
|
30
|
+
"@kubun/http-client": "^0.4.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@enkaku/transport": "0.12.0",
|
|
34
34
|
"@mokei/context-client": "^0.5.0",
|
|
35
35
|
"@mokei/context-protocol": "^0.5.0",
|
|
36
|
-
"@kubun/client": "^0.4.
|
|
36
|
+
"@kubun/client": "^0.4.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build:clean": "del lib",
|