@intangle/mcp-server 2.1.6 → 2.1.7
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 +33 -5
- package/dist/tool-definitions.js +10 -10
- package/index.ts +38 -5
- package/package.json +1 -1
- package/tool-definitions.ts +10 -10
package/dist/index.js
CHANGED
|
@@ -22,6 +22,9 @@ function log(msg) {
|
|
|
22
22
|
catch (e) { }
|
|
23
23
|
}
|
|
24
24
|
log("--- Server Starting ---");
|
|
25
|
+
// Client info captured from MCP initialize handshake
|
|
26
|
+
let mcpClientName;
|
|
27
|
+
let mcpClientVersion;
|
|
25
28
|
try {
|
|
26
29
|
// Load environment variables from .env and .env.local
|
|
27
30
|
config({ quiet: true });
|
|
@@ -76,14 +79,38 @@ try {
|
|
|
76
79
|
}
|
|
77
80
|
// Check version on startup (non-blocking)
|
|
78
81
|
checkVersion();
|
|
82
|
+
// Helper to ensure client info is captured (called before API requests)
|
|
83
|
+
function ensureClientInfo() {
|
|
84
|
+
if (!mcpClientName) {
|
|
85
|
+
const clientInfo = server.getClientVersion();
|
|
86
|
+
if (clientInfo) {
|
|
87
|
+
mcpClientName = clientInfo.name;
|
|
88
|
+
mcpClientVersion = clientInfo.version;
|
|
89
|
+
log(`Client identified (on-demand): ${mcpClientName} v${mcpClientVersion}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
79
93
|
async function makeApiCall(endpoint, data) {
|
|
94
|
+
// Ensure we have client info before making requests
|
|
95
|
+
ensureClientInfo();
|
|
96
|
+
// Build headers with client info if available
|
|
97
|
+
const headers = {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
100
|
+
"User-Agent": mcpClientName
|
|
101
|
+
? `${mcpClientName}/${mcpClientVersion || "unknown"} (mcp-stdio)`
|
|
102
|
+
: "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
103
|
+
};
|
|
104
|
+
// Add explicit client info headers for backend processing
|
|
105
|
+
if (mcpClientName) {
|
|
106
|
+
headers["X-MCP-Client-Name"] = mcpClientName;
|
|
107
|
+
}
|
|
108
|
+
if (mcpClientVersion) {
|
|
109
|
+
headers["X-MCP-Client-Version"] = mcpClientVersion;
|
|
110
|
+
}
|
|
80
111
|
const response = await fetch(`${API_BASE_URL}/api/mcp/${endpoint}`, {
|
|
81
112
|
method: "POST",
|
|
82
|
-
headers
|
|
83
|
-
"Content-Type": "application/json",
|
|
84
|
-
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
85
|
-
"User-Agent": "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
86
|
-
},
|
|
113
|
+
headers,
|
|
87
114
|
body: JSON.stringify(data),
|
|
88
115
|
});
|
|
89
116
|
if (!response.ok) {
|
|
@@ -231,6 +258,7 @@ try {
|
|
|
231
258
|
const transport = new StdioServerTransport();
|
|
232
259
|
await server.connect(transport);
|
|
233
260
|
log("Server connected to transport");
|
|
261
|
+
// Client info is captured on-demand in ensureClientInfo() before first API call
|
|
234
262
|
}
|
|
235
263
|
main().catch((err) => {
|
|
236
264
|
log(`Error in main: ${err}`);
|
package/dist/tool-definitions.js
CHANGED
|
@@ -3,7 +3,7 @@ export const TOOLS = [
|
|
|
3
3
|
{
|
|
4
4
|
name: "search",
|
|
5
5
|
title: "Search Space",
|
|
6
|
-
description: "Search for
|
|
6
|
+
description: "Search for context, tasks, and processes within a space. System automatically extracts quantity from natural language ('show 3 tasks' → 3 results, 'the last one' → 1 result) and intelligently formats results (1-3 items → summaries, 4+ items → IDs only). Use fetch tool to get full content for specific IDs when needed.",
|
|
7
7
|
inputSchema: {
|
|
8
8
|
type: "object",
|
|
9
9
|
properties: {
|
|
@@ -33,12 +33,12 @@ export const TOOLS = [
|
|
|
33
33
|
properties: {
|
|
34
34
|
id: {
|
|
35
35
|
type: "string",
|
|
36
|
-
description: "Single ID to fetch (context or task ID like 'mem_123' or 'task_456')",
|
|
36
|
+
description: "Single ID to fetch (context or task ID like 'mem_123' or 'task_456' or 'proc_789')",
|
|
37
37
|
},
|
|
38
38
|
ids: {
|
|
39
39
|
type: "array",
|
|
40
40
|
items: { type: "string" },
|
|
41
|
-
description: "Array of IDs to fetch (mix of context and
|
|
41
|
+
description: "Array of IDs to fetch (mix of context, task, and process IDs). Use this to fetch multiple items in one call.",
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
@@ -46,7 +46,7 @@ export const TOOLS = [
|
|
|
46
46
|
{
|
|
47
47
|
name: "view_topic",
|
|
48
48
|
title: "View Topic",
|
|
49
|
-
description: "View all memories and
|
|
49
|
+
description: "View all memories, tasks, and processes tagged with a specific topic. Perfect for exploring a topic area or following up on topics from the start briefing.",
|
|
50
50
|
inputSchema: {
|
|
51
51
|
type: "object",
|
|
52
52
|
properties: {
|
|
@@ -163,25 +163,25 @@ export const TOOLS = [
|
|
|
163
163
|
title: { type: "string", description: "Item title" },
|
|
164
164
|
content: {
|
|
165
165
|
type: "string",
|
|
166
|
-
description: "Item content - system automatically classifies as task (actionable)
|
|
166
|
+
description: "Item content - system automatically classifies as task (actionable), context (knowledge), or process (workflow/procedure) and suggests relevant topics",
|
|
167
167
|
},
|
|
168
168
|
},
|
|
169
169
|
required: ["title", "content"],
|
|
170
170
|
},
|
|
171
|
-
description: "Array of items to add. System intelligently: (1) classifies as task or
|
|
171
|
+
description: "Array of items to add. System intelligently: (1) classifies as task, context, or process, (2) suggests 1-3 relevant topics based on content and existing topics. Examples: 'Need to fix auth bug' → task with topics like 'authentication', 'bug-fix'. 'Learned React batches updates' → context with topics like 'react', 'learning'.",
|
|
172
172
|
},
|
|
173
173
|
},
|
|
174
174
|
},
|
|
175
175
|
update: {
|
|
176
176
|
type: "object",
|
|
177
|
-
description: "Update existing items (context or
|
|
177
|
+
description: "Update existing items (context, tasks, or processes) - system detects type from ID prefix",
|
|
178
178
|
properties: {
|
|
179
179
|
items: {
|
|
180
180
|
type: "array",
|
|
181
181
|
items: {
|
|
182
182
|
type: "object",
|
|
183
183
|
properties: {
|
|
184
|
-
id: { type: "string", description: "Item ID to update (mem_* for context, task_* for tasks)" },
|
|
184
|
+
id: { type: "string", description: "Item ID to update (mem_* for context, task_* for tasks, proc_* for processes)" },
|
|
185
185
|
title: {
|
|
186
186
|
type: "string",
|
|
187
187
|
description: "New title (optional)",
|
|
@@ -213,7 +213,7 @@ export const TOOLS = [
|
|
|
213
213
|
},
|
|
214
214
|
required: ["id"],
|
|
215
215
|
},
|
|
216
|
-
description: "Array of items to update. Type automatically detected from ID prefix (mem_* = context, task_* = task). For context items, status/priority are ignored.",
|
|
216
|
+
description: "Array of items to update. Type automatically detected from ID prefix (mem_* = context, task_* = task, proc_* = process). For context/process items, status/priority are ignored.",
|
|
217
217
|
},
|
|
218
218
|
},
|
|
219
219
|
},
|
|
@@ -224,7 +224,7 @@ export const TOOLS = [
|
|
|
224
224
|
item_ids: {
|
|
225
225
|
type: "array",
|
|
226
226
|
items: { type: "string" },
|
|
227
|
-
description: "Array of item IDs to delete (mem_* for context, task_* for tasks). Type automatically detected from ID prefix.",
|
|
227
|
+
description: "Array of item IDs to delete (mem_* for context, task_* for tasks, proc_* for processes). Type automatically detected from ID prefix.",
|
|
228
228
|
},
|
|
229
229
|
},
|
|
230
230
|
},
|
package/index.ts
CHANGED
|
@@ -32,6 +32,10 @@ function log(msg: string) {
|
|
|
32
32
|
|
|
33
33
|
log("--- Server Starting ---");
|
|
34
34
|
|
|
35
|
+
// Client info captured from MCP initialize handshake
|
|
36
|
+
let mcpClientName: string | undefined;
|
|
37
|
+
let mcpClientVersion: string | undefined;
|
|
38
|
+
|
|
35
39
|
try {
|
|
36
40
|
// Load environment variables from .env and .env.local
|
|
37
41
|
config({ quiet: true });
|
|
@@ -100,14 +104,42 @@ try {
|
|
|
100
104
|
// Check version on startup (non-blocking)
|
|
101
105
|
checkVersion();
|
|
102
106
|
|
|
107
|
+
// Helper to ensure client info is captured (called before API requests)
|
|
108
|
+
function ensureClientInfo() {
|
|
109
|
+
if (!mcpClientName) {
|
|
110
|
+
const clientInfo = server.getClientVersion();
|
|
111
|
+
if (clientInfo) {
|
|
112
|
+
mcpClientName = clientInfo.name;
|
|
113
|
+
mcpClientVersion = clientInfo.version;
|
|
114
|
+
log(`Client identified (on-demand): ${mcpClientName} v${mcpClientVersion}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
103
119
|
async function makeApiCall(endpoint: string, data: any) {
|
|
120
|
+
// Ensure we have client info before making requests
|
|
121
|
+
ensureClientInfo();
|
|
122
|
+
|
|
123
|
+
// Build headers with client info if available
|
|
124
|
+
const headers: Record<string, string> = {
|
|
125
|
+
"Content-Type": "application/json",
|
|
126
|
+
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
127
|
+
"User-Agent": mcpClientName
|
|
128
|
+
? `${mcpClientName}/${mcpClientVersion || "unknown"} (mcp-stdio)`
|
|
129
|
+
: "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Add explicit client info headers for backend processing
|
|
133
|
+
if (mcpClientName) {
|
|
134
|
+
headers["X-MCP-Client-Name"] = mcpClientName;
|
|
135
|
+
}
|
|
136
|
+
if (mcpClientVersion) {
|
|
137
|
+
headers["X-MCP-Client-Version"] = mcpClientVersion;
|
|
138
|
+
}
|
|
139
|
+
|
|
104
140
|
const response = await fetch(`${API_BASE_URL}/api/mcp/${endpoint}`, {
|
|
105
141
|
method: "POST",
|
|
106
|
-
headers
|
|
107
|
-
"Content-Type": "application/json",
|
|
108
|
-
Authorization: `Bearer ${MCP_API_KEY}`,
|
|
109
|
-
"User-Agent": "MCP-Client-Stdio/1.1.2 (mcp)",
|
|
110
|
-
},
|
|
142
|
+
headers,
|
|
111
143
|
body: JSON.stringify(data),
|
|
112
144
|
});
|
|
113
145
|
|
|
@@ -302,6 +334,7 @@ try {
|
|
|
302
334
|
const transport = new StdioServerTransport();
|
|
303
335
|
await server.connect(transport);
|
|
304
336
|
log("Server connected to transport");
|
|
337
|
+
// Client info is captured on-demand in ensureClientInfo() before first API call
|
|
305
338
|
}
|
|
306
339
|
|
|
307
340
|
main().catch((err) => {
|
package/package.json
CHANGED
package/tool-definitions.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const TOOLS = [
|
|
|
4
4
|
name: "search",
|
|
5
5
|
title: "Search Space",
|
|
6
6
|
description:
|
|
7
|
-
"Search for
|
|
7
|
+
"Search for context, tasks, and processes within a space. System automatically extracts quantity from natural language ('show 3 tasks' → 3 results, 'the last one' → 1 result) and intelligently formats results (1-3 items → summaries, 4+ items → IDs only). Use fetch tool to get full content for specific IDs when needed.",
|
|
8
8
|
inputSchema: {
|
|
9
9
|
type: "object",
|
|
10
10
|
properties: {
|
|
@@ -37,13 +37,13 @@ export const TOOLS = [
|
|
|
37
37
|
id: {
|
|
38
38
|
type: "string",
|
|
39
39
|
description:
|
|
40
|
-
"Single ID to fetch (context or task ID like 'mem_123' or 'task_456')",
|
|
40
|
+
"Single ID to fetch (context or task ID like 'mem_123' or 'task_456' or 'proc_789')",
|
|
41
41
|
},
|
|
42
42
|
ids: {
|
|
43
43
|
type: "array",
|
|
44
44
|
items: { type: "string" },
|
|
45
45
|
description:
|
|
46
|
-
"Array of IDs to fetch (mix of context and
|
|
46
|
+
"Array of IDs to fetch (mix of context, task, and process IDs). Use this to fetch multiple items in one call.",
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
},
|
|
@@ -52,7 +52,7 @@ export const TOOLS = [
|
|
|
52
52
|
name: "view_topic",
|
|
53
53
|
title: "View Topic",
|
|
54
54
|
description:
|
|
55
|
-
"View all memories and
|
|
55
|
+
"View all memories, tasks, and processes tagged with a specific topic. Perfect for exploring a topic area or following up on topics from the start briefing.",
|
|
56
56
|
inputSchema: {
|
|
57
57
|
type: "object",
|
|
58
58
|
properties: {
|
|
@@ -180,25 +180,25 @@ export const TOOLS = [
|
|
|
180
180
|
title: { type: "string", description: "Item title" },
|
|
181
181
|
content: {
|
|
182
182
|
type: "string",
|
|
183
|
-
description: "Item content - system automatically classifies as task (actionable)
|
|
183
|
+
description: "Item content - system automatically classifies as task (actionable), context (knowledge), or process (workflow/procedure) and suggests relevant topics",
|
|
184
184
|
},
|
|
185
185
|
},
|
|
186
186
|
required: ["title", "content"],
|
|
187
187
|
},
|
|
188
|
-
description: "Array of items to add. System intelligently: (1) classifies as task or
|
|
188
|
+
description: "Array of items to add. System intelligently: (1) classifies as task, context, or process, (2) suggests 1-3 relevant topics based on content and existing topics. Examples: 'Need to fix auth bug' → task with topics like 'authentication', 'bug-fix'. 'Learned React batches updates' → context with topics like 'react', 'learning'.",
|
|
189
189
|
},
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
192
|
update: {
|
|
193
193
|
type: "object",
|
|
194
|
-
description: "Update existing items (context or
|
|
194
|
+
description: "Update existing items (context, tasks, or processes) - system detects type from ID prefix",
|
|
195
195
|
properties: {
|
|
196
196
|
items: {
|
|
197
197
|
type: "array",
|
|
198
198
|
items: {
|
|
199
199
|
type: "object",
|
|
200
200
|
properties: {
|
|
201
|
-
id: { type: "string", description: "Item ID to update (mem_* for context, task_* for tasks)" },
|
|
201
|
+
id: { type: "string", description: "Item ID to update (mem_* for context, task_* for tasks, proc_* for processes)" },
|
|
202
202
|
title: {
|
|
203
203
|
type: "string",
|
|
204
204
|
description: "New title (optional)",
|
|
@@ -230,7 +230,7 @@ export const TOOLS = [
|
|
|
230
230
|
},
|
|
231
231
|
required: ["id"],
|
|
232
232
|
},
|
|
233
|
-
description: "Array of items to update. Type automatically detected from ID prefix (mem_* = context, task_* = task). For context items, status/priority are ignored.",
|
|
233
|
+
description: "Array of items to update. Type automatically detected from ID prefix (mem_* = context, task_* = task, proc_* = process). For context/process items, status/priority are ignored.",
|
|
234
234
|
},
|
|
235
235
|
},
|
|
236
236
|
},
|
|
@@ -241,7 +241,7 @@ export const TOOLS = [
|
|
|
241
241
|
item_ids: {
|
|
242
242
|
type: "array",
|
|
243
243
|
items: { type: "string" },
|
|
244
|
-
description: "Array of item IDs to delete (mem_* for context, task_* for tasks). Type automatically detected from ID prefix.",
|
|
244
|
+
description: "Array of item IDs to delete (mem_* for context, task_* for tasks, proc_* for processes). Type automatically detected from ID prefix.",
|
|
245
245
|
},
|
|
246
246
|
},
|
|
247
247
|
},
|