@insforge/mcp 1.2.4-deployment.7 → 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-UC5S2WUP.js → chunk-35O2DLUR.js} +114 -352
- package/dist/http-server.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -4
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/shared/tools.ts
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as z19 } from "zod";
|
|
5
5
|
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
|
-
import path from "path";
|
|
11
|
-
import archiver from "archiver";
|
|
12
9
|
|
|
13
10
|
// src/shared/response-handler.ts
|
|
14
11
|
async function handleApiResponse(response) {
|
|
@@ -65,7 +62,7 @@ var UsageTracker = class {
|
|
|
65
62
|
}
|
|
66
63
|
};
|
|
67
64
|
|
|
68
|
-
//
|
|
65
|
+
// ../InsForge/shared-schemas/dist/database.schema.js
|
|
69
66
|
import { z } from "zod";
|
|
70
67
|
var ColumnType;
|
|
71
68
|
(function(ColumnType2) {
|
|
@@ -148,7 +145,7 @@ var databaseTriggerSchema = z.object({
|
|
|
148
145
|
actionStatement: z.string()
|
|
149
146
|
});
|
|
150
147
|
|
|
151
|
-
//
|
|
148
|
+
// ../InsForge/shared-schemas/dist/database-api.schema.js
|
|
152
149
|
import { z as z2 } from "zod";
|
|
153
150
|
var createTableRequestSchema = tableSchema.pick({
|
|
154
151
|
tableName: true,
|
|
@@ -328,7 +325,7 @@ var databaseTriggersResponseSchema = z2.object({
|
|
|
328
325
|
triggers: z2.array(databaseTriggerSchema)
|
|
329
326
|
});
|
|
330
327
|
|
|
331
|
-
//
|
|
328
|
+
// ../InsForge/shared-schemas/dist/storage.schema.js
|
|
332
329
|
import { z as z3 } from "zod";
|
|
333
330
|
var storageFileSchema = z3.object({
|
|
334
331
|
key: z3.string(),
|
|
@@ -344,7 +341,7 @@ var storageBucketSchema = z3.object({
|
|
|
344
341
|
createdAt: z3.string()
|
|
345
342
|
});
|
|
346
343
|
|
|
347
|
-
//
|
|
344
|
+
// ../InsForge/shared-schemas/dist/storage-api.schema.js
|
|
348
345
|
import { z as z4 } from "zod";
|
|
349
346
|
var createBucketRequestSchema = z4.object({
|
|
350
347
|
bucketName: z4.string().min(1, "Bucket name cannot be empty"),
|
|
@@ -390,7 +387,7 @@ var confirmUploadRequestSchema = z4.object({
|
|
|
390
387
|
etag: z4.string().optional()
|
|
391
388
|
});
|
|
392
389
|
|
|
393
|
-
//
|
|
390
|
+
// ../InsForge/shared-schemas/dist/auth.schema.js
|
|
394
391
|
import { z as z5 } from "zod";
|
|
395
392
|
var userIdSchema = z5.string().uuid("Invalid user ID format");
|
|
396
393
|
var emailSchema = z5.string().email("Invalid email format").toLowerCase().trim();
|
|
@@ -473,7 +470,7 @@ var tokenPayloadSchema = z5.object({
|
|
|
473
470
|
// Expiration
|
|
474
471
|
});
|
|
475
472
|
|
|
476
|
-
//
|
|
473
|
+
// ../InsForge/shared-schemas/dist/auth-api.schema.js
|
|
477
474
|
import { z as z6 } from "zod";
|
|
478
475
|
var paginationSchema = z6.object({
|
|
479
476
|
limit: z6.string().optional(),
|
|
@@ -613,10 +610,10 @@ var authErrorResponseSchema = z6.object({
|
|
|
613
610
|
nextActions: z6.string().optional()
|
|
614
611
|
});
|
|
615
612
|
|
|
616
|
-
//
|
|
613
|
+
// ../InsForge/shared-schemas/dist/metadata.schema.js
|
|
617
614
|
import { z as z9 } from "zod";
|
|
618
615
|
|
|
619
|
-
//
|
|
616
|
+
// ../InsForge/shared-schemas/dist/realtime.schema.js
|
|
620
617
|
import { z as z7 } from "zod";
|
|
621
618
|
var senderTypeSchema = z7.enum(["system", "user"]);
|
|
622
619
|
var realtimeChannelSchema = z7.object({
|
|
@@ -691,7 +688,7 @@ var socketMessageSchema = z7.object({
|
|
|
691
688
|
meta: socketMessageMetaSchema
|
|
692
689
|
}).passthrough();
|
|
693
690
|
|
|
694
|
-
//
|
|
691
|
+
// ../InsForge/shared-schemas/dist/realtime-api.schema.js
|
|
695
692
|
import { z as z8 } from "zod";
|
|
696
693
|
var createChannelRequestSchema = z8.object({
|
|
697
694
|
pattern: z8.string().min(1, "Channel pattern is required"),
|
|
@@ -745,8 +742,10 @@ var realtimePermissionsResponseSchema = z8.object({
|
|
|
745
742
|
})
|
|
746
743
|
});
|
|
747
744
|
|
|
748
|
-
//
|
|
749
|
-
var authMetadataSchema =
|
|
745
|
+
// ../InsForge/shared-schemas/dist/metadata.schema.js
|
|
746
|
+
var authMetadataSchema = z9.object({
|
|
747
|
+
oauths: z9.array(oAuthConfigSchema)
|
|
748
|
+
});
|
|
750
749
|
var databaseMetadataSchema = z9.object({
|
|
751
750
|
tables: z9.array(z9.object({
|
|
752
751
|
tableName: z9.string(),
|
|
@@ -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,34 +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
|
-
"
|
|
1088
|
-
"auth-components-nextjs",
|
|
1089
|
-
"real-time",
|
|
1090
|
-
"deployment"
|
|
1117
|
+
"real-time"
|
|
1091
1118
|
]).describe(`
|
|
1092
|
-
Documentation type:
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
"
|
|
1096
|
-
"
|
|
1097
|
-
"
|
|
1098
|
-
"
|
|
1099
|
-
"auth-
|
|
1100
|
-
"
|
|
1101
|
-
"
|
|
1102
|
-
"
|
|
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"
|
|
1103
1160
|
`);
|
|
1104
1161
|
|
|
1105
|
-
//
|
|
1162
|
+
// ../InsForge/shared-schemas/dist/email-api.schema.js
|
|
1106
1163
|
import { z as z18 } from "zod";
|
|
1107
1164
|
var emailOrEmails = z18.union([
|
|
1108
1165
|
emailSchema,
|
|
@@ -1119,66 +1176,7 @@ var sendRawEmailRequestSchema = z18.object({
|
|
|
1119
1176
|
});
|
|
1120
1177
|
var sendEmailResponseSchema = z18.object({});
|
|
1121
1178
|
|
|
1122
|
-
// node_modules/@insforge/shared-schemas/dist/deployments.schema.js
|
|
1123
|
-
import { z as z19 } from "zod";
|
|
1124
|
-
var deploymentStatusSchema = z19.enum([
|
|
1125
|
-
"WAITING",
|
|
1126
|
-
// Record created, waiting for client to upload zip to S3
|
|
1127
|
-
"UPLOADING",
|
|
1128
|
-
// Server is downloading from S3 and uploading to Vercel
|
|
1129
|
-
"QUEUED",
|
|
1130
|
-
// Vercel: deployment queued
|
|
1131
|
-
"BUILDING",
|
|
1132
|
-
// Vercel: deployment building
|
|
1133
|
-
"READY",
|
|
1134
|
-
// Vercel: deployment ready
|
|
1135
|
-
"ERROR",
|
|
1136
|
-
// Vercel: deployment failed
|
|
1137
|
-
"CANCELED"
|
|
1138
|
-
// Vercel: deployment canceled
|
|
1139
|
-
]);
|
|
1140
|
-
var deploymentSchema = z19.object({
|
|
1141
|
-
id: z19.string().uuid(),
|
|
1142
|
-
providerDeploymentId: z19.string().nullable(),
|
|
1143
|
-
// Provider's deployment ID, null until deployment starts
|
|
1144
|
-
provider: z19.string(),
|
|
1145
|
-
status: deploymentStatusSchema,
|
|
1146
|
-
url: z19.string().nullable(),
|
|
1147
|
-
metadata: z19.record(z19.unknown()).nullable(),
|
|
1148
|
-
createdAt: z19.string(),
|
|
1149
|
-
updatedAt: z19.string()
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
// node_modules/@insforge/shared-schemas/dist/deployments-api.schema.js
|
|
1153
|
-
import { z as z20 } from "zod";
|
|
1154
|
-
var projectSettingsSchema = z20.object({
|
|
1155
|
-
buildCommand: z20.string().nullable().optional(),
|
|
1156
|
-
outputDirectory: z20.string().nullable().optional(),
|
|
1157
|
-
installCommand: z20.string().nullable().optional(),
|
|
1158
|
-
devCommand: z20.string().nullable().optional(),
|
|
1159
|
-
rootDirectory: z20.string().nullable().optional()
|
|
1160
|
-
});
|
|
1161
|
-
var envVarSchema = z20.object({
|
|
1162
|
-
key: z20.string(),
|
|
1163
|
-
value: z20.string()
|
|
1164
|
-
});
|
|
1165
|
-
var createDeploymentResponseSchema = z20.object({
|
|
1166
|
-
id: z20.string().uuid(),
|
|
1167
|
-
uploadUrl: z20.string().url(),
|
|
1168
|
-
uploadFields: z20.record(z20.string())
|
|
1169
|
-
// Required for S3 presigned POST (policy, signature, key, etc.)
|
|
1170
|
-
});
|
|
1171
|
-
var startDeploymentRequestSchema = z20.object({
|
|
1172
|
-
projectSettings: projectSettingsSchema.optional(),
|
|
1173
|
-
envVars: z20.array(envVarSchema).optional(),
|
|
1174
|
-
meta: z20.record(z20.string()).optional()
|
|
1175
|
-
});
|
|
1176
|
-
var listDeploymentsResponseSchema = z20.object({
|
|
1177
|
-
deployments: z20.array(deploymentSchema)
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
1179
|
// src/shared/tools.ts
|
|
1181
|
-
import FormData from "form-data";
|
|
1182
1180
|
var execAsync = promisify(exec);
|
|
1183
1181
|
var TOOL_VERSION_REQUIREMENTS = {
|
|
1184
1182
|
"upsert-schedule": "1.1.1",
|
|
@@ -1364,7 +1362,7 @@ ${context}`
|
|
|
1364
1362
|
"get-anon-key",
|
|
1365
1363
|
"Generate an anonymous JWT token that never expires. Requires admin API key. Use this for client-side applications that need public access.",
|
|
1366
1364
|
{
|
|
1367
|
-
apiKey:
|
|
1365
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)")
|
|
1368
1366
|
},
|
|
1369
1367
|
withUsageTracking("get-anon-key", async ({ apiKey }) => {
|
|
1370
1368
|
try {
|
|
@@ -1403,8 +1401,8 @@ ${context}`
|
|
|
1403
1401
|
"get-table-schema",
|
|
1404
1402
|
"Returns the detailed schema(including RLS, indexes, constraints, etc.) of a specific table",
|
|
1405
1403
|
{
|
|
1406
|
-
apiKey:
|
|
1407
|
-
tableName:
|
|
1404
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1405
|
+
tableName: z19.string().describe("Name of the table")
|
|
1408
1406
|
},
|
|
1409
1407
|
withUsageTracking("get-table-schema", async ({ apiKey, tableName }) => {
|
|
1410
1408
|
try {
|
|
@@ -1442,7 +1440,7 @@ ${context}`
|
|
|
1442
1440
|
"get-backend-metadata",
|
|
1443
1441
|
"Index all backend metadata",
|
|
1444
1442
|
{
|
|
1445
|
-
apiKey:
|
|
1443
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)")
|
|
1446
1444
|
},
|
|
1447
1445
|
withUsageTracking("get-backend-metadata", async ({ apiKey }) => {
|
|
1448
1446
|
try {
|
|
@@ -1482,7 +1480,7 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1482
1480
|
"run-raw-sql",
|
|
1483
1481
|
"Execute raw SQL query with optional parameters. Admin access required. Use with caution as it can modify data directly.",
|
|
1484
1482
|
{
|
|
1485
|
-
apiKey:
|
|
1483
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1486
1484
|
...rawSQLRequestSchema.shape
|
|
1487
1485
|
},
|
|
1488
1486
|
withUsageTracking("run-raw-sql", async ({ apiKey, query, params }) => {
|
|
@@ -1523,144 +1521,11 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1523
1521
|
}
|
|
1524
1522
|
})
|
|
1525
1523
|
);
|
|
1526
|
-
server.tool(
|
|
1527
|
-
"download-template",
|
|
1528
|
-
"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.",
|
|
1529
|
-
{
|
|
1530
|
-
frame: z21.enum(["react", "nextjs"]).describe("Framework to use for the template (support React and Next.js)"),
|
|
1531
|
-
projectName: z21.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")')
|
|
1532
|
-
},
|
|
1533
|
-
withUsageTracking("download-template", async ({ frame, projectName }) => {
|
|
1534
|
-
try {
|
|
1535
|
-
const response = await fetch2(`${API_BASE_URL}/api/auth/tokens/anon`, {
|
|
1536
|
-
method: "POST",
|
|
1537
|
-
headers: {
|
|
1538
|
-
"x-api-key": getApiKey(),
|
|
1539
|
-
"Content-Type": "application/json"
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
const result = await handleApiResponse(response);
|
|
1543
|
-
const anonKey = result.accessToken;
|
|
1544
|
-
if (!anonKey) {
|
|
1545
|
-
throw new Error("Failed to retrieve anon key from backend");
|
|
1546
|
-
}
|
|
1547
|
-
const tempDir = tmpdir();
|
|
1548
|
-
const targetDir = projectName || `insforge-${frame}`;
|
|
1549
|
-
const templatePath = `${tempDir}/${targetDir}`;
|
|
1550
|
-
console.error(`[download-template] Target path: ${templatePath}`);
|
|
1551
|
-
try {
|
|
1552
|
-
const stats = await fs.stat(templatePath);
|
|
1553
|
-
if (stats.isDirectory()) {
|
|
1554
|
-
console.error(`[download-template] Removing existing template at ${templatePath}`);
|
|
1555
|
-
await fs.rm(templatePath, { recursive: true, force: true });
|
|
1556
|
-
}
|
|
1557
|
-
} catch {
|
|
1558
|
-
}
|
|
1559
|
-
const command = `npx create-insforge-app ${targetDir} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey} --skip-install`;
|
|
1560
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
1561
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
1562
|
-
// 10MB buffer
|
|
1563
|
-
cwd: tempDir
|
|
1564
|
-
});
|
|
1565
|
-
const output = stdout || stderr || "";
|
|
1566
|
-
if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
|
|
1567
|
-
throw new Error(`Failed to download template: ${output}`);
|
|
1568
|
-
}
|
|
1569
|
-
return await addBackgroundContext({
|
|
1570
|
-
content: [
|
|
1571
|
-
{
|
|
1572
|
-
type: "text",
|
|
1573
|
-
text: `\u2705 React template downloaded successfully
|
|
1574
|
-
|
|
1575
|
-
\u{1F4C1} Template Location: ${templatePath}
|
|
1576
|
-
|
|
1577
|
-
\u26A0\uFE0F IMPORTANT: The template is in a temporary directory and NOT in your current working directory.
|
|
1578
|
-
|
|
1579
|
-
\u{1F534} CRITICAL NEXT STEP REQUIRED:
|
|
1580
|
-
You MUST copy ALL files (INCLUDING HIDDEN FILES like .env, .gitignore, etc.) from the temporary directory to your current project directory.
|
|
1581
|
-
|
|
1582
|
-
Copy all files from: ${templatePath}
|
|
1583
|
-
To: Your current project directory
|
|
1584
|
-
`
|
|
1585
|
-
}
|
|
1586
|
-
]
|
|
1587
|
-
});
|
|
1588
|
-
} catch (error) {
|
|
1589
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1590
|
-
return {
|
|
1591
|
-
content: [
|
|
1592
|
-
{
|
|
1593
|
-
type: "text",
|
|
1594
|
-
text: `Error downloading template: ${errMsg}`
|
|
1595
|
-
}
|
|
1596
|
-
],
|
|
1597
|
-
isError: true
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
})
|
|
1601
|
-
);
|
|
1602
|
-
server.tool(
|
|
1603
|
-
"bulk-upsert",
|
|
1604
|
-
"Bulk insert or update data from CSV or JSON file. Supports upsert operations with a unique key.",
|
|
1605
|
-
{
|
|
1606
|
-
apiKey: z21.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1607
|
-
...bulkUpsertRequestSchema.shape,
|
|
1608
|
-
filePath: z21.string().describe("Path to CSV or JSON file containing data to import")
|
|
1609
|
-
},
|
|
1610
|
-
withUsageTracking("bulk-upsert", async ({ apiKey, table, filePath, upsertKey }) => {
|
|
1611
|
-
try {
|
|
1612
|
-
const actualApiKey = getApiKey(apiKey);
|
|
1613
|
-
const fileBuffer = await fs.readFile(filePath);
|
|
1614
|
-
const fileName = filePath.split("/").pop() || "data.csv";
|
|
1615
|
-
const formData = new FormData();
|
|
1616
|
-
formData.append("file", fileBuffer, fileName);
|
|
1617
|
-
formData.append("table", table);
|
|
1618
|
-
if (upsertKey) {
|
|
1619
|
-
formData.append("upsertKey", upsertKey);
|
|
1620
|
-
}
|
|
1621
|
-
const response = await fetch2(`${API_BASE_URL}/api/database/advance/bulk-upsert`, {
|
|
1622
|
-
method: "POST",
|
|
1623
|
-
headers: {
|
|
1624
|
-
"x-api-key": actualApiKey,
|
|
1625
|
-
...formData.getHeaders()
|
|
1626
|
-
},
|
|
1627
|
-
body: formData
|
|
1628
|
-
});
|
|
1629
|
-
const result = await handleApiResponse(response);
|
|
1630
|
-
const message = result.success ? `Successfully processed ${result.rowsAffected} of ${result.totalRecords} records into table "${result.table}"` : result.message || "Bulk upsert operation completed";
|
|
1631
|
-
return await addBackgroundContext({
|
|
1632
|
-
content: [
|
|
1633
|
-
{
|
|
1634
|
-
type: "text",
|
|
1635
|
-
text: formatSuccessMessage("Bulk upsert completed", {
|
|
1636
|
-
message,
|
|
1637
|
-
table: result.table,
|
|
1638
|
-
rowsAffected: result.rowsAffected,
|
|
1639
|
-
totalRecords: result.totalRecords,
|
|
1640
|
-
errors: result.errors
|
|
1641
|
-
})
|
|
1642
|
-
}
|
|
1643
|
-
]
|
|
1644
|
-
});
|
|
1645
|
-
} catch (error) {
|
|
1646
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
1647
|
-
return {
|
|
1648
|
-
content: [
|
|
1649
|
-
{
|
|
1650
|
-
type: "text",
|
|
1651
|
-
text: `Error performing bulk upsert: ${errMsg}`
|
|
1652
|
-
}
|
|
1653
|
-
],
|
|
1654
|
-
isError: true
|
|
1655
|
-
};
|
|
1656
|
-
}
|
|
1657
|
-
})
|
|
1658
|
-
);
|
|
1659
1524
|
server.tool(
|
|
1660
1525
|
"create-bucket",
|
|
1661
1526
|
"Create new storage bucket",
|
|
1662
1527
|
{
|
|
1663
|
-
apiKey:
|
|
1528
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1664
1529
|
...createBucketRequestSchema.shape
|
|
1665
1530
|
},
|
|
1666
1531
|
withUsageTracking("create-bucket", async ({ apiKey, bucketName, isPublic }) => {
|
|
@@ -1736,8 +1601,8 @@ To: Your current project directory
|
|
|
1736
1601
|
"delete-bucket",
|
|
1737
1602
|
"Deletes a storage bucket",
|
|
1738
1603
|
{
|
|
1739
|
-
apiKey:
|
|
1740
|
-
bucketName:
|
|
1604
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1605
|
+
bucketName: z19.string().describe("Name of the bucket to delete")
|
|
1741
1606
|
},
|
|
1742
1607
|
withUsageTracking("delete-bucket", async ({ apiKey, bucketName }) => {
|
|
1743
1608
|
try {
|
|
@@ -1776,7 +1641,7 @@ To: Your current project directory
|
|
|
1776
1641
|
"Create a new edge function that runs in Deno runtime. The code must be written to a file first for version control",
|
|
1777
1642
|
{
|
|
1778
1643
|
...functionUploadRequestSchema.omit({ code: true }).shape,
|
|
1779
|
-
codeFile:
|
|
1644
|
+
codeFile: z19.string().describe(
|
|
1780
1645
|
"Path to JavaScript file containing the function code. Must export: module.exports = async function(request) { return new Response(...) }"
|
|
1781
1646
|
)
|
|
1782
1647
|
},
|
|
@@ -1834,7 +1699,7 @@ To: Your current project directory
|
|
|
1834
1699
|
"get-function",
|
|
1835
1700
|
"Get details of a specific edge function including its code",
|
|
1836
1701
|
{
|
|
1837
|
-
slug:
|
|
1702
|
+
slug: z19.string().describe("The slug identifier of the function")
|
|
1838
1703
|
},
|
|
1839
1704
|
withUsageTracking("get-function", async (args) => {
|
|
1840
1705
|
try {
|
|
@@ -1871,9 +1736,9 @@ To: Your current project directory
|
|
|
1871
1736
|
"update-function",
|
|
1872
1737
|
"Update an existing edge function code or metadata",
|
|
1873
1738
|
{
|
|
1874
|
-
slug:
|
|
1739
|
+
slug: z19.string().describe("The slug identifier of the function to update"),
|
|
1875
1740
|
...functionUpdateRequestSchema.omit({ code: true }).shape,
|
|
1876
|
-
codeFile:
|
|
1741
|
+
codeFile: z19.string().optional().describe(
|
|
1877
1742
|
"Path to JavaScript file containing the new function code. Must export: module.exports = async function(request) { return new Response(...) }"
|
|
1878
1743
|
)
|
|
1879
1744
|
},
|
|
@@ -1937,7 +1802,7 @@ To: Your current project directory
|
|
|
1937
1802
|
"delete-function",
|
|
1938
1803
|
"Delete an edge function permanently",
|
|
1939
1804
|
{
|
|
1940
|
-
slug:
|
|
1805
|
+
slug: z19.string().describe("The slug identifier of the function to delete")
|
|
1941
1806
|
},
|
|
1942
1807
|
withUsageTracking("delete-function", async (args) => {
|
|
1943
1808
|
try {
|
|
@@ -1974,9 +1839,9 @@ To: Your current project directory
|
|
|
1974
1839
|
"get-container-logs",
|
|
1975
1840
|
"Get latest logs from a specific container/service. Use this to help debug problems with your app.",
|
|
1976
1841
|
{
|
|
1977
|
-
apiKey:
|
|
1978
|
-
source:
|
|
1979
|
-
limit:
|
|
1842
|
+
apiKey: z19.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
|
|
1843
|
+
source: z19.enum(["insforge.logs", "postgREST.logs", "postgres.logs", "function.logs"]).describe("Log source to retrieve"),
|
|
1844
|
+
limit: z19.number().optional().default(20).describe("Number of logs to return (default: 20)")
|
|
1980
1845
|
},
|
|
1981
1846
|
withUsageTracking("get-container-logs", async ({ apiKey, source, limit }) => {
|
|
1982
1847
|
try {
|
|
@@ -2020,113 +1885,10 @@ To: Your current project directory
|
|
|
2020
1885
|
}
|
|
2021
1886
|
})
|
|
2022
1887
|
);
|
|
2023
|
-
server.tool(
|
|
2024
|
-
"create-deployment",
|
|
2025
|
-
"Deploy source code from a directory. This tool zips files, uploads to cloud storage, and triggers deployment with optional environment variables and project settings.",
|
|
2026
|
-
{
|
|
2027
|
-
sourceDirectory: z21.string().describe("Path to the source directory containing files to deploy"),
|
|
2028
|
-
...startDeploymentRequestSchema.shape
|
|
2029
|
-
},
|
|
2030
|
-
withUsageTracking("create-deployment", async ({ sourceDirectory, projectSettings, envVars, meta }) => {
|
|
2031
|
-
try {
|
|
2032
|
-
const resolvedSourceDir = path.resolve(sourceDirectory);
|
|
2033
|
-
const createResponse = await fetch2(`${API_BASE_URL}/api/deployments`, {
|
|
2034
|
-
method: "POST",
|
|
2035
|
-
headers: {
|
|
2036
|
-
"x-api-key": getApiKey(),
|
|
2037
|
-
"Content-Type": "application/json"
|
|
2038
|
-
}
|
|
2039
|
-
});
|
|
2040
|
-
const createResult = await handleApiResponse(createResponse);
|
|
2041
|
-
const { id: deploymentId, uploadUrl, uploadFields } = createResult;
|
|
2042
|
-
const zipBuffer = await new Promise((resolve, reject) => {
|
|
2043
|
-
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
2044
|
-
const chunks = [];
|
|
2045
|
-
archive.on("data", (chunk) => chunks.push(chunk));
|
|
2046
|
-
archive.on("end", () => resolve(Buffer.concat(chunks)));
|
|
2047
|
-
archive.on("error", (err) => reject(err));
|
|
2048
|
-
archive.on("warning", (err) => {
|
|
2049
|
-
console.warn("Archiver warning:", err.message);
|
|
2050
|
-
});
|
|
2051
|
-
const excludePatterns = [
|
|
2052
|
-
"node_modules",
|
|
2053
|
-
".git",
|
|
2054
|
-
".next",
|
|
2055
|
-
"dist",
|
|
2056
|
-
"build",
|
|
2057
|
-
".env.local",
|
|
2058
|
-
".DS_Store"
|
|
2059
|
-
];
|
|
2060
|
-
archive.directory(resolvedSourceDir, false, (entry) => {
|
|
2061
|
-
const normalizedName = entry.name.replace(/\\/g, "/");
|
|
2062
|
-
for (const pattern of excludePatterns) {
|
|
2063
|
-
if (normalizedName.startsWith(pattern + "/") || normalizedName === pattern || normalizedName.endsWith("/" + pattern) || normalizedName.includes("/" + pattern + "/")) {
|
|
2064
|
-
return false;
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
if (normalizedName.endsWith(".log")) {
|
|
2068
|
-
return false;
|
|
2069
|
-
}
|
|
2070
|
-
return entry;
|
|
2071
|
-
});
|
|
2072
|
-
archive.finalize();
|
|
2073
|
-
});
|
|
2074
|
-
const uploadFormData = new FormData();
|
|
2075
|
-
for (const [key, value] of Object.entries(uploadFields)) {
|
|
2076
|
-
uploadFormData.append(key, value);
|
|
2077
|
-
}
|
|
2078
|
-
uploadFormData.append("file", zipBuffer, {
|
|
2079
|
-
filename: "deployment.zip",
|
|
2080
|
-
contentType: "application/zip"
|
|
2081
|
-
});
|
|
2082
|
-
const uploadResponse = await fetch2(uploadUrl, {
|
|
2083
|
-
method: "POST",
|
|
2084
|
-
body: uploadFormData,
|
|
2085
|
-
headers: uploadFormData.getHeaders()
|
|
2086
|
-
});
|
|
2087
|
-
if (!uploadResponse.ok) {
|
|
2088
|
-
const uploadError = await uploadResponse.text();
|
|
2089
|
-
throw new Error(`Failed to upload zip file: ${uploadError}`);
|
|
2090
|
-
}
|
|
2091
|
-
const startBody = {};
|
|
2092
|
-
if (projectSettings) startBody.projectSettings = projectSettings;
|
|
2093
|
-
if (envVars) startBody.envVars = envVars;
|
|
2094
|
-
if (meta) startBody.meta = meta;
|
|
2095
|
-
const startResponse = await fetch2(`${API_BASE_URL}/api/deployments/${deploymentId}/start`, {
|
|
2096
|
-
method: "POST",
|
|
2097
|
-
headers: {
|
|
2098
|
-
"x-api-key": getApiKey(),
|
|
2099
|
-
"Content-Type": "application/json"
|
|
2100
|
-
},
|
|
2101
|
-
body: JSON.stringify(startBody)
|
|
2102
|
-
});
|
|
2103
|
-
const startResult = await handleApiResponse(startResponse);
|
|
2104
|
-
return await addBackgroundContext({
|
|
2105
|
-
content: [
|
|
2106
|
-
{
|
|
2107
|
-
type: "text",
|
|
2108
|
-
text: formatSuccessMessage("Deployment started", startResult) + "\n\nNote: You can check deployment status by querying the system.deployments table."
|
|
2109
|
-
}
|
|
2110
|
-
]
|
|
2111
|
-
});
|
|
2112
|
-
} catch (error) {
|
|
2113
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2114
|
-
return {
|
|
2115
|
-
content: [
|
|
2116
|
-
{
|
|
2117
|
-
type: "text",
|
|
2118
|
-
text: `Error creating deployment: ${errMsg}`
|
|
2119
|
-
}
|
|
2120
|
-
],
|
|
2121
|
-
isError: true
|
|
2122
|
-
};
|
|
2123
|
-
}
|
|
2124
|
-
})
|
|
2125
|
-
);
|
|
2126
1888
|
return {
|
|
2127
1889
|
apiKey: GLOBAL_API_KEY,
|
|
2128
1890
|
apiBaseUrl: API_BASE_URL,
|
|
2129
|
-
toolCount:
|
|
1891
|
+
toolCount: 15
|
|
2130
1892
|
};
|
|
2131
1893
|
}
|
|
2132
1894
|
|
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.4-
|
|
3
|
+
"version": "1.2.4-dev.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,10 +36,9 @@
|
|
|
36
36
|
"server.json"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@insforge/shared-schemas": "1.1.
|
|
39
|
+
"@insforge/shared-schemas": "^1.1.36",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
41
41
|
"@types/express": "^5.0.3",
|
|
42
|
-
"archiver": "^7.0.1",
|
|
43
42
|
"commander": "^14.0.0",
|
|
44
43
|
"express": "^5.1.0",
|
|
45
44
|
"form-data": "^4.0.4",
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
"zod": "^3.23.8"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@types/archiver": "^7.0.0",
|
|
51
49
|
"@types/node": "^20.10.5",
|
|
52
50
|
"rimraf": "^5.0.5",
|
|
53
51
|
"tsup": "^8.5.0",
|