@insforge/mcp 1.2.6-memory.2 → 1.2.6
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/{chunk-43OCZIXR.js → chunk-3S2HFIGS.js} +67 -112
- package/dist/http-server.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -1301,11 +1301,12 @@ import FormData from "form-data";
|
|
|
1301
1301
|
var execAsync = promisify(exec);
|
|
1302
1302
|
var TOOL_VERSION_REQUIREMENTS = {
|
|
1303
1303
|
// Schedule tools - require backend v1.1.1+
|
|
1304
|
-
|
|
1305
|
-
|
|
1304
|
+
// 'upsert-schedule': { minVersion: '1.1.1' },
|
|
1305
|
+
// 'delete-schedule': { minVersion: '1.1.1' },
|
|
1306
1306
|
// 'get-schedules': { minVersion: '1.1.1' },
|
|
1307
1307
|
// 'get-schedule-logs': { minVersion: '1.1.1' },
|
|
1308
|
-
"create-deployment": { minVersion: "1.4.7" }
|
|
1308
|
+
"create-deployment": { minVersion: "1.4.7" },
|
|
1309
|
+
"fetch-sdk-docs": { minVersion: "1.5.1" }
|
|
1309
1310
|
// Example of a deprecated tool (uncomment when needed):
|
|
1310
1311
|
// 'legacy-tool': { minVersion: '1.0.0', maxVersion: '1.5.0' },
|
|
1311
1312
|
};
|
|
@@ -1407,6 +1408,7 @@ async function registerInsforgeTools(server, config = {}) {
|
|
|
1407
1408
|
let content = result.content;
|
|
1408
1409
|
content = content.replace(/http:\/\/localhost:7130/g, API_BASE_URL);
|
|
1409
1410
|
content = content.replace(/https:\/\/your-app\.region\.insforge\.app/g, API_BASE_URL);
|
|
1411
|
+
content = content.replace(/https:\/\/your-app\.insforge\.app/g, API_BASE_URL);
|
|
1410
1412
|
return content;
|
|
1411
1413
|
}
|
|
1412
1414
|
throw new Error("Invalid response format from documentation endpoint");
|
|
@@ -1415,6 +1417,31 @@ async function registerInsforgeTools(server, config = {}) {
|
|
|
1415
1417
|
throw new Error(`Unable to retrieve ${docType} documentation: ${errMsg}`);
|
|
1416
1418
|
}
|
|
1417
1419
|
};
|
|
1420
|
+
const fetchSDKDocumentation = async (feature, language) => {
|
|
1421
|
+
try {
|
|
1422
|
+
const response = await fetch2(`${API_BASE_URL}/api/docs/${feature}/${language}`, {
|
|
1423
|
+
method: "GET",
|
|
1424
|
+
headers: {
|
|
1425
|
+
"Content-Type": "application/json"
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
if (response.status === 404) {
|
|
1429
|
+
throw new Error("Documentation not found. This feature may not be supported in your project version. Please contact the Insforge team for assistance.");
|
|
1430
|
+
}
|
|
1431
|
+
const result = await handleApiResponse(response);
|
|
1432
|
+
if (result && typeof result === "object" && "content" in result) {
|
|
1433
|
+
let content = result.content;
|
|
1434
|
+
content = content.replace(/http:\/\/localhost:7130/g, API_BASE_URL);
|
|
1435
|
+
content = content.replace(/https:\/\/your-app\.region\.insforge\.app/g, API_BASE_URL);
|
|
1436
|
+
content = content.replace(/https:\/\/your-app\.insforge\.app/g, API_BASE_URL);
|
|
1437
|
+
return content;
|
|
1438
|
+
}
|
|
1439
|
+
throw new Error("Invalid response format from documentation endpoint");
|
|
1440
|
+
} catch (error) {
|
|
1441
|
+
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1442
|
+
throw new Error(`Unable to retrieve ${feature}-${language} documentation: ${errMsg}`);
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1418
1445
|
const fetchInsforgeInstructionsContext = async () => {
|
|
1419
1446
|
try {
|
|
1420
1447
|
return await fetchDocumentation("instructions");
|
|
@@ -1473,6 +1500,43 @@ ${context}`
|
|
|
1473
1500
|
}
|
|
1474
1501
|
})
|
|
1475
1502
|
);
|
|
1503
|
+
registerTool(
|
|
1504
|
+
"fetch-sdk-docs",
|
|
1505
|
+
`Fetch Insforge SDK documentation for a specific feature and language combination.
|
|
1506
|
+
|
|
1507
|
+
Supported features: ${sdkFeatureSchema.options.join(", ")}
|
|
1508
|
+
Supported languages: ${sdkLanguageSchema.options.join(", ")}`,
|
|
1509
|
+
{
|
|
1510
|
+
sdkFeature: sdkFeatureSchema,
|
|
1511
|
+
sdkLanguage: sdkLanguageSchema
|
|
1512
|
+
},
|
|
1513
|
+
withUsageTracking("fetch-sdk-docs", async ({ sdkFeature, sdkLanguage }) => {
|
|
1514
|
+
try {
|
|
1515
|
+
const content = await fetchSDKDocumentation(sdkFeature, sdkLanguage);
|
|
1516
|
+
return await addBackgroundContext({
|
|
1517
|
+
content: [
|
|
1518
|
+
{
|
|
1519
|
+
type: "text",
|
|
1520
|
+
text: content
|
|
1521
|
+
}
|
|
1522
|
+
]
|
|
1523
|
+
});
|
|
1524
|
+
} catch (error) {
|
|
1525
|
+
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1526
|
+
if (errMsg.includes("404") || errMsg.toLowerCase().includes("not found")) {
|
|
1527
|
+
return {
|
|
1528
|
+
content: [{
|
|
1529
|
+
type: "text",
|
|
1530
|
+
text: `Documentation for "${sdkFeature}-${sdkLanguage}" is not available. This is likely because your backend version is too old and doesn't support this documentation endpoint yet. This won't affect the functionality of the tools - they will still work correctly.`
|
|
1531
|
+
}]
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
return {
|
|
1535
|
+
content: [{ type: "text", text: `Error fetching ${sdkFeature}-${sdkLanguage} documentation: ${errMsg}` }]
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
})
|
|
1539
|
+
);
|
|
1476
1540
|
registerTool(
|
|
1477
1541
|
"get-anon-key",
|
|
1478
1542
|
"Generate an anonymous JWT token that never expires. Requires admin API key. Use this for client-side applications that need public access.",
|
|
@@ -2270,115 +2334,6 @@ To: Your current project directory
|
|
|
2270
2334
|
}
|
|
2271
2335
|
})
|
|
2272
2336
|
);
|
|
2273
|
-
registerTool(
|
|
2274
|
-
"store-conversation",
|
|
2275
|
-
`IMPORTANT: Call this tool automatically when a task or conversation is complete to save it for future reference.
|
|
2276
|
-
|
|
2277
|
-
Store a conversation with messages for semantic similarity search. Messages are embedded using pgvector for later retrieval.
|
|
2278
|
-
|
|
2279
|
-
Include a descriptive title and relevant metadata (e.g., topic, project, keywords) to improve search results later.`,
|
|
2280
|
-
{
|
|
2281
|
-
apiKey: z23.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
2282
|
-
title: z23.string().optional().describe("Optional title for the conversation"),
|
|
2283
|
-
metadata: z23.record(z23.unknown()).optional().describe("Optional metadata to associate with the conversation"),
|
|
2284
|
-
messages: z23.array(
|
|
2285
|
-
z23.object({
|
|
2286
|
-
role: z23.enum(["user", "assistant", "system", "tool"]).describe("Message role"),
|
|
2287
|
-
content: z23.string().describe("Message content"),
|
|
2288
|
-
metadata: z23.record(z23.unknown()).optional().describe("Optional message metadata")
|
|
2289
|
-
})
|
|
2290
|
-
).min(1).describe("Array of messages to store"),
|
|
2291
|
-
embeddingModel: z23.string().optional().describe("Embedding model to use (uses project default if not specified)")
|
|
2292
|
-
},
|
|
2293
|
-
withUsageTracking(
|
|
2294
|
-
"store-conversation",
|
|
2295
|
-
async ({ apiKey, title, metadata, messages, embeddingModel }) => {
|
|
2296
|
-
try {
|
|
2297
|
-
const actualApiKey = getApiKey(apiKey);
|
|
2298
|
-
const response = await fetch2(`${API_BASE_URL}/api/memory/conversations`, {
|
|
2299
|
-
method: "POST",
|
|
2300
|
-
headers: {
|
|
2301
|
-
"x-api-key": actualApiKey,
|
|
2302
|
-
"Content-Type": "application/json"
|
|
2303
|
-
},
|
|
2304
|
-
body: JSON.stringify({ title, metadata, messages, embeddingModel })
|
|
2305
|
-
});
|
|
2306
|
-
const result = await handleApiResponse(response);
|
|
2307
|
-
return await addBackgroundContext({
|
|
2308
|
-
content: [
|
|
2309
|
-
{
|
|
2310
|
-
type: "text",
|
|
2311
|
-
text: formatSuccessMessage("Conversation stored successfully", result)
|
|
2312
|
-
}
|
|
2313
|
-
]
|
|
2314
|
-
});
|
|
2315
|
-
} catch (error) {
|
|
2316
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2317
|
-
return {
|
|
2318
|
-
content: [
|
|
2319
|
-
{
|
|
2320
|
-
type: "text",
|
|
2321
|
-
text: `Error storing conversation: ${errMsg}`
|
|
2322
|
-
}
|
|
2323
|
-
],
|
|
2324
|
-
isError: true
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
)
|
|
2329
|
-
);
|
|
2330
|
-
registerTool(
|
|
2331
|
-
"search-conversations",
|
|
2332
|
-
`IMPORTANT: Call this tool automatically at the START of each new task or conversation to retrieve relevant context from past interactions.
|
|
2333
|
-
|
|
2334
|
-
Search for conversations by semantic similarity using pgvector. Returns conversations ranked by relevance to the query.
|
|
2335
|
-
|
|
2336
|
-
Use the user's question or task description as the query to find related past conversations that may provide helpful context.`,
|
|
2337
|
-
{
|
|
2338
|
-
apiKey: z23.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
2339
|
-
query: z23.string().describe("Search query to find similar conversations"),
|
|
2340
|
-
limit: z23.number().int().positive().max(100).optional().default(10).describe("Maximum number of results to return (default: 10)"),
|
|
2341
|
-
threshold: z23.number().min(0).max(1).optional().default(0).describe("Minimum similarity threshold 0-1 (default: 0)"),
|
|
2342
|
-
metadataFilter: z23.record(z23.unknown()).optional().describe("Filter conversations by metadata (JSONB containment)"),
|
|
2343
|
-
embeddingModel: z23.string().optional().describe("Embedding model for the query (uses project default if not specified)")
|
|
2344
|
-
},
|
|
2345
|
-
withUsageTracking(
|
|
2346
|
-
"search-conversations",
|
|
2347
|
-
async ({ apiKey, query, limit, threshold, metadataFilter, embeddingModel }) => {
|
|
2348
|
-
try {
|
|
2349
|
-
const actualApiKey = getApiKey(apiKey);
|
|
2350
|
-
const response = await fetch2(`${API_BASE_URL}/api/memory/search`, {
|
|
2351
|
-
method: "POST",
|
|
2352
|
-
headers: {
|
|
2353
|
-
"x-api-key": actualApiKey,
|
|
2354
|
-
"Content-Type": "application/json"
|
|
2355
|
-
},
|
|
2356
|
-
body: JSON.stringify({ query, limit, threshold, metadataFilter, embeddingModel })
|
|
2357
|
-
});
|
|
2358
|
-
const result = await handleApiResponse(response);
|
|
2359
|
-
return await addBackgroundContext({
|
|
2360
|
-
content: [
|
|
2361
|
-
{
|
|
2362
|
-
type: "text",
|
|
2363
|
-
text: formatSuccessMessage("Conversation search completed", result)
|
|
2364
|
-
}
|
|
2365
|
-
]
|
|
2366
|
-
});
|
|
2367
|
-
} catch (error) {
|
|
2368
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2369
|
-
return {
|
|
2370
|
-
content: [
|
|
2371
|
-
{
|
|
2372
|
-
type: "text",
|
|
2373
|
-
text: `Error searching conversations: ${errMsg}`
|
|
2374
|
-
}
|
|
2375
|
-
],
|
|
2376
|
-
isError: true
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
)
|
|
2381
|
-
);
|
|
2382
2337
|
return {
|
|
2383
2338
|
apiKey: GLOBAL_API_KEY,
|
|
2384
2339
|
apiBaseUrl: API_BASE_URL,
|
package/dist/http-server.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insforge/mcp",
|
|
3
|
-
"version": "1.2.6
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "MCP (Model Context Protocol) server for Insforge backend-as-a-service",
|
|
5
5
|
"mcpName": "io.github.InsForge/insforge-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"server.json"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@insforge/shared-schemas": "1.1.
|
|
39
|
+
"@insforge/shared-schemas": "1.1.42",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
41
41
|
"@types/express": "^5.0.3",
|
|
42
42
|
"archiver": "^7.0.1",
|