@insforge/mcp 1.2.6-dev.1 → 1.2.6-memory.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/{chunk-3S2HFIGS.js → chunk-4SZSV7IV.js} +104 -67
- package/dist/http-server.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -1301,12 +1301,11 @@ 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" }
|
|
1309
|
-
"fetch-sdk-docs": { minVersion: "1.5.1" }
|
|
1308
|
+
"create-deployment": { minVersion: "1.4.7" }
|
|
1310
1309
|
// Example of a deprecated tool (uncomment when needed):
|
|
1311
1310
|
// 'legacy-tool': { minVersion: '1.0.0', maxVersion: '1.5.0' },
|
|
1312
1311
|
};
|
|
@@ -1408,7 +1407,6 @@ async function registerInsforgeTools(server, config = {}) {
|
|
|
1408
1407
|
let content = result.content;
|
|
1409
1408
|
content = content.replace(/http:\/\/localhost:7130/g, API_BASE_URL);
|
|
1410
1409
|
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);
|
|
1412
1410
|
return content;
|
|
1413
1411
|
}
|
|
1414
1412
|
throw new Error("Invalid response format from documentation endpoint");
|
|
@@ -1417,31 +1415,6 @@ async function registerInsforgeTools(server, config = {}) {
|
|
|
1417
1415
|
throw new Error(`Unable to retrieve ${docType} documentation: ${errMsg}`);
|
|
1418
1416
|
}
|
|
1419
1417
|
};
|
|
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
|
-
};
|
|
1445
1418
|
const fetchInsforgeInstructionsContext = async () => {
|
|
1446
1419
|
try {
|
|
1447
1420
|
return await fetchDocumentation("instructions");
|
|
@@ -1500,43 +1473,6 @@ ${context}`
|
|
|
1500
1473
|
}
|
|
1501
1474
|
})
|
|
1502
1475
|
);
|
|
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
|
-
);
|
|
1540
1476
|
registerTool(
|
|
1541
1477
|
"get-anon-key",
|
|
1542
1478
|
"Generate an anonymous JWT token that never expires. Requires admin API key. Use this for client-side applications that need public access.",
|
|
@@ -2334,6 +2270,107 @@ To: Your current project directory
|
|
|
2334
2270
|
}
|
|
2335
2271
|
})
|
|
2336
2272
|
);
|
|
2273
|
+
registerTool(
|
|
2274
|
+
"store-conversation",
|
|
2275
|
+
"Store a conversation with messages for semantic similarity search. Messages are embedded using pgvector for later retrieval.",
|
|
2276
|
+
{
|
|
2277
|
+
apiKey: z23.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
2278
|
+
title: z23.string().optional().describe("Optional title for the conversation"),
|
|
2279
|
+
metadata: z23.record(z23.unknown()).optional().describe("Optional metadata to associate with the conversation"),
|
|
2280
|
+
messages: z23.array(
|
|
2281
|
+
z23.object({
|
|
2282
|
+
role: z23.enum(["user", "assistant", "system", "tool"]).describe("Message role"),
|
|
2283
|
+
content: z23.string().describe("Message content"),
|
|
2284
|
+
metadata: z23.record(z23.unknown()).optional().describe("Optional message metadata")
|
|
2285
|
+
})
|
|
2286
|
+
).min(1).describe("Array of messages to store"),
|
|
2287
|
+
embeddingModel: z23.string().optional().describe("Embedding model to use (uses project default if not specified)")
|
|
2288
|
+
},
|
|
2289
|
+
withUsageTracking(
|
|
2290
|
+
"store-conversation",
|
|
2291
|
+
async ({ apiKey, title, metadata, messages, embeddingModel }) => {
|
|
2292
|
+
try {
|
|
2293
|
+
const actualApiKey = getApiKey(apiKey);
|
|
2294
|
+
const response = await fetch2(`${API_BASE_URL}/api/memory/conversations`, {
|
|
2295
|
+
method: "POST",
|
|
2296
|
+
headers: {
|
|
2297
|
+
"x-api-key": actualApiKey,
|
|
2298
|
+
"Content-Type": "application/json"
|
|
2299
|
+
},
|
|
2300
|
+
body: JSON.stringify({ title, metadata, messages, embeddingModel })
|
|
2301
|
+
});
|
|
2302
|
+
const result = await handleApiResponse(response);
|
|
2303
|
+
return await addBackgroundContext({
|
|
2304
|
+
content: [
|
|
2305
|
+
{
|
|
2306
|
+
type: "text",
|
|
2307
|
+
text: formatSuccessMessage("Conversation stored successfully", result)
|
|
2308
|
+
}
|
|
2309
|
+
]
|
|
2310
|
+
});
|
|
2311
|
+
} catch (error) {
|
|
2312
|
+
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2313
|
+
return {
|
|
2314
|
+
content: [
|
|
2315
|
+
{
|
|
2316
|
+
type: "text",
|
|
2317
|
+
text: `Error storing conversation: ${errMsg}`
|
|
2318
|
+
}
|
|
2319
|
+
],
|
|
2320
|
+
isError: true
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
)
|
|
2325
|
+
);
|
|
2326
|
+
registerTool(
|
|
2327
|
+
"search-conversations",
|
|
2328
|
+
"Search for conversations by semantic similarity using pgvector. Returns conversations ranked by relevance to the query.",
|
|
2329
|
+
{
|
|
2330
|
+
apiKey: z23.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
2331
|
+
query: z23.string().describe("Search query to find similar conversations"),
|
|
2332
|
+
limit: z23.number().int().positive().max(100).optional().default(10).describe("Maximum number of results to return (default: 10)"),
|
|
2333
|
+
threshold: z23.number().min(0).max(1).optional().default(0).describe("Minimum similarity threshold 0-1 (default: 0)"),
|
|
2334
|
+
metadataFilter: z23.record(z23.unknown()).optional().describe("Filter conversations by metadata (JSONB containment)"),
|
|
2335
|
+
embeddingModel: z23.string().optional().describe("Embedding model for the query (uses project default if not specified)")
|
|
2336
|
+
},
|
|
2337
|
+
withUsageTracking(
|
|
2338
|
+
"search-conversations",
|
|
2339
|
+
async ({ apiKey, query, limit, threshold, metadataFilter, embeddingModel }) => {
|
|
2340
|
+
try {
|
|
2341
|
+
const actualApiKey = getApiKey(apiKey);
|
|
2342
|
+
const response = await fetch2(`${API_BASE_URL}/api/memory/search`, {
|
|
2343
|
+
method: "POST",
|
|
2344
|
+
headers: {
|
|
2345
|
+
"x-api-key": actualApiKey,
|
|
2346
|
+
"Content-Type": "application/json"
|
|
2347
|
+
},
|
|
2348
|
+
body: JSON.stringify({ query, limit, threshold, metadataFilter, embeddingModel })
|
|
2349
|
+
});
|
|
2350
|
+
const result = await handleApiResponse(response);
|
|
2351
|
+
return await addBackgroundContext({
|
|
2352
|
+
content: [
|
|
2353
|
+
{
|
|
2354
|
+
type: "text",
|
|
2355
|
+
text: formatSuccessMessage("Conversation search completed", result)
|
|
2356
|
+
}
|
|
2357
|
+
]
|
|
2358
|
+
});
|
|
2359
|
+
} catch (error) {
|
|
2360
|
+
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2361
|
+
return {
|
|
2362
|
+
content: [
|
|
2363
|
+
{
|
|
2364
|
+
type: "text",
|
|
2365
|
+
text: `Error searching conversations: ${errMsg}`
|
|
2366
|
+
}
|
|
2367
|
+
],
|
|
2368
|
+
isError: true
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
)
|
|
2373
|
+
);
|
|
2337
2374
|
return {
|
|
2338
2375
|
apiKey: GLOBAL_API_KEY,
|
|
2339
2376
|
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-memory.1",
|
|
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.38",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
41
41
|
"@types/express": "^5.0.3",
|
|
42
42
|
"archiver": "^7.0.1",
|