@insforge/mcp 1.0.54 → 1.1.0

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.
Files changed (2) hide show
  1. package/dist/index.js +76 -3
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
  import { z as z12 } from "zod";
7
7
  import fetch2 from "node-fetch";
8
+ import FormData from "form-data";
8
9
  import { program } from "commander";
9
10
  import { promises as fs } from "fs";
10
11
 
@@ -270,6 +271,19 @@ var importResponseSchema = z2.object({
270
271
  rowsImported: z2.number(),
271
272
  fileSize: z2.number()
272
273
  });
274
+ var bulkUpsertRequestSchema = z2.object({
275
+ table: z2.string().min(1, "Table name is required"),
276
+ upsertKey: z2.string().optional()
277
+ // Note: File handling is done at the API layer via multipart/form-data
278
+ });
279
+ var bulkUpsertResponseSchema = z2.object({
280
+ success: z2.boolean(),
281
+ message: z2.string(),
282
+ table: z2.string(),
283
+ rowsAffected: z2.number(),
284
+ totalRecords: z2.number(),
285
+ filename: z2.string()
286
+ });
273
287
 
274
288
  // node_modules/@insforge/shared-schemas/dist/storage.schema.js
275
289
  import { z as z3 } from "zod";
@@ -470,7 +484,8 @@ var edgeFunctionMetadataSchema = z7.object({
470
484
  });
471
485
  var aiMetadataSchema = z7.object({
472
486
  models: z7.array(z7.object({
473
- modality: z7.string(),
487
+ inputModality: z7.array(z7.string()),
488
+ outputModality: z7.array(z7.string()),
474
489
  modelId: z7.string()
475
490
  }))
476
491
  });
@@ -485,10 +500,11 @@ var appMetaDataSchema = z7.object({
485
500
 
486
501
  // node_modules/@insforge/shared-schemas/dist/ai.schema.js
487
502
  import { z as z8 } from "zod";
488
- var modalitySchema = z8.enum(["text", "image", "audio", "video", "multi"]);
503
+ var modalitySchema = z8.enum(["text", "image"]);
489
504
  var aiConfigurationSchema = z8.object({
490
505
  id: z8.string().uuid(),
491
- modality: modalitySchema,
506
+ inputModality: z8.array(modalitySchema).min(1),
507
+ outputModality: z8.array(modalitySchema).min(1),
492
508
  provider: z8.string(),
493
509
  modelId: z8.string(),
494
510
  systemPrompt: z8.string().optional()
@@ -930,6 +946,63 @@ server.tool(
930
946
  }
931
947
  })
932
948
  );
949
+ server.tool(
950
+ "bulk-upsert",
951
+ "Bulk insert or update data from CSV or JSON file. Supports upsert operations with a unique key.",
952
+ {
953
+ apiKey: z12.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
954
+ ...bulkUpsertRequestSchema.shape,
955
+ filePath: z12.string().describe("Path to CSV or JSON file containing data to import")
956
+ },
957
+ withUsageTracking("bulk-upsert", async ({ apiKey, table, filePath, upsertKey }) => {
958
+ try {
959
+ const actualApiKey = getApiKey(apiKey);
960
+ const fileBuffer = await fs.readFile(filePath);
961
+ const fileName = filePath.split("/").pop() || "data.csv";
962
+ const formData = new FormData();
963
+ formData.append("file", fileBuffer, fileName);
964
+ formData.append("table", table);
965
+ if (upsertKey) {
966
+ formData.append("upsertKey", upsertKey);
967
+ }
968
+ const response = await fetch2(`${API_BASE_URL}/api/database/advance/bulk-upsert`, {
969
+ method: "POST",
970
+ headers: {
971
+ "x-api-key": actualApiKey,
972
+ ...formData.getHeaders()
973
+ },
974
+ body: formData
975
+ });
976
+ const result = await handleApiResponse(response);
977
+ const message = result.success ? `Successfully processed ${result.rowsAffected} of ${result.totalRecords} records into table "${result.table}"` : result.message || "Bulk upsert operation completed";
978
+ return await addBackgroundContext({
979
+ content: [
980
+ {
981
+ type: "text",
982
+ text: formatSuccessMessage("Bulk upsert completed", {
983
+ message,
984
+ table: result.table,
985
+ rowsAffected: result.rowsAffected,
986
+ totalRecords: result.totalRecords,
987
+ errors: result.errors
988
+ })
989
+ }
990
+ ]
991
+ });
992
+ } catch (error) {
993
+ const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
994
+ return await addBackgroundContext({
995
+ content: [
996
+ {
997
+ type: "text",
998
+ text: `Error performing bulk upsert: ${errMsg}`
999
+ }
1000
+ ],
1001
+ isError: true
1002
+ });
1003
+ }
1004
+ })
1005
+ );
933
1006
  server.tool(
934
1007
  "create-bucket",
935
1008
  "Create new storage bucket",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insforge/mcp",
3
- "version": "1.0.54",
3
+ "version": "1.1.0",
4
4
  "description": "MCP (Model Context Protocol) server for Insforge backend-as-a-service",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,9 +24,10 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@insforge/shared-schemas": "^1.0.8",
27
+ "@insforge/shared-schemas": "^1.1.0",
28
28
  "@modelcontextprotocol/sdk": "^1.15.1",
29
29
  "commander": "^14.0.0",
30
+ "form-data": "^4.0.4",
30
31
  "node-fetch": "^3.3.2",
31
32
  "zod": "^3.23.8"
32
33
  },