@intangle/mcp-server 1.1.2 → 1.1.4
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 +40 -10
- package/index.ts +91 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,9 +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
|
|
11
|
-
import { fileURLToPath } from
|
|
12
|
-
import { dirname, join } from
|
|
10
|
+
import { readFileSync } from "fs";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { dirname, join } from "path";
|
|
13
13
|
// Load environment variables from .env and .env.local
|
|
14
14
|
config({ quiet: true });
|
|
15
15
|
config({ path: ".env.local", quiet: true });
|
|
@@ -25,7 +25,7 @@ if (!MCP_API_KEY) {
|
|
|
25
25
|
console.log("Intangle MCP Server starting - connecting to", API_BASE_URL);
|
|
26
26
|
// Version checking - automatically read from package.json
|
|
27
27
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
28
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname,
|
|
28
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
29
29
|
const CURRENT_VERSION = packageJson.version;
|
|
30
30
|
let latestVersion = null;
|
|
31
31
|
let versionCheckDone = false;
|
|
@@ -34,7 +34,7 @@ async function checkVersion() {
|
|
|
34
34
|
return;
|
|
35
35
|
try {
|
|
36
36
|
const response = await fetch("https://registry.npmjs.org/@intangle/mcp-server/latest");
|
|
37
|
-
const data = await response.json();
|
|
37
|
+
const data = (await response.json());
|
|
38
38
|
latestVersion = data.version;
|
|
39
39
|
versionCheckDone = true;
|
|
40
40
|
if (latestVersion && latestVersion !== CURRENT_VERSION) {
|
|
@@ -60,6 +60,7 @@ async function makeApiCall(endpoint, data) {
|
|
|
60
60
|
headers: {
|
|
61
61
|
"Content-Type": "application/json",
|
|
62
62
|
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
63
|
+
"User-Agent": "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
63
64
|
},
|
|
64
65
|
body: JSON.stringify(data),
|
|
65
66
|
});
|
|
@@ -375,7 +376,12 @@ const TOOLS = [
|
|
|
375
376
|
},
|
|
376
377
|
status: {
|
|
377
378
|
type: "string",
|
|
378
|
-
enum: [
|
|
379
|
+
enum: [
|
|
380
|
+
"pending",
|
|
381
|
+
"in_progress",
|
|
382
|
+
"completed",
|
|
383
|
+
"invalidated",
|
|
384
|
+
],
|
|
379
385
|
description: "Subtask status (default: pending)",
|
|
380
386
|
default: "pending",
|
|
381
387
|
},
|
|
@@ -413,7 +419,12 @@ const TOOLS = [
|
|
|
413
419
|
},
|
|
414
420
|
status: {
|
|
415
421
|
type: "string",
|
|
416
|
-
enum: [
|
|
422
|
+
enum: [
|
|
423
|
+
"pending",
|
|
424
|
+
"in_progress",
|
|
425
|
+
"completed",
|
|
426
|
+
"invalidated",
|
|
427
|
+
],
|
|
417
428
|
description: "Task status (default: pending)",
|
|
418
429
|
default: "pending",
|
|
419
430
|
},
|
|
@@ -447,7 +458,12 @@ const TOOLS = [
|
|
|
447
458
|
},
|
|
448
459
|
status: {
|
|
449
460
|
type: "string",
|
|
450
|
-
enum: [
|
|
461
|
+
enum: [
|
|
462
|
+
"pending",
|
|
463
|
+
"in_progress",
|
|
464
|
+
"completed",
|
|
465
|
+
"invalidated",
|
|
466
|
+
],
|
|
451
467
|
description: "Subtask status (default: pending)",
|
|
452
468
|
default: "pending",
|
|
453
469
|
},
|
|
@@ -597,7 +613,12 @@ const TOOLS = [
|
|
|
597
613
|
},
|
|
598
614
|
status: {
|
|
599
615
|
type: "string",
|
|
600
|
-
enum: [
|
|
616
|
+
enum: [
|
|
617
|
+
"pending",
|
|
618
|
+
"in_progress",
|
|
619
|
+
"completed",
|
|
620
|
+
"invalidated",
|
|
621
|
+
],
|
|
601
622
|
description: "Task status (default: pending)",
|
|
602
623
|
default: "pending",
|
|
603
624
|
},
|
|
@@ -931,8 +952,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
931
952
|
default:
|
|
932
953
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
933
954
|
}
|
|
955
|
+
// Extract response field for Layer 2 compressed tools, otherwise stringify full result
|
|
956
|
+
let responseText;
|
|
957
|
+
if (result && typeof result === 'object' && 'response' in result && typeof result.response === 'string') {
|
|
958
|
+
// Tool has Layer 2 compression - use the formatted response field
|
|
959
|
+
responseText = result.response;
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
// Standard tool - return full JSON
|
|
963
|
+
responseText = JSON.stringify(result, null, 2);
|
|
964
|
+
}
|
|
934
965
|
// Add version warning to response if outdated
|
|
935
|
-
let responseText = JSON.stringify(result, null, 2);
|
|
936
966
|
if (latestVersion && latestVersion !== CURRENT_VERSION) {
|
|
937
967
|
const warning = `\n\n⚠️ UPDATE AVAILABLE: MCP Server v${latestVersion} is available (you're on v${CURRENT_VERSION}). Update with: npx @intangle/mcp-server@latest`;
|
|
938
968
|
responseText += warning;
|
package/index.ts
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
ListToolsRequestSchema,
|
|
15
15
|
McpError,
|
|
16
16
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
17
|
-
import { readFileSync } from
|
|
18
|
-
import { fileURLToPath } from
|
|
19
|
-
import { dirname, join } from
|
|
17
|
+
import { readFileSync } from "fs";
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
19
|
+
import { dirname, join } from "path";
|
|
20
20
|
|
|
21
21
|
// Load environment variables from .env and .env.local
|
|
22
22
|
config({ quiet: true });
|
|
@@ -30,7 +30,9 @@ const MCP_API_KEY = process.env.MCP_API_KEY;
|
|
|
30
30
|
|
|
31
31
|
if (!MCP_API_KEY) {
|
|
32
32
|
console.error("Error: MCP_API_KEY environment variable is required");
|
|
33
|
-
console.error(
|
|
33
|
+
console.error(
|
|
34
|
+
"Please set your Intangle API key in the Claude Desktop configuration",
|
|
35
|
+
);
|
|
34
36
|
process.exit(1);
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -38,7 +40,9 @@ console.log("Intangle MCP Server starting - connecting to", API_BASE_URL);
|
|
|
38
40
|
|
|
39
41
|
// Version checking - automatically read from package.json
|
|
40
42
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
41
|
-
const packageJson = JSON.parse(
|
|
43
|
+
const packageJson = JSON.parse(
|
|
44
|
+
readFileSync(join(__dirname, "../package.json"), "utf-8"),
|
|
45
|
+
);
|
|
42
46
|
const CURRENT_VERSION = packageJson.version;
|
|
43
47
|
let latestVersion: string | null = null;
|
|
44
48
|
let versionCheckDone = false;
|
|
@@ -47,8 +51,10 @@ async function checkVersion() {
|
|
|
47
51
|
if (versionCheckDone) return;
|
|
48
52
|
|
|
49
53
|
try {
|
|
50
|
-
const response = await fetch(
|
|
51
|
-
|
|
54
|
+
const response = await fetch(
|
|
55
|
+
"https://registry.npmjs.org/@intangle/mcp-server/latest",
|
|
56
|
+
);
|
|
57
|
+
const data = (await response.json()) as { version: string };
|
|
52
58
|
latestVersion = data.version;
|
|
53
59
|
versionCheckDone = true;
|
|
54
60
|
|
|
@@ -75,6 +81,7 @@ async function makeApiCall(endpoint: string, data: any) {
|
|
|
75
81
|
headers: {
|
|
76
82
|
"Content-Type": "application/json",
|
|
77
83
|
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
84
|
+
"User-Agent": "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
78
85
|
},
|
|
79
86
|
body: JSON.stringify(data),
|
|
80
87
|
});
|
|
@@ -159,7 +166,8 @@ const TOOLS = [
|
|
|
159
166
|
},
|
|
160
167
|
},
|
|
161
168
|
],
|
|
162
|
-
description:
|
|
169
|
+
description:
|
|
170
|
+
"Single memory object or array of memory objects to create",
|
|
163
171
|
},
|
|
164
172
|
},
|
|
165
173
|
required: ["space_id", "memories"],
|
|
@@ -230,12 +238,14 @@ const TOOLS = [
|
|
|
230
238
|
properties: {
|
|
231
239
|
id: {
|
|
232
240
|
type: "string",
|
|
233
|
-
description:
|
|
241
|
+
description:
|
|
242
|
+
"Single ID to fetch (context or task ID like 'mem_123' or 'task_456')",
|
|
234
243
|
},
|
|
235
244
|
ids: {
|
|
236
245
|
type: "array",
|
|
237
246
|
items: { type: "string" },
|
|
238
|
-
description:
|
|
247
|
+
description:
|
|
248
|
+
"Array of IDs to fetch (mix of context and task IDs). Use this to fetch multiple items in one call.",
|
|
239
249
|
},
|
|
240
250
|
},
|
|
241
251
|
},
|
|
@@ -249,14 +259,16 @@ const TOOLS = [
|
|
|
249
259
|
properties: {
|
|
250
260
|
memory_id: {
|
|
251
261
|
type: "string",
|
|
252
|
-
description:
|
|
262
|
+
description:
|
|
263
|
+
"Memory ID to get entities for. RECOMMENDED: Always provide memory_id to get focused results.",
|
|
253
264
|
},
|
|
254
265
|
},
|
|
255
266
|
},
|
|
256
267
|
},
|
|
257
268
|
{
|
|
258
269
|
name: "delete_memory",
|
|
259
|
-
description:
|
|
270
|
+
description:
|
|
271
|
+
"Delete one or more CONTEXT items (general information). For deleting tasks, use delete_task instead. Accepts a single memory ID or an array of memory IDs for batch deletion.",
|
|
260
272
|
inputSchema: {
|
|
261
273
|
type: "object",
|
|
262
274
|
properties: {
|
|
@@ -296,23 +308,28 @@ const TOOLS = [
|
|
|
296
308
|
properties: {
|
|
297
309
|
name: {
|
|
298
310
|
type: "string",
|
|
299
|
-
description:
|
|
311
|
+
description:
|
|
312
|
+
"Name for the space (e.g., 'Work', 'Personal', 'Project X')",
|
|
300
313
|
},
|
|
301
314
|
description: {
|
|
302
315
|
type: "string",
|
|
303
|
-
description:
|
|
316
|
+
description:
|
|
317
|
+
"Brief description of what this space is for (e.g., 'Work-related context and tasks')",
|
|
304
318
|
},
|
|
305
319
|
startup_context: {
|
|
306
320
|
type: "string",
|
|
307
|
-
description:
|
|
321
|
+
description:
|
|
322
|
+
"Context and keywords provided to AI when starting this space. Include role, preferences, common tasks, and relevant search terms. This helps the AI understand what information to prioritize from memory.",
|
|
308
323
|
},
|
|
309
324
|
startup_preferences: {
|
|
310
325
|
type: "string",
|
|
311
|
-
description:
|
|
326
|
+
description:
|
|
327
|
+
"AI behavior preferences for this space. Guides how the AI should interact and respond when working in this context (e.g., 'Be concise and technical', 'Focus on creative solutions').",
|
|
312
328
|
},
|
|
313
329
|
include_tasks: {
|
|
314
330
|
type: "boolean",
|
|
315
|
-
description:
|
|
331
|
+
description:
|
|
332
|
+
"Whether to automatically retrieve pending/in-progress tasks when running the 'start' tool for this space",
|
|
316
333
|
default: false,
|
|
317
334
|
},
|
|
318
335
|
},
|
|
@@ -393,7 +410,8 @@ const TOOLS = [
|
|
|
393
410
|
},
|
|
394
411
|
parent_id: {
|
|
395
412
|
type: "string",
|
|
396
|
-
description:
|
|
413
|
+
description:
|
|
414
|
+
"Optional parent task ID to create this as a subtask. Use an existing task's ID (format: task_TIMESTAMP_ID) to nest this task under it. Use list_tasks to find parent task IDs. If omitted, creates a top-level task. NOTE: Use 'subtasks' array instead for creating parent+children in one call.",
|
|
397
415
|
},
|
|
398
416
|
subtasks: {
|
|
399
417
|
type: "array",
|
|
@@ -415,7 +433,12 @@ const TOOLS = [
|
|
|
415
433
|
},
|
|
416
434
|
status: {
|
|
417
435
|
type: "string",
|
|
418
|
-
enum: [
|
|
436
|
+
enum: [
|
|
437
|
+
"pending",
|
|
438
|
+
"in_progress",
|
|
439
|
+
"completed",
|
|
440
|
+
"invalidated",
|
|
441
|
+
],
|
|
419
442
|
description: "Subtask status (default: pending)",
|
|
420
443
|
default: "pending",
|
|
421
444
|
},
|
|
@@ -428,7 +451,8 @@ const TOOLS = [
|
|
|
428
451
|
},
|
|
429
452
|
required: ["title", "content"],
|
|
430
453
|
},
|
|
431
|
-
description:
|
|
454
|
+
description:
|
|
455
|
+
"Optional array of subtasks to create under this parent task. Each will be automatically linked to the parent.",
|
|
432
456
|
},
|
|
433
457
|
},
|
|
434
458
|
required: ["title", "content"],
|
|
@@ -453,7 +477,12 @@ const TOOLS = [
|
|
|
453
477
|
},
|
|
454
478
|
status: {
|
|
455
479
|
type: "string",
|
|
456
|
-
enum: [
|
|
480
|
+
enum: [
|
|
481
|
+
"pending",
|
|
482
|
+
"in_progress",
|
|
483
|
+
"completed",
|
|
484
|
+
"invalidated",
|
|
485
|
+
],
|
|
457
486
|
description: "Task status (default: pending)",
|
|
458
487
|
default: "pending",
|
|
459
488
|
},
|
|
@@ -466,7 +495,8 @@ const TOOLS = [
|
|
|
466
495
|
},
|
|
467
496
|
parent_id: {
|
|
468
497
|
type: "string",
|
|
469
|
-
description:
|
|
498
|
+
description:
|
|
499
|
+
"Optional parent task ID to create this as a subtask. Use an existing task's ID (format: task_TIMESTAMP_ID) to nest this task under it. Use list_tasks to find parent task IDs. If omitted, creates a top-level task. NOTE: Use 'subtasks' array instead for creating parent+children in one call.",
|
|
470
500
|
},
|
|
471
501
|
subtasks: {
|
|
472
502
|
type: "array",
|
|
@@ -488,20 +518,27 @@ const TOOLS = [
|
|
|
488
518
|
},
|
|
489
519
|
status: {
|
|
490
520
|
type: "string",
|
|
491
|
-
enum: [
|
|
521
|
+
enum: [
|
|
522
|
+
"pending",
|
|
523
|
+
"in_progress",
|
|
524
|
+
"completed",
|
|
525
|
+
"invalidated",
|
|
526
|
+
],
|
|
492
527
|
description: "Subtask status (default: pending)",
|
|
493
528
|
default: "pending",
|
|
494
529
|
},
|
|
495
530
|
priority: {
|
|
496
531
|
type: "string",
|
|
497
532
|
enum: ["urgent", "high", "medium", "low"],
|
|
498
|
-
description:
|
|
533
|
+
description:
|
|
534
|
+
"Subtask priority level (default: medium)",
|
|
499
535
|
default: "medium",
|
|
500
536
|
},
|
|
501
537
|
},
|
|
502
538
|
required: ["title", "content"],
|
|
503
539
|
},
|
|
504
|
-
description:
|
|
540
|
+
description:
|
|
541
|
+
"Optional array of subtasks to create under this parent task. Each will be automatically linked to the parent.",
|
|
505
542
|
},
|
|
506
543
|
},
|
|
507
544
|
required: ["title", "content"],
|
|
@@ -537,7 +574,8 @@ const TOOLS = [
|
|
|
537
574
|
},
|
|
538
575
|
content: {
|
|
539
576
|
type: "string",
|
|
540
|
-
description:
|
|
577
|
+
description:
|
|
578
|
+
"Context item content (general information/knowledge)",
|
|
541
579
|
},
|
|
542
580
|
topics: {
|
|
543
581
|
type: "array",
|
|
@@ -563,7 +601,8 @@ const TOOLS = [
|
|
|
563
601
|
},
|
|
564
602
|
content: {
|
|
565
603
|
type: "string",
|
|
566
|
-
description:
|
|
604
|
+
description:
|
|
605
|
+
"Context item content (general information/knowledge)",
|
|
567
606
|
},
|
|
568
607
|
topics: {
|
|
569
608
|
type: "array",
|
|
@@ -580,7 +619,8 @@ const TOOLS = [
|
|
|
580
619
|
},
|
|
581
620
|
},
|
|
582
621
|
],
|
|
583
|
-
description:
|
|
622
|
+
description:
|
|
623
|
+
"Optional context items to add (general information/knowledge)",
|
|
584
624
|
},
|
|
585
625
|
tasks: {
|
|
586
626
|
oneOf: [
|
|
@@ -640,7 +680,12 @@ const TOOLS = [
|
|
|
640
680
|
},
|
|
641
681
|
status: {
|
|
642
682
|
type: "string",
|
|
643
|
-
enum: [
|
|
683
|
+
enum: [
|
|
684
|
+
"pending",
|
|
685
|
+
"in_progress",
|
|
686
|
+
"completed",
|
|
687
|
+
"invalidated",
|
|
688
|
+
],
|
|
644
689
|
description: "Task status (default: pending)",
|
|
645
690
|
default: "pending",
|
|
646
691
|
},
|
|
@@ -668,7 +713,8 @@ const TOOLS = [
|
|
|
668
713
|
},
|
|
669
714
|
{
|
|
670
715
|
name: "update_task_status",
|
|
671
|
-
description:
|
|
716
|
+
description:
|
|
717
|
+
"Change a task's status (pending/in_progress/completed/invalidated)",
|
|
672
718
|
inputSchema: {
|
|
673
719
|
type: "object",
|
|
674
720
|
properties: {
|
|
@@ -687,7 +733,8 @@ const TOOLS = [
|
|
|
687
733
|
},
|
|
688
734
|
{
|
|
689
735
|
name: "update_task",
|
|
690
|
-
description:
|
|
736
|
+
description:
|
|
737
|
+
"Update one or more TASKS (not context/memories - use add_memory to update context by creating new versions). Accepts a single update object or an array of update objects for batch updates. Each update must include task_id.",
|
|
691
738
|
inputSchema: {
|
|
692
739
|
type: "object",
|
|
693
740
|
properties: {
|
|
@@ -780,7 +827,8 @@ const TOOLS = [
|
|
|
780
827
|
},
|
|
781
828
|
{
|
|
782
829
|
name: "delete_task",
|
|
783
|
-
description:
|
|
830
|
+
description:
|
|
831
|
+
"Delete one or more tasks in a single transaction. Accepts a single task ID or an array of task IDs for batch deletion.",
|
|
784
832
|
inputSchema: {
|
|
785
833
|
type: "object",
|
|
786
834
|
properties: {
|
|
@@ -945,9 +993,7 @@ async function handleUpdateMemory(args: any) {
|
|
|
945
993
|
}
|
|
946
994
|
|
|
947
995
|
if (!args.context && !args.tasks) {
|
|
948
|
-
throw new Error(
|
|
949
|
-
"At least one of context or tasks must be provided",
|
|
950
|
-
);
|
|
996
|
+
throw new Error("At least one of context or tasks must be provided");
|
|
951
997
|
}
|
|
952
998
|
|
|
953
999
|
// Pass through to API
|
|
@@ -1044,8 +1090,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
|
|
|
1044
1090
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
1045
1091
|
}
|
|
1046
1092
|
|
|
1093
|
+
// Extract response field for Layer 2 compressed tools, otherwise stringify full result
|
|
1094
|
+
let responseText: string;
|
|
1095
|
+
if (result && typeof result === 'object' && 'response' in result && typeof result.response === 'string') {
|
|
1096
|
+
// Tool has Layer 2 compression - use the formatted response field
|
|
1097
|
+
responseText = result.response;
|
|
1098
|
+
} else {
|
|
1099
|
+
// Standard tool - return full JSON
|
|
1100
|
+
responseText = JSON.stringify(result, null, 2);
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1047
1103
|
// Add version warning to response if outdated
|
|
1048
|
-
let responseText = JSON.stringify(result, null, 2);
|
|
1049
1104
|
if (latestVersion && latestVersion !== CURRENT_VERSION) {
|
|
1050
1105
|
const warning = `\n\n⚠️ UPDATE AVAILABLE: MCP Server v${latestVersion} is available (you're on v${CURRENT_VERSION}). Update with: npx @intangle/mcp-server@latest`;
|
|
1051
1106
|
responseText += warning;
|