@intangle/mcp-server 1.1.0 → 1.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.
- package/dist/index.js +32 -3
- package/index.ts +35 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ import fetch from "node-fetch";
|
|
|
7
7
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
8
8
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
9
|
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
+
import { readFileSync } from 'fs';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { dirname, join } from 'path';
|
|
10
13
|
// Load environment variables from .env and .env.local
|
|
11
14
|
config({ quiet: true });
|
|
12
15
|
config({ path: ".env.local", quiet: true });
|
|
@@ -20,9 +23,10 @@ if (!MCP_API_KEY) {
|
|
|
20
23
|
process.exit(1);
|
|
21
24
|
}
|
|
22
25
|
console.log("Intangle MCP Server starting - connecting to", API_BASE_URL);
|
|
23
|
-
// Version checking
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
+
// Version checking - automatically read from package.json
|
|
27
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
28
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
29
|
+
const CURRENT_VERSION = packageJson.version;
|
|
26
30
|
let latestVersion = null;
|
|
27
31
|
let versionCheckDone = false;
|
|
28
32
|
async function checkVersion() {
|
|
@@ -185,6 +189,24 @@ const TOOLS = [
|
|
|
185
189
|
required: ["space_id"],
|
|
186
190
|
},
|
|
187
191
|
},
|
|
192
|
+
{
|
|
193
|
+
name: "fetch",
|
|
194
|
+
description: "Fetch complete items (context or tasks) by ID. Accepts single ID or array of IDs. Returns BOTH context (Memory nodes) and tasks (Task nodes) with full content, topics, and metadata. Always returns full content (never summaries). Use this after getting summaries from search/list/start to retrieve full details for specific items.",
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
id: {
|
|
199
|
+
type: "string",
|
|
200
|
+
description: "Single ID to fetch (context or task ID like 'mem_123' or 'task_456')",
|
|
201
|
+
},
|
|
202
|
+
ids: {
|
|
203
|
+
type: "array",
|
|
204
|
+
items: { type: "string" },
|
|
205
|
+
description: "Array of IDs to fetch (mix of context and task IDs). Use this to fetch multiple items in one call.",
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
188
210
|
{
|
|
189
211
|
name: "get_entities",
|
|
190
212
|
description: "Get extracted entities (people, places, concepts) from CONTEXT items (general information). If no memory_id provided, returns top 20 most frequently mentioned entities across all context. WARNING: This tool can return large responses - use sparingly and only when entity information is specifically needed.",
|
|
@@ -631,6 +653,10 @@ async function handleGetRecentMemories(args) {
|
|
|
631
653
|
limit,
|
|
632
654
|
});
|
|
633
655
|
}
|
|
656
|
+
async function handleFetch(args) {
|
|
657
|
+
const { id, ids } = args;
|
|
658
|
+
return makeApiCall("fetch", { id, ids });
|
|
659
|
+
}
|
|
634
660
|
async function handleGetEntities(args) {
|
|
635
661
|
const { memory_id } = args;
|
|
636
662
|
return makeApiCall("get-entities", { memory_id });
|
|
@@ -699,6 +725,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
699
725
|
case "get_recent_memories":
|
|
700
726
|
result = await handleGetRecentMemories(args);
|
|
701
727
|
break;
|
|
728
|
+
case "fetch":
|
|
729
|
+
result = await handleFetch(args);
|
|
730
|
+
break;
|
|
702
731
|
case "get_entities":
|
|
703
732
|
result = await handleGetEntities(args);
|
|
704
733
|
break;
|
package/index.ts
CHANGED
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
ListToolsRequestSchema,
|
|
15
15
|
McpError,
|
|
16
16
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
17
|
+
import { readFileSync } from 'fs';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
19
|
+
import { dirname, join } from 'path';
|
|
17
20
|
|
|
18
21
|
// Load environment variables from .env and .env.local
|
|
19
22
|
config({ quiet: true });
|
|
@@ -33,9 +36,10 @@ if (!MCP_API_KEY) {
|
|
|
33
36
|
|
|
34
37
|
console.log("Intangle MCP Server starting - connecting to", API_BASE_URL);
|
|
35
38
|
|
|
36
|
-
// Version checking
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
+
// Version checking - automatically read from package.json
|
|
40
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
42
|
+
const CURRENT_VERSION = packageJson.version;
|
|
39
43
|
let latestVersion: string | null = null;
|
|
40
44
|
let versionCheckDone = false;
|
|
41
45
|
|
|
@@ -217,6 +221,25 @@ const TOOLS = [
|
|
|
217
221
|
required: ["space_id"],
|
|
218
222
|
},
|
|
219
223
|
},
|
|
224
|
+
{
|
|
225
|
+
name: "fetch",
|
|
226
|
+
description:
|
|
227
|
+
"Fetch complete items (context or tasks) by ID. Accepts single ID or array of IDs. Returns BOTH context (Memory nodes) and tasks (Task nodes) with full content, topics, and metadata. Always returns full content (never summaries). Use this after getting summaries from search/list/start to retrieve full details for specific items.",
|
|
228
|
+
inputSchema: {
|
|
229
|
+
type: "object",
|
|
230
|
+
properties: {
|
|
231
|
+
id: {
|
|
232
|
+
type: "string",
|
|
233
|
+
description: "Single ID to fetch (context or task ID like 'mem_123' or 'task_456')",
|
|
234
|
+
},
|
|
235
|
+
ids: {
|
|
236
|
+
type: "array",
|
|
237
|
+
items: { type: "string" },
|
|
238
|
+
description: "Array of IDs to fetch (mix of context and task IDs). Use this to fetch multiple items in one call.",
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
220
243
|
{
|
|
221
244
|
name: "get_entities",
|
|
222
245
|
description:
|
|
@@ -706,6 +729,12 @@ async function handleGetRecentMemories(args: any) {
|
|
|
706
729
|
});
|
|
707
730
|
}
|
|
708
731
|
|
|
732
|
+
async function handleFetch(args: any) {
|
|
733
|
+
const { id, ids } = args as { id?: string; ids?: string[] };
|
|
734
|
+
|
|
735
|
+
return makeApiCall("fetch", { id, ids });
|
|
736
|
+
}
|
|
737
|
+
|
|
709
738
|
async function handleGetEntities(args: any) {
|
|
710
739
|
const { memory_id } = args as { memory_id?: string };
|
|
711
740
|
|
|
@@ -799,6 +828,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
|
|
|
799
828
|
case "get_recent_memories":
|
|
800
829
|
result = await handleGetRecentMemories(args);
|
|
801
830
|
break;
|
|
831
|
+
case "fetch":
|
|
832
|
+
result = await handleFetch(args);
|
|
833
|
+
break;
|
|
802
834
|
case "get_entities":
|
|
803
835
|
result = await handleGetEntities(args);
|
|
804
836
|
break;
|