@grackle-ai/mcp 0.98.0 → 0.100.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAwCxE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,oBAAoB,CAAC,EAAE,cAAc,EAAE,EAAE,GAAG,YAAY,CAW1F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAsCxE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,oBAAoB,CAAC,EAAE,cAAc,EAAE,EAAE,GAAG,YAAY,CAW1F"}
@@ -11,7 +11,6 @@ import { tokenTools } from "./token.js";
11
11
  import { configTools } from "./config.js";
12
12
  import { ipcTools } from "./ipc.js";
13
13
  import { usageTools } from "./usage.js";
14
- import { knowledgeTools } from "./knowledge.js";
15
14
  import { workpadTools } from "./workpad.js";
16
15
  import { scheduleTools } from "./schedule.js";
17
16
  import { versionTools } from "./version.js";
@@ -30,7 +29,6 @@ const builtinToolGroups = [
30
29
  configTools,
31
30
  ipcTools,
32
31
  usageTools,
33
- knowledgeTools,
34
32
  workpadTools,
35
33
  scheduleTools,
36
34
  versionTools,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE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,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,eAAe;CAChB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,oBAAyC;IAC1E,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IACpC,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;QACtC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,oBAAoB,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,oBAAoB,EAAE,CAAC;YACzC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/mcp",
3
- "version": "0.98.0",
3
+ "version": "0.100.0",
4
4
  "description": "MCP (Model Context Protocol) server for Grackle — translates MCP tool calls to ConnectRPC",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "@modelcontextprotocol/sdk": "^1.27.0",
38
38
  "pino": "^10.3.1",
39
39
  "zod": "^4.0.0",
40
- "@grackle-ai/auth": "0.98.0",
41
- "@grackle-ai/common": "0.98.0"
40
+ "@grackle-ai/common": "0.100.0",
41
+ "@grackle-ai/auth": "0.100.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@rushstack/heft": "1.2.7",
@@ -1,13 +0,0 @@
1
- /**
2
- * MCP tools for the Grackle knowledge graph.
3
- *
4
- * Exposes high-level operations (search, retrieve, create) to agents.
5
- * All calls go through gRPC to the Grackle server — the MCP package
6
- * does not access knowledge-core or Neo4j directly.
7
- *
8
- * @module
9
- */
10
- import type { ToolDefinition } from "../tool-registry.js";
11
- /** Knowledge graph MCP tools. */
12
- export declare const knowledgeTools: ToolDefinition[];
13
- //# sourceMappingURL=knowledge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../../src/tools/knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAwF1D,iCAAiC;AACjC,eAAO,MAAM,cAAc,EAAE,cAAc,EAkV1C,CAAC"}
@@ -1,340 +0,0 @@
1
- /**
2
- * MCP tools for the Grackle knowledge graph.
3
- *
4
- * Exposes high-level operations (search, retrieve, create) to agents.
5
- * All calls go through gRPC to the Grackle server — the MCP package
6
- * does not access knowledge-core or Neo4j directly.
7
- *
8
- * @module
9
- */
10
- import { z } from "zod";
11
- import { jsonResult } from "../result-helpers.js";
12
- // ---------------------------------------------------------------------------
13
- // Constants
14
- // ---------------------------------------------------------------------------
15
- /** Maximum allowed search results. */
16
- const MAX_SEARCH_LIMIT = 50;
17
- /** Maximum allowed expansion depth. */
18
- const MAX_EXPAND_DEPTH = 5;
19
- /** Valid edge type values. */
20
- const EDGE_TYPES = [
21
- "RELATES_TO",
22
- "DEPENDS_ON",
23
- "DERIVED_FROM",
24
- "MENTIONS",
25
- "PART_OF",
26
- ];
27
- // ---------------------------------------------------------------------------
28
- // Response formatting — hide internal details from agents
29
- // ---------------------------------------------------------------------------
30
- /** Format a proto node for agent consumption. */
31
- function formatNode(node) {
32
- const base = {
33
- id: node.id,
34
- kind: node.kind,
35
- workspaceId: node.workspaceId,
36
- createdAt: node.createdAt,
37
- updatedAt: node.updatedAt,
38
- };
39
- if (node.kind === "reference") {
40
- base.sourceType = node.sourceType;
41
- base.sourceId = node.sourceId;
42
- base.label = node.label;
43
- }
44
- else {
45
- base.category = node.category;
46
- base.title = node.title;
47
- base.content = node.content;
48
- base.tags = [...node.tags];
49
- }
50
- return base;
51
- }
52
- /** Format a proto edge for agent consumption. */
53
- function formatEdge(edge) {
54
- const result = {
55
- fromId: edge.fromId,
56
- toId: edge.toId,
57
- type: edge.type,
58
- };
59
- if (edge.metadataJson) {
60
- try {
61
- result.metadata = JSON.parse(edge.metadataJson);
62
- }
63
- catch {
64
- // ignore malformed metadata
65
- }
66
- }
67
- return result;
68
- }
69
- /** Format a search result for agent consumption. */
70
- function formatSearchResult(result) {
71
- return {
72
- score: Math.round(result.score * 1000) / 1000,
73
- node: result.node ? formatNode(result.node) : {},
74
- edges: result.edges.map(formatEdge),
75
- };
76
- }
77
- /** Clamp a numeric input to a safe integer range. */
78
- function clampInt(value, min, max, defaultValue) {
79
- if (value === undefined) {
80
- return defaultValue;
81
- }
82
- return Math.max(min, Math.min(max, Math.floor(value)));
83
- }
84
- // ---------------------------------------------------------------------------
85
- // Tool definitions
86
- // ---------------------------------------------------------------------------
87
- /** Knowledge graph MCP tools. */
88
- export const knowledgeTools = [
89
- {
90
- name: "knowledge_search",
91
- group: "knowledge",
92
- description: "Search the knowledge graph using natural language. Returns relevant nodes " +
93
- "(decisions, insights, task references, findings) ranked by semantic similarity.",
94
- inputSchema: z.object({
95
- query: z.string().describe("Natural language search query"),
96
- limit: z
97
- .number()
98
- .int()
99
- .min(1)
100
- .max(MAX_SEARCH_LIMIT)
101
- .optional()
102
- .describe(`Maximum number of results to return (default 10, max ${MAX_SEARCH_LIMIT})`),
103
- workspaceId: z
104
- .string()
105
- .optional()
106
- .describe("Filter results to a specific workspace"),
107
- expand: z
108
- .boolean()
109
- .optional()
110
- .describe("If true, also return nodes connected to the search results (default false)"),
111
- expandDepth: z
112
- .number()
113
- .int()
114
- .min(1)
115
- .max(MAX_EXPAND_DEPTH)
116
- .optional()
117
- .describe(`How many hops to traverse when expanding (default 1, max ${MAX_EXPAND_DEPTH})`),
118
- }),
119
- rpcMethod: "knowledgeSearch",
120
- mutating: false,
121
- annotations: {
122
- readOnlyHint: true,
123
- destructiveHint: false,
124
- idempotentHint: true,
125
- openWorldHint: false,
126
- },
127
- async handler(args, client, authContext) {
128
- const { query, limit, workspaceId, expand, expandDepth, } = args;
129
- // For scoped callers, always use the auth context workspace.
130
- const resolvedWorkspaceId = authContext?.type === "scoped"
131
- ? authContext.workspaceId ?? ""
132
- : workspaceId ?? "";
133
- const safeLimit = clampInt(limit, 1, MAX_SEARCH_LIMIT, 10);
134
- const response = await client.searchKnowledge({
135
- query,
136
- limit: safeLimit,
137
- workspaceId: resolvedWorkspaceId,
138
- });
139
- const formattedResults = response.results.map(formatSearchResult);
140
- let neighbors;
141
- let neighborEdges;
142
- if (expand && response.results.length > 0) {
143
- // Expand each result node via gRPC
144
- const safeDepth = clampInt(expandDepth, 1, MAX_EXPAND_DEPTH, 1);
145
- const allNeighbors = new Map();
146
- const allEdges = [];
147
- const startIds = new Set(response.results.map((r) => r.node?.id ?? "").filter(Boolean));
148
- for (const result of response.results) {
149
- if (!result.node) {
150
- continue;
151
- }
152
- const expansion = await client.expandKnowledgeNode({
153
- id: result.node.id,
154
- depth: safeDepth,
155
- });
156
- for (const node of expansion.nodes) {
157
- if (!startIds.has(node.id)) {
158
- allNeighbors.set(node.id, formatNode(node));
159
- }
160
- }
161
- for (const edge of expansion.edges) {
162
- allEdges.push(formatEdge(edge));
163
- }
164
- }
165
- neighbors = [...allNeighbors.values()];
166
- neighborEdges = allEdges;
167
- // Filter expanded neighbors to the caller's workspace for scoped callers.
168
- if (authContext?.type === "scoped") {
169
- const allowedWorkspaceId = authContext.workspaceId ?? "";
170
- const allowedIds = new Set();
171
- neighbors = neighbors.filter((n) => {
172
- const allowed = n.workspaceId === allowedWorkspaceId;
173
- if (allowed) {
174
- allowedIds.add(n.id);
175
- }
176
- return allowed;
177
- });
178
- const allowedEdgeNodeIds = new Set([
179
- ...startIds,
180
- ...allowedIds,
181
- ]);
182
- neighborEdges = neighborEdges.filter((e) => allowedEdgeNodeIds.has(e.fromId) && allowedEdgeNodeIds.has(e.toId));
183
- }
184
- }
185
- return jsonResult({
186
- results: formattedResults,
187
- ...(neighbors !== undefined ? { neighbors, neighborEdges } : {}),
188
- });
189
- },
190
- },
191
- {
192
- name: "knowledge_get_node",
193
- group: "knowledge",
194
- description: "Retrieve a specific node from the knowledge graph by its ID, " +
195
- "including all edges connecting it to other nodes.",
196
- inputSchema: z.object({
197
- id: z.string().describe("The node ID to retrieve"),
198
- expand: z
199
- .boolean()
200
- .optional()
201
- .describe("If true, also return neighbor nodes within expandDepth hops (default false)"),
202
- expandDepth: z
203
- .number()
204
- .int()
205
- .min(1)
206
- .max(MAX_EXPAND_DEPTH)
207
- .optional()
208
- .describe(`How many hops to traverse when expanding (default 1, max ${MAX_EXPAND_DEPTH})`),
209
- }),
210
- rpcMethod: "knowledgeGetNode",
211
- mutating: false,
212
- annotations: {
213
- readOnlyHint: true,
214
- destructiveHint: false,
215
- idempotentHint: true,
216
- openWorldHint: false,
217
- },
218
- async handler(args, client, authContext) {
219
- const { id, expand, expandDepth } = args;
220
- const response = await client.getKnowledgeNode({ id });
221
- if (!response.node) {
222
- return {
223
- content: [
224
- {
225
- type: "text",
226
- text: JSON.stringify({ error: `Node not found: ${id}` }, null, 2),
227
- },
228
- ],
229
- isError: true,
230
- };
231
- }
232
- // For scoped callers, deny access to nodes outside their workspace.
233
- // Return "not found" to avoid leaking that the node exists.
234
- if (authContext?.type === "scoped") {
235
- if (response.node.workspaceId !== (authContext.workspaceId ?? "")) {
236
- return {
237
- content: [
238
- {
239
- type: "text",
240
- text: JSON.stringify({ error: `Node not found: ${id}` }, null, 2),
241
- },
242
- ],
243
- isError: true,
244
- };
245
- }
246
- }
247
- const result = {
248
- node: formatNode(response.node),
249
- edges: response.edges.map(formatEdge),
250
- };
251
- if (expand) {
252
- const safeDepth = clampInt(expandDepth, 1, MAX_EXPAND_DEPTH, 1);
253
- const expansion = await client.expandKnowledgeNode({ id, depth: safeDepth });
254
- let expandedNodes = expansion.nodes.map(formatNode);
255
- let expandedEdges = expansion.edges.map(formatEdge);
256
- // Filter expanded neighbors to the caller's workspace for scoped callers.
257
- if (authContext?.type === "scoped") {
258
- const allowedWorkspaceId = authContext.workspaceId ?? "";
259
- const allowedIds = new Set([id]);
260
- expandedNodes = expandedNodes.filter((n) => {
261
- const allowed = n.workspaceId === allowedWorkspaceId;
262
- if (allowed) {
263
- allowedIds.add(n.id);
264
- }
265
- return allowed;
266
- });
267
- expandedEdges = expandedEdges.filter((e) => allowedIds.has(e.fromId) && allowedIds.has(e.toId));
268
- }
269
- result.neighbors = expandedNodes;
270
- result.neighborEdges = expandedEdges;
271
- }
272
- return jsonResult(result);
273
- },
274
- },
275
- {
276
- name: "knowledge_create_node",
277
- group: "knowledge",
278
- description: "Create a new knowledge entry (decision, insight, concept, or snippet). " +
279
- "The content is automatically embedded for future semantic search. " +
280
- "Optionally link it to existing nodes.",
281
- inputSchema: z.object({
282
- title: z.string().describe("Title or summary of the knowledge entry"),
283
- content: z
284
- .string()
285
- .describe("Full content to store and embed for search"),
286
- category: z
287
- .string()
288
- .optional()
289
- .describe("Category: decision, insight, concept, snippet (default: insight)"),
290
- tags: z
291
- .array(z.string())
292
- .optional()
293
- .describe("Tags for categorization"),
294
- workspaceId: z
295
- .string()
296
- .optional()
297
- .describe("Workspace to scope this entry to"),
298
- edges: z
299
- .array(z.object({
300
- toId: z.string().describe("ID of the node to link to"),
301
- type: z
302
- .enum(EDGE_TYPES)
303
- .describe("Relationship type: RELATES_TO, DEPENDS_ON, DERIVED_FROM, MENTIONS, PART_OF"),
304
- }))
305
- .optional()
306
- .describe("Edges to create from this node to existing nodes"),
307
- }),
308
- rpcMethod: "knowledgeCreateNode",
309
- mutating: true,
310
- annotations: {
311
- readOnlyHint: false,
312
- destructiveHint: false,
313
- idempotentHint: false,
314
- openWorldHint: false,
315
- },
316
- async handler(args, client, authContext) {
317
- const { title, content, category, tags, workspaceId, } = args;
318
- // For scoped callers, always use the auth context workspace.
319
- const resolvedWorkspaceId = authContext?.type === "scoped"
320
- ? authContext.workspaceId ?? ""
321
- : workspaceId ?? "";
322
- const response = await client.createKnowledgeNode({
323
- title,
324
- content,
325
- category: category ?? "insight",
326
- tags: tags ?? [],
327
- workspaceId: resolvedWorkspaceId,
328
- });
329
- // Note: edge creation is now handled server-side or as a follow-up.
330
- // The gRPC CreateKnowledgeNode endpoint creates the node; edges
331
- // can be added in a future enhancement.
332
- return jsonResult({
333
- id: response.id,
334
- title,
335
- category: category ?? "insight",
336
- });
337
- },
338
- },
339
- ];
340
- //# sourceMappingURL=knowledge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../src/tools/knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,sCAAsC;AACtC,MAAM,gBAAgB,GAAW,EAAE,CAAC;AAEpC,uCAAuC;AACvC,MAAM,gBAAgB,GAAW,CAAC,CAAC;AAEnC,8BAA8B;AAC9B,MAAM,UAAU,GAAG;IACjB,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,UAAU;IACV,SAAS;CACD,CAAC;AAEX,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E,iDAAiD;AACjD,SAAS,UAAU,CAAC,IAAgC;IAClD,MAAM,IAAI,GAA4B;QACpC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,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