@insforge/mcp 1.2.4-dev.0 → 1.2.4-dev.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-YK4636F3.js → chunk-35O2DLUR.js} +92 -166
- package/dist/http-server.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ import fetch2 from "node-fetch";
|
|
|
6
6
|
import { promises as fs } from "fs";
|
|
7
7
|
import { exec } from "child_process";
|
|
8
8
|
import { promisify } from "util";
|
|
9
|
-
import { tmpdir } from "os";
|
|
10
9
|
|
|
11
10
|
// src/shared/response-handler.ts
|
|
12
11
|
async function handleApiResponse(response) {
|
|
@@ -63,7 +62,7 @@ var UsageTracker = class {
|
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
//
|
|
65
|
+
// ../InsForge/shared-schemas/dist/database.schema.js
|
|
67
66
|
import { z } from "zod";
|
|
68
67
|
var ColumnType;
|
|
69
68
|
(function(ColumnType2) {
|
|
@@ -146,7 +145,7 @@ var databaseTriggerSchema = z.object({
|
|
|
146
145
|
actionStatement: z.string()
|
|
147
146
|
});
|
|
148
147
|
|
|
149
|
-
//
|
|
148
|
+
// ../InsForge/shared-schemas/dist/database-api.schema.js
|
|
150
149
|
import { z as z2 } from "zod";
|
|
151
150
|
var createTableRequestSchema = tableSchema.pick({
|
|
152
151
|
tableName: true,
|
|
@@ -326,7 +325,7 @@ var databaseTriggersResponseSchema = z2.object({
|
|
|
326
325
|
triggers: z2.array(databaseTriggerSchema)
|
|
327
326
|
});
|
|
328
327
|
|
|
329
|
-
//
|
|
328
|
+
// ../InsForge/shared-schemas/dist/storage.schema.js
|
|
330
329
|
import { z as z3 } from "zod";
|
|
331
330
|
var storageFileSchema = z3.object({
|
|
332
331
|
key: z3.string(),
|
|
@@ -342,7 +341,7 @@ var storageBucketSchema = z3.object({
|
|
|
342
341
|
createdAt: z3.string()
|
|
343
342
|
});
|
|
344
343
|
|
|
345
|
-
//
|
|
344
|
+
// ../InsForge/shared-schemas/dist/storage-api.schema.js
|
|
346
345
|
import { z as z4 } from "zod";
|
|
347
346
|
var createBucketRequestSchema = z4.object({
|
|
348
347
|
bucketName: z4.string().min(1, "Bucket name cannot be empty"),
|
|
@@ -388,7 +387,7 @@ var confirmUploadRequestSchema = z4.object({
|
|
|
388
387
|
etag: z4.string().optional()
|
|
389
388
|
});
|
|
390
389
|
|
|
391
|
-
//
|
|
390
|
+
// ../InsForge/shared-schemas/dist/auth.schema.js
|
|
392
391
|
import { z as z5 } from "zod";
|
|
393
392
|
var userIdSchema = z5.string().uuid("Invalid user ID format");
|
|
394
393
|
var emailSchema = z5.string().email("Invalid email format").toLowerCase().trim();
|
|
@@ -471,7 +470,7 @@ var tokenPayloadSchema = z5.object({
|
|
|
471
470
|
// Expiration
|
|
472
471
|
});
|
|
473
472
|
|
|
474
|
-
//
|
|
473
|
+
// ../InsForge/shared-schemas/dist/auth-api.schema.js
|
|
475
474
|
import { z as z6 } from "zod";
|
|
476
475
|
var paginationSchema = z6.object({
|
|
477
476
|
limit: z6.string().optional(),
|
|
@@ -611,10 +610,10 @@ var authErrorResponseSchema = z6.object({
|
|
|
611
610
|
nextActions: z6.string().optional()
|
|
612
611
|
});
|
|
613
612
|
|
|
614
|
-
//
|
|
613
|
+
// ../InsForge/shared-schemas/dist/metadata.schema.js
|
|
615
614
|
import { z as z9 } from "zod";
|
|
616
615
|
|
|
617
|
-
//
|
|
616
|
+
// ../InsForge/shared-schemas/dist/realtime.schema.js
|
|
618
617
|
import { z as z7 } from "zod";
|
|
619
618
|
var senderTypeSchema = z7.enum(["system", "user"]);
|
|
620
619
|
var realtimeChannelSchema = z7.object({
|
|
@@ -689,7 +688,7 @@ var socketMessageSchema = z7.object({
|
|
|
689
688
|
meta: socketMessageMetaSchema
|
|
690
689
|
}).passthrough();
|
|
691
690
|
|
|
692
|
-
//
|
|
691
|
+
// ../InsForge/shared-schemas/dist/realtime-api.schema.js
|
|
693
692
|
import { z as z8 } from "zod";
|
|
694
693
|
var createChannelRequestSchema = z8.object({
|
|
695
694
|
pattern: z8.string().min(1, "Channel pattern is required"),
|
|
@@ -743,7 +742,7 @@ var realtimePermissionsResponseSchema = z8.object({
|
|
|
743
742
|
})
|
|
744
743
|
});
|
|
745
744
|
|
|
746
|
-
//
|
|
745
|
+
// ../InsForge/shared-schemas/dist/metadata.schema.js
|
|
747
746
|
var authMetadataSchema = z9.object({
|
|
748
747
|
oauths: z9.array(oAuthConfigSchema)
|
|
749
748
|
});
|
|
@@ -789,7 +788,7 @@ var appMetaDataSchema = z9.object({
|
|
|
789
788
|
version: z9.string().optional()
|
|
790
789
|
});
|
|
791
790
|
|
|
792
|
-
//
|
|
791
|
+
// ../InsForge/shared-schemas/dist/ai.schema.js
|
|
793
792
|
import { z as z10 } from "zod";
|
|
794
793
|
var modalitySchema = z10.enum(["text", "image"]);
|
|
795
794
|
var aiConfigurationInputSchema = z10.object({
|
|
@@ -835,7 +834,7 @@ var aiUsageSummarySchema = z10.object({
|
|
|
835
834
|
totalRequests: z10.number()
|
|
836
835
|
});
|
|
837
836
|
|
|
838
|
-
//
|
|
837
|
+
// ../InsForge/shared-schemas/dist/ai-api.schema.js
|
|
839
838
|
import { z as z11 } from "zod";
|
|
840
839
|
var textContentSchema = z11.object({
|
|
841
840
|
type: z11.literal("text"),
|
|
@@ -932,7 +931,7 @@ var getAIUsageSummaryRequestSchema = z11.object({
|
|
|
932
931
|
endDate: z11.string().datetime().optional()
|
|
933
932
|
});
|
|
934
933
|
|
|
935
|
-
//
|
|
934
|
+
// ../InsForge/shared-schemas/dist/logs.schema.js
|
|
936
935
|
import { z as z12 } from "zod";
|
|
937
936
|
var auditLogSchema = z12.object({
|
|
938
937
|
id: z12.string(),
|
|
@@ -962,7 +961,7 @@ var logStatsSchema = z12.object({
|
|
|
962
961
|
lastActivity: z12.string()
|
|
963
962
|
});
|
|
964
963
|
|
|
965
|
-
//
|
|
964
|
+
// ../InsForge/shared-schemas/dist/logs-api.schema.js
|
|
966
965
|
import { z as z13 } from "zod";
|
|
967
966
|
var getAuditLogsRequestSchema = z13.object({
|
|
968
967
|
limit: z13.number().default(100),
|
|
@@ -1003,7 +1002,7 @@ var getLogsResponseSchema = z13.object({
|
|
|
1003
1002
|
total: z13.number()
|
|
1004
1003
|
});
|
|
1005
1004
|
|
|
1006
|
-
//
|
|
1005
|
+
// ../InsForge/shared-schemas/dist/functions.schema.js
|
|
1007
1006
|
import { z as z14 } from "zod";
|
|
1008
1007
|
var functionSchema = z14.object({
|
|
1009
1008
|
id: z14.string(),
|
|
@@ -1017,7 +1016,7 @@ var functionSchema = z14.object({
|
|
|
1017
1016
|
deployedAt: z14.string().nullable()
|
|
1018
1017
|
});
|
|
1019
1018
|
|
|
1020
|
-
//
|
|
1019
|
+
// ../InsForge/shared-schemas/dist/functions-api.schema.js
|
|
1021
1020
|
import { z as z15 } from "zod";
|
|
1022
1021
|
var functionUploadRequestSchema = z15.object({
|
|
1023
1022
|
name: z15.string().min(1, "Name is required"),
|
|
@@ -1033,7 +1032,7 @@ var functionUpdateRequestSchema = z15.object({
|
|
|
1033
1032
|
status: z15.enum(["draft", "active"]).optional()
|
|
1034
1033
|
});
|
|
1035
1034
|
|
|
1036
|
-
//
|
|
1035
|
+
// ../InsForge/shared-schemas/dist/cloud-events.schema.js
|
|
1037
1036
|
import { z as z16 } from "zod";
|
|
1038
1037
|
var appRouteChangeEventSchema = z16.object({
|
|
1039
1038
|
type: z16.literal("APP_ROUTE_CHANGE"),
|
|
@@ -1075,31 +1074,92 @@ var cloudEventSchema = z16.discriminatedUnion("type", [
|
|
|
1075
1074
|
navigateToUsageSchema
|
|
1076
1075
|
]);
|
|
1077
1076
|
|
|
1078
|
-
//
|
|
1077
|
+
// ../InsForge/shared-schemas/dist/docs.schema.js
|
|
1079
1078
|
import { z as z17 } from "zod";
|
|
1080
1079
|
var docTypeSchema = z17.enum([
|
|
1080
|
+
// General
|
|
1081
1081
|
"instructions",
|
|
1082
|
-
|
|
1082
|
+
// TypeScript SDK
|
|
1083
|
+
"db-sdk-typescript",
|
|
1084
|
+
"storage-sdk-typescript",
|
|
1085
|
+
"functions-sdk-typescript",
|
|
1086
|
+
"ai-sdk-typescript",
|
|
1087
|
+
"auth-sdk-typescript",
|
|
1088
|
+
"realtime-sdk-typescript",
|
|
1089
|
+
"auth-components-react",
|
|
1090
|
+
"auth-components-nextjs",
|
|
1091
|
+
// Swift SDK
|
|
1092
|
+
"db-sdk-swift",
|
|
1093
|
+
"storage-sdk-swift",
|
|
1094
|
+
"functions-sdk-swift",
|
|
1095
|
+
"auth-sdk-swift",
|
|
1096
|
+
"ai-sdk-swift",
|
|
1097
|
+
"realtime-sdk-swift",
|
|
1098
|
+
// Kotlin SDK
|
|
1099
|
+
"db-sdk-kotlin",
|
|
1100
|
+
"storage-sdk-kotlin",
|
|
1101
|
+
"functions-sdk-kotlin",
|
|
1102
|
+
"auth-sdk-kotlin",
|
|
1103
|
+
"ai-sdk-kotlin",
|
|
1104
|
+
"realtime-sdk-kotlin",
|
|
1105
|
+
// Flutter SDK
|
|
1106
|
+
"db-sdk-flutter",
|
|
1107
|
+
"storage-sdk-flutter",
|
|
1108
|
+
"functions-sdk-flutter",
|
|
1109
|
+
"auth-sdk-flutter",
|
|
1110
|
+
"ai-sdk-flutter",
|
|
1111
|
+
"realtime-sdk-flutter",
|
|
1112
|
+
// Legacy aliases (for backward compatibility)
|
|
1083
1113
|
"db-sdk",
|
|
1084
1114
|
"storage-sdk",
|
|
1085
1115
|
"functions-sdk",
|
|
1086
1116
|
"ai-integration-sdk",
|
|
1087
|
-
"auth-components-react",
|
|
1088
|
-
"auth-components-nextjs",
|
|
1089
1117
|
"real-time"
|
|
1090
1118
|
]).describe(`
|
|
1091
|
-
Documentation type:
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
"
|
|
1095
|
-
"
|
|
1096
|
-
"
|
|
1097
|
-
"
|
|
1098
|
-
"
|
|
1099
|
-
"
|
|
1119
|
+
Documentation type with language suffix:
|
|
1120
|
+
|
|
1121
|
+
TypeScript (Web/Node.js):
|
|
1122
|
+
"db-sdk-typescript" - Database operations
|
|
1123
|
+
"storage-sdk-typescript" - File storage
|
|
1124
|
+
"functions-sdk-typescript" - Edge functions
|
|
1125
|
+
"ai-sdk-typescript" - AI features
|
|
1126
|
+
"auth-sdk-typescript" - Authentication
|
|
1127
|
+
"realtime-sdk-typescript" - Real-time WebSockets
|
|
1128
|
+
"auth-components-react" - Auth UI for React+Vite
|
|
1129
|
+
"auth-components-nextjs" - Auth UI for Next.js
|
|
1130
|
+
|
|
1131
|
+
Swift (iOS/macOS):
|
|
1132
|
+
"db-sdk-swift" - Database operations
|
|
1133
|
+
"storage-sdk-swift" - File storage
|
|
1134
|
+
"auth-sdk-swift" - Authentication
|
|
1135
|
+
"functions-sdk-swift" - Edge functions
|
|
1136
|
+
"ai-sdk-swift" - AI features
|
|
1137
|
+
"realtime-sdk-swift" - Real-time WebSockets
|
|
1138
|
+
|
|
1139
|
+
Kotlin (Android):
|
|
1140
|
+
"db-sdk-kotlin" - Database operations
|
|
1141
|
+
"storage-sdk-kotlin" - File storage
|
|
1142
|
+
"functions-sdk-kotlin" - Edge functions
|
|
1143
|
+
"auth-sdk-kotlin" - Authentication
|
|
1144
|
+
"ai-sdk-kotlin" - AI features
|
|
1145
|
+
"realtime-sdk-kotlin" - Real-time WebSockets
|
|
1146
|
+
|
|
1147
|
+
Flutter (Cross-platform mobile):
|
|
1148
|
+
"db-sdk-flutter" - Database operations
|
|
1149
|
+
"storage-sdk-flutter" - File storage
|
|
1150
|
+
"functions-sdk-flutter" - Edge functions
|
|
1151
|
+
"auth-sdk-flutter" - Authentication
|
|
1152
|
+
"ai-sdk-flutter" - AI features
|
|
1153
|
+
"realtime-sdk-flutter" - Real-time WebSockets
|
|
1154
|
+
|
|
1155
|
+
General:
|
|
1156
|
+
"instructions" - Essential backend setup (use FIRST)
|
|
1157
|
+
|
|
1158
|
+
Legacy (deprecated, use language-specific versions):
|
|
1159
|
+
"db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "real-time"
|
|
1100
1160
|
`);
|
|
1101
1161
|
|
|
1102
|
-
//
|
|
1162
|
+
// ../InsForge/shared-schemas/dist/email-api.schema.js
|
|
1103
1163
|
import { z as z18 } from "zod";
|
|
1104
1164
|
var emailOrEmails = z18.union([
|
|
1105
1165
|
emailSchema,
|
|
@@ -1117,7 +1177,6 @@ var sendRawEmailRequestSchema = z18.object({
|
|
|
1117
1177
|
var sendEmailResponseSchema = z18.object({});
|
|
1118
1178
|
|
|
1119
1179
|
// src/shared/tools.ts
|
|
1120
|
-
import FormData from "form-data";
|
|
1121
1180
|
var execAsync = promisify(exec);
|
|
1122
1181
|
var TOOL_VERSION_REQUIREMENTS = {
|
|
1123
1182
|
"upsert-schedule": "1.1.1",
|
|
@@ -1462,139 +1521,6 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1462
1521
|
}
|
|
1463
1522
|
})
|
|
1464
1523
|
);
|
|
1465
|
-
server.tool(
|
|
1466
|
-
"download-template",
|
|
1467
|
-
"CRITICAL: MANDATORY FIRST STEP for all new InsForge projects. Download pre-configured starter template to a temporary directory. After download, you MUST copy files to current directory using the provided command.",
|
|
1468
|
-
{
|
|
1469
|
-
frame: z19.enum(["react", "nextjs"]).describe("Framework to use for the template (support React and Next.js)"),
|
|
1470
|
-
projectName: z19.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")')
|
|
1471
|
-
},
|
|
1472
|
-
withUsageTracking("download-template", async ({ frame, projectName }) => {
|
|
1473
|
-
try {
|
|
1474
|
-
const response = await fetch2(`${API_BASE_URL}/api/auth/tokens/anon`, {
|
|
1475
|
-
method: "POST",
|
|
1476
|
-
headers: {
|
|
1477
|
-
"x-api-key": getApiKey(),
|
|
1478
|
-
"Content-Type": "application/json"
|
|
1479
|
-
}
|
|
1480
|
-
});
|
|
1481
|
-
const result = await handleApiResponse(response);
|
|
1482
|
-
const anonKey = result.accessToken;
|
|
1483
|
-
if (!anonKey) {
|
|
1484
|
-
throw new Error("Failed to retrieve anon key from backend");
|
|
1485
|
-
}
|
|
1486
|
-
const tempDir = tmpdir();
|
|
1487
|
-
const targetDir = projectName || `insforge-${frame}`;
|
|
1488
|
-
const templatePath = `${tempDir}/${targetDir}`;
|
|
1489
|
-
console.error(`[download-template] Target path: ${templatePath}`);
|
|
1490
|
-
try {
|
|
1491
|
-
const stats = await fs.stat(templatePath);
|
|
1492
|
-
if (stats.isDirectory()) {
|
|
1493
|
-
console.error(`[download-template] Removing existing template at ${templatePath}`);
|
|
1494
|
-
await fs.rm(templatePath, { recursive: true, force: true });
|
|
1495
|
-
}
|
|
1496
|
-
} catch {
|
|
1497
|
-
}
|
|
1498
|
-
const command = `npx create-insforge-app ${targetDir} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey} --skip-install`;
|
|
1499
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
1500
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
1501
|
-
// 10MB buffer
|
|
1502
|
-
cwd: tempDir
|
|
1503
|
-
});
|
|
1504
|
-
const output = stdout || stderr || "";
|
|
1505
|
-
if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
|
|
1506
|
-
throw new Error(`Failed to download template: ${output}`);
|
|
1507
|
-
}
|
|
1508
|
-
return await addBackgroundContext({
|
|
1509
|
-
content: [
|
|
1510
|
-
{
|
|
1511
|
-
type: "text",
|
|
1512
|
-
text: `\u2705 React template downloaded successfully
|
|
1513
|
-
|
|
1514
|
-
\u{1F4C1} Template Location: ${templatePath}
|
|
1515
|
-
|
|
1516
|
-
\u26A0\uFE0F IMPORTANT: The template is in a temporary directory and NOT in your current working directory.
|
|
1517
|
-
|
|
1518
|
-
\u{1F534} CRITICAL NEXT STEP REQUIRED:
|
|
1519
|
-
You MUST copy ALL files (INCLUDING HIDDEN FILES like .env, .gitignore, etc.) from the temporary directory to your current project directory.
|
|
1520
|
-
|
|
1521
|
-
Copy all files from: ${templatePath}
|
|
1522
|
-
To: Your current project directory
|
|
1523
|
-
`
|
|
1524
|
-
}
|
|
1525
|
-
]
|
|
1526
|
-
});
|
|
1527
|
-
} catch (error) {
|
|
1528
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1529
|
-
return {
|
|
1530
|
-
content: [
|
|
1531
|
-
{
|
|
1532
|
-
type: "text",
|
|
1533
|
-
text: `Error downloading template: ${errMsg}`
|
|
1534
|
-
}
|
|
1535
|
-
],
|
|
1536
|
-
isError: true
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
})
|
|
1540
|
-
);
|
|
1541
|
-
server.tool(
|
|
1542
|
-
"bulk-upsert",
|
|
1543
|
-
"Bulk insert or update data from CSV or JSON file. Supports upsert operations with a unique key.",
|
|
1544
|
-
{
|
|
1545
|
-
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1546
|
-
...bulkUpsertRequestSchema.shape,
|
|
1547
|
-
filePath: z19.string().describe("Path to CSV or JSON file containing data to import")
|
|
1548
|
-
},
|
|
1549
|
-
withUsageTracking("bulk-upsert", async ({ apiKey, table, filePath, upsertKey }) => {
|
|
1550
|
-
try {
|
|
1551
|
-
const actualApiKey = getApiKey(apiKey);
|
|
1552
|
-
const fileBuffer = await fs.readFile(filePath);
|
|
1553
|
-
const fileName = filePath.split("/").pop() || "data.csv";
|
|
1554
|
-
const formData = new FormData();
|
|
1555
|
-
formData.append("file", fileBuffer, fileName);
|
|
1556
|
-
formData.append("table", table);
|
|
1557
|
-
if (upsertKey) {
|
|
1558
|
-
formData.append("upsertKey", upsertKey);
|
|
1559
|
-
}
|
|
1560
|
-
const response = await fetch2(`${API_BASE_URL}/api/database/advance/bulk-upsert`, {
|
|
1561
|
-
method: "POST",
|
|
1562
|
-
headers: {
|
|
1563
|
-
"x-api-key": actualApiKey,
|
|
1564
|
-
...formData.getHeaders()
|
|
1565
|
-
},
|
|
1566
|
-
body: formData
|
|
1567
|
-
});
|
|
1568
|
-
const result = await handleApiResponse(response);
|
|
1569
|
-
const message = result.success ? `Successfully processed ${result.rowsAffected} of ${result.totalRecords} records into table "${result.table}"` : result.message || "Bulk upsert operation completed";
|
|
1570
|
-
return await addBackgroundContext({
|
|
1571
|
-
content: [
|
|
1572
|
-
{
|
|
1573
|
-
type: "text",
|
|
1574
|
-
text: formatSuccessMessage("Bulk upsert completed", {
|
|
1575
|
-
message,
|
|
1576
|
-
table: result.table,
|
|
1577
|
-
rowsAffected: result.rowsAffected,
|
|
1578
|
-
totalRecords: result.totalRecords,
|
|
1579
|
-
errors: result.errors
|
|
1580
|
-
})
|
|
1581
|
-
}
|
|
1582
|
-
]
|
|
1583
|
-
});
|
|
1584
|
-
} catch (error) {
|
|
1585
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1586
|
-
return {
|
|
1587
|
-
content: [
|
|
1588
|
-
{
|
|
1589
|
-
type: "text",
|
|
1590
|
-
text: `Error performing bulk upsert: ${errMsg}`
|
|
1591
|
-
}
|
|
1592
|
-
],
|
|
1593
|
-
isError: true
|
|
1594
|
-
};
|
|
1595
|
-
}
|
|
1596
|
-
})
|
|
1597
|
-
);
|
|
1598
1524
|
server.tool(
|
|
1599
1525
|
"create-bucket",
|
|
1600
1526
|
"Create new storage bucket",
|
package/dist/http-server.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED