@naumu/mcp 0.1.5 → 0.2.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/dist/tools/ask.js
CHANGED
|
@@ -2,14 +2,16 @@ import { z } from 'zod';
|
|
|
2
2
|
export function registerAsk(server, client) {
|
|
3
3
|
server.registerTool('naumu_ask', {
|
|
4
4
|
title: 'Ask AI',
|
|
5
|
-
description: '
|
|
5
|
+
description: 'Send a message to the Naumu AI agent. Use for adding knowledge, making changes, asking questions, or reporting status updates. Always returns immediately with a threadId — the AI processes the request in the background. Depending on complexity, the agent may take anywhere from a few seconds to a few minutes to finish.\n\n' +
|
|
6
|
+
'**For reports and status updates** (e.g. "mark task X as done", "record a deployment"): fire and forget — no need to check the response.\n\n' +
|
|
7
|
+
'**For questions that need an answer**: after calling this tool, poll with `naumu_get_ai_thread` using the returned threadId until the AI response is ready.',
|
|
6
8
|
inputSchema: z.object({
|
|
7
9
|
graphId: z.string().describe('The graph ID to query against'),
|
|
8
|
-
question: z.string().describe('Your
|
|
10
|
+
question: z.string().describe('Your message to the Naumu AI agent'),
|
|
9
11
|
threadId: z
|
|
10
12
|
.string()
|
|
11
13
|
.optional()
|
|
12
|
-
.describe('Thread ID for follow-up
|
|
14
|
+
.describe('Thread ID for follow-up messages (omit for new conversation)'),
|
|
13
15
|
}),
|
|
14
16
|
}, async ({ graphId, question, threadId }) => {
|
|
15
17
|
// Create a new thread if none provided
|
|
@@ -17,58 +19,19 @@ export function registerAsk(server, client) {
|
|
|
17
19
|
const thread = (await client.post('/api/threads', { graphId }));
|
|
18
20
|
threadId = thread.id;
|
|
19
21
|
}
|
|
20
|
-
// Post the
|
|
21
|
-
|
|
22
|
+
// Post the message — returns immediately, AI processes in background
|
|
23
|
+
await client.post(`/api/threads/${threadId}/messages`, {
|
|
22
24
|
content: question,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const result = (await client.get(`/api/threads/${threadId}/messages`));
|
|
26
|
-
const aiMessages = result.messages.filter((m) => m.isAI);
|
|
27
|
-
const lastAI = aiMessages[aiMessages.length - 1];
|
|
28
|
-
let responseText = lastAI?.content || 'No response received';
|
|
29
|
-
// If content is TipTap JSON, extract plain text
|
|
30
|
-
if (lastAI?.contentFormat === 'tiptap') {
|
|
31
|
-
try {
|
|
32
|
-
responseText = extractPlainText(JSON.parse(responseText));
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
// Keep as-is if parsing fails
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const response = { threadId, response: responseText };
|
|
39
|
-
if (postResult.diffId) {
|
|
40
|
-
response.pendingDiff = {
|
|
41
|
-
diffId: postResult.diffId,
|
|
42
|
-
status: 'pending_approval',
|
|
43
|
-
note: 'Graph changes were proposed but not yet applied. The user must accept or reject the diff in the Naumu UI.',
|
|
44
|
-
};
|
|
45
|
-
}
|
|
25
|
+
async: true,
|
|
26
|
+
});
|
|
46
27
|
return {
|
|
47
28
|
content: [
|
|
48
29
|
{
|
|
49
30
|
type: 'text',
|
|
50
|
-
text: JSON.stringify(
|
|
31
|
+
text: JSON.stringify({ threadId, status: 'processing' }, null, 2),
|
|
51
32
|
},
|
|
52
33
|
],
|
|
53
34
|
};
|
|
54
35
|
});
|
|
55
36
|
}
|
|
56
|
-
function extractPlainText(node) {
|
|
57
|
-
const parts = [];
|
|
58
|
-
function walk(n) {
|
|
59
|
-
if (n.type === 'text' && n.text) {
|
|
60
|
-
parts.push(n.text);
|
|
61
|
-
}
|
|
62
|
-
if (Array.isArray(n.content)) {
|
|
63
|
-
for (const child of n.content) {
|
|
64
|
-
walk(child);
|
|
65
|
-
}
|
|
66
|
-
if (['paragraph', 'heading', 'blockquote', 'listItem'].includes(n.type)) {
|
|
67
|
-
parts.push('\n');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
walk(node);
|
|
72
|
-
return parts.join('').trim();
|
|
73
|
-
}
|
|
74
37
|
//# sourceMappingURL=ask.js.map
|
package/dist/tools/ask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../../src/tools/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,MAAmB;IACjE,MAAM,CAAC,YAAY,CAClB,WAAW,EACX;QACC,KAAK,EAAE,QAAQ;QACf,WAAW,EACV,
|
|
1
|
+
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../../src/tools/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,MAAmB;IACjE,MAAM,CAAC,YAAY,CAClB,WAAW,EACX;QACC,KAAK,EAAE,QAAQ;QACf,WAAW,EACV,qUAAqU;YACrU,8IAA8I;YAC9I,6JAA6J;QAC9J,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;YAC7D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;YACnE,QAAQ,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,8DAA8D,CAAC;SAC1E,CAAC;KACF,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzC,uCAAuC;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,CAAC,CAAmB,CAAC;YAClF,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;QACtB,CAAC;QAED,qEAAqE;QACrE,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,QAAQ,WAAW,EAAE;YACtD,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACjE;aACD;SACD,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC"}
|
|
@@ -2,9 +2,11 @@ import { z } from 'zod';
|
|
|
2
2
|
export function registerGetAiThread(server, client) {
|
|
3
3
|
server.registerTool('naumu_get_ai_thread', {
|
|
4
4
|
title: 'Get AI Thread',
|
|
5
|
-
description: 'Retrieve messages from
|
|
5
|
+
description: 'Retrieve messages from an AI conversation thread. Use to read the AI response after a `naumu_ask` call.\n\n' +
|
|
6
|
+
'The last AI message has a `status` field: `"processing"` means the AI is still working, `"complete"` means the response is ready. ' +
|
|
7
|
+
'If still processing, wait a few seconds and try again.',
|
|
6
8
|
inputSchema: z.object({
|
|
7
|
-
threadId: z.string().describe('The thread ID'),
|
|
9
|
+
threadId: z.string().describe('The thread ID returned by naumu_ask'),
|
|
8
10
|
}),
|
|
9
11
|
}, async ({ threadId }) => {
|
|
10
12
|
const data = await client.get(`/api/threads/${threadId}/messages`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ai-thread.js","sourceRoot":"","sources":["../../src/tools/get-ai-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAmB;IACzE,MAAM,CAAC,YAAY,CAClB,qBAAqB,EACrB;QACC,KAAK,EAAE,eAAe;QACtB,WAAW,
|
|
1
|
+
{"version":3,"file":"get-ai-thread.js","sourceRoot":"","sources":["../../src/tools/get-ai-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAmB;IACzE,MAAM,CAAC,YAAY,CAClB,qBAAqB,EACrB;QACC,KAAK,EAAE,eAAe;QACtB,WAAW,EACV,6GAA6G;YAC7G,oIAAoI;YACpI,wDAAwD;QACzD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;SACpE,CAAC;KACF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,QAAQ,WAAW,CAAC,CAAC;QACnE,OAAO;YACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;SACzE,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naumu/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MCP server for Naumu – access your knowledge graph from Claude Code, Cursor, and other AI coding agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Naumu <hello@naumu.ai>",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"@types/node": "*",
|
|
50
50
|
"jest": "^30.3.0",
|
|
51
51
|
"ts-jest": "^29.4.6",
|
|
52
|
-
"typescript": "
|
|
52
|
+
"typescript": "^5.9.3"
|
|
53
53
|
}
|
|
54
54
|
}
|