@insforge/mcp 1.1.6 → 1.1.7-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.
@@ -747,16 +747,11 @@ function registerInsforgeTools(server, config = {}) {
747
747
  }
748
748
  };
749
749
  }
750
- const getApiKey = (toolApiKey) => {
751
- if (GLOBAL_API_KEY) {
752
- return GLOBAL_API_KEY;
753
- }
754
- if (toolApiKey) {
755
- return toolApiKey;
750
+ const getApiKey = (_toolApiKey) => {
751
+ if (!GLOBAL_API_KEY) {
752
+ throw new Error("API key is required. Pass --api_key when starting the MCP server.");
756
753
  }
757
- throw new Error(
758
- "API key is required. Either pass --api_key as command line argument or provide api_key in tool calls."
759
- );
754
+ return GLOBAL_API_KEY;
760
755
  };
761
756
  const fetchDocumentation = async (docType) => {
762
757
  try {
@@ -778,28 +773,6 @@ function registerInsforgeTools(server, config = {}) {
778
773
  throw new Error(`Unable to retrieve ${docType} documentation: ${errMsg}`);
779
774
  }
780
775
  };
781
- const fetchInsforgeInstructionsContext = async () => {
782
- try {
783
- return await fetchDocumentation("instructions");
784
- } catch (error) {
785
- console.error("Failed to fetch insforge-instructions.md:", error);
786
- return null;
787
- }
788
- };
789
- const addBackgroundContext = async (response) => {
790
- const context = await fetchInsforgeInstructionsContext();
791
- if (context && response.content && Array.isArray(response.content)) {
792
- response.content.push({
793
- type: "text",
794
- text: `
795
-
796
- ---
797
- \u{1F527} INSFORGE DEVELOPMENT RULES (Auto-loaded):
798
- ${context}`
799
- });
800
- }
801
- return response;
802
- };
803
776
  server.tool(
804
777
  "get-instructions",
805
778
  "Instruction Essential backend setup tool. <critical>MANDATORY: You MUST use this tool FIRST before attempting any backend operations. Contains required API endpoints, authentication details, and setup instructions.</critical>",
@@ -807,7 +780,7 @@ ${context}`
807
780
  withUsageTracking("get-instructions", async () => {
808
781
  try {
809
782
  const content = await fetchDocumentation("instructions");
810
- const response = {
783
+ return {
811
784
  content: [
812
785
  {
813
786
  type: "text",
@@ -815,33 +788,14 @@ ${context}`
815
788
  }
816
789
  ]
817
790
  };
818
- return await addBackgroundContext(response);
819
791
  } catch (error) {
820
792
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
821
- const errorResponse = {
793
+ return {
822
794
  content: [{ type: "text", text: `Error: ${errMsg}` }]
823
795
  };
824
- return await addBackgroundContext(errorResponse);
825
796
  }
826
797
  })
827
798
  );
828
- server.tool(
829
- "get-api-key",
830
- "Retrieves the API key for the Insforge OSS backend. This is used to authenticate all requests to the backend.",
831
- {},
832
- async () => {
833
- try {
834
- return await addBackgroundContext({
835
- content: [{ type: "text", text: `API key: ${getApiKey()}` }]
836
- });
837
- } catch (error) {
838
- const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
839
- return await addBackgroundContext({
840
- content: [{ type: "text", text: `Error: ${errMsg}` }]
841
- });
842
- }
843
- }
844
- );
845
799
  server.tool(
846
800
  "get-table-schema",
847
801
  "Returns the detailed schema(including RLS, indexes, constraints, etc.) of a specific table",
@@ -859,17 +813,17 @@ ${context}`
859
813
  }
860
814
  });
861
815
  const result = await handleApiResponse(response);
862
- return await addBackgroundContext({
816
+ return {
863
817
  content: [
864
818
  {
865
819
  type: "text",
866
820
  text: formatSuccessMessage("Schema retrieved", result)
867
821
  }
868
822
  ]
869
- });
823
+ };
870
824
  } catch (error) {
871
825
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
872
- return await addBackgroundContext({
826
+ return {
873
827
  content: [
874
828
  {
875
829
  type: "text",
@@ -877,7 +831,7 @@ ${context}`
877
831
  }
878
832
  ],
879
833
  isError: true
880
- });
834
+ };
881
835
  }
882
836
  })
883
837
  );
@@ -897,7 +851,7 @@ ${context}`
897
851
  }
898
852
  });
899
853
  const metadata = await handleApiResponse(response);
900
- return await addBackgroundContext({
854
+ return {
901
855
  content: [
902
856
  {
903
857
  type: "text",
@@ -906,10 +860,10 @@ ${context}`
906
860
  ${JSON.stringify(metadata, null, 2)}`
907
861
  }
908
862
  ]
909
- });
863
+ };
910
864
  } catch (error) {
911
865
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
912
- return await addBackgroundContext({
866
+ return {
913
867
  content: [
914
868
  {
915
869
  type: "text",
@@ -917,7 +871,7 @@ ${JSON.stringify(metadata, null, 2)}`
917
871
  }
918
872
  ],
919
873
  isError: true
920
- });
874
+ };
921
875
  }
922
876
  })
923
877
  );
@@ -944,17 +898,17 @@ ${JSON.stringify(metadata, null, 2)}`
944
898
  body: JSON.stringify(requestBody)
945
899
  });
946
900
  const result = await handleApiResponse(response);
947
- return await addBackgroundContext({
901
+ return {
948
902
  content: [
949
903
  {
950
904
  type: "text",
951
905
  text: formatSuccessMessage("SQL query executed", result)
952
906
  }
953
907
  ]
954
- });
908
+ };
955
909
  } catch (error) {
956
910
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
957
- return await addBackgroundContext({
911
+ return {
958
912
  content: [
959
913
  {
960
914
  type: "text",
@@ -962,7 +916,7 @@ ${JSON.stringify(metadata, null, 2)}`
962
916
  }
963
917
  ],
964
918
  isError: true
965
- });
919
+ };
966
920
  }
967
921
  })
968
922
  );
@@ -995,7 +949,7 @@ ${JSON.stringify(metadata, null, 2)}`
995
949
  });
996
950
  const result = await handleApiResponse(response);
997
951
  const message = result.success ? `Successfully processed ${result.rowsAffected} of ${result.totalRecords} records into table "${result.table}"` : result.message || "Bulk upsert operation completed";
998
- return await addBackgroundContext({
952
+ return {
999
953
  content: [
1000
954
  {
1001
955
  type: "text",
@@ -1008,10 +962,10 @@ ${JSON.stringify(metadata, null, 2)}`
1008
962
  })
1009
963
  }
1010
964
  ]
1011
- });
965
+ };
1012
966
  } catch (error) {
1013
967
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1014
- return await addBackgroundContext({
968
+ return {
1015
969
  content: [
1016
970
  {
1017
971
  type: "text",
@@ -1019,7 +973,7 @@ ${JSON.stringify(metadata, null, 2)}`
1019
973
  }
1020
974
  ],
1021
975
  isError: true
1022
- });
976
+ };
1023
977
  }
1024
978
  })
1025
979
  );
@@ -1042,17 +996,17 @@ ${JSON.stringify(metadata, null, 2)}`
1042
996
  body: JSON.stringify({ bucketName, isPublic })
1043
997
  });
1044
998
  const result = await handleApiResponse(response);
1045
- return await addBackgroundContext({
999
+ return {
1046
1000
  content: [
1047
1001
  {
1048
1002
  type: "text",
1049
1003
  text: formatSuccessMessage("Bucket created", result)
1050
1004
  }
1051
1005
  ]
1052
- });
1006
+ };
1053
1007
  } catch (error) {
1054
1008
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1055
- return await addBackgroundContext({
1009
+ return {
1056
1010
  content: [
1057
1011
  {
1058
1012
  type: "text",
@@ -1060,7 +1014,7 @@ ${JSON.stringify(metadata, null, 2)}`
1060
1014
  }
1061
1015
  ],
1062
1016
  isError: true
1063
- });
1017
+ };
1064
1018
  }
1065
1019
  })
1066
1020
  );
@@ -1077,17 +1031,17 @@ ${JSON.stringify(metadata, null, 2)}`
1077
1031
  }
1078
1032
  });
1079
1033
  const result = await handleApiResponse(response);
1080
- return await addBackgroundContext({
1034
+ return {
1081
1035
  content: [
1082
1036
  {
1083
1037
  type: "text",
1084
1038
  text: formatSuccessMessage("Buckets retrieved", result)
1085
1039
  }
1086
1040
  ]
1087
- });
1041
+ };
1088
1042
  } catch (error) {
1089
1043
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1090
- return await addBackgroundContext({
1044
+ return {
1091
1045
  content: [
1092
1046
  {
1093
1047
  type: "text",
@@ -1095,7 +1049,7 @@ ${JSON.stringify(metadata, null, 2)}`
1095
1049
  }
1096
1050
  ],
1097
1051
  isError: true
1098
- });
1052
+ };
1099
1053
  }
1100
1054
  })
1101
1055
  );
@@ -1116,17 +1070,17 @@ ${JSON.stringify(metadata, null, 2)}`
1116
1070
  }
1117
1071
  });
1118
1072
  const result = await handleApiResponse(response);
1119
- return await addBackgroundContext({
1073
+ return {
1120
1074
  content: [
1121
1075
  {
1122
1076
  type: "text",
1123
1077
  text: formatSuccessMessage("Bucket deleted", result)
1124
1078
  }
1125
1079
  ]
1126
- });
1080
+ };
1127
1081
  } catch (error) {
1128
1082
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1129
- return await addBackgroundContext({
1083
+ return {
1130
1084
  content: [
1131
1085
  {
1132
1086
  type: "text",
@@ -1134,7 +1088,7 @@ ${JSON.stringify(metadata, null, 2)}`
1134
1088
  }
1135
1089
  ],
1136
1090
  isError: true
1137
- });
1091
+ };
1138
1092
  }
1139
1093
  })
1140
1094
  );
@@ -1172,7 +1126,7 @@ ${JSON.stringify(metadata, null, 2)}`
1172
1126
  })
1173
1127
  });
1174
1128
  const result = await handleApiResponse(response);
1175
- return await addBackgroundContext({
1129
+ return {
1176
1130
  content: [
1177
1131
  {
1178
1132
  type: "text",
@@ -1182,10 +1136,10 @@ ${JSON.stringify(metadata, null, 2)}`
1182
1136
  )
1183
1137
  }
1184
1138
  ]
1185
- });
1139
+ };
1186
1140
  } catch (error) {
1187
1141
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1188
- return await addBackgroundContext({
1142
+ return {
1189
1143
  content: [
1190
1144
  {
1191
1145
  type: "text",
@@ -1193,7 +1147,7 @@ ${JSON.stringify(metadata, null, 2)}`
1193
1147
  }
1194
1148
  ],
1195
1149
  isError: true
1196
- });
1150
+ };
1197
1151
  }
1198
1152
  })
1199
1153
  );
@@ -1212,17 +1166,17 @@ ${JSON.stringify(metadata, null, 2)}`
1212
1166
  }
1213
1167
  });
1214
1168
  const result = await handleApiResponse(response);
1215
- return await addBackgroundContext({
1169
+ return {
1216
1170
  content: [
1217
1171
  {
1218
1172
  type: "text",
1219
1173
  text: formatSuccessMessage(`Edge function '${args.slug}' details`, result)
1220
1174
  }
1221
1175
  ]
1222
- });
1176
+ };
1223
1177
  } catch (error) {
1224
1178
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1225
- return await addBackgroundContext({
1179
+ return {
1226
1180
  content: [
1227
1181
  {
1228
1182
  type: "text",
@@ -1230,7 +1184,7 @@ ${JSON.stringify(metadata, null, 2)}`
1230
1184
  }
1231
1185
  ],
1232
1186
  isError: true
1233
- });
1187
+ };
1234
1188
  }
1235
1189
  })
1236
1190
  );
@@ -1275,7 +1229,7 @@ ${JSON.stringify(metadata, null, 2)}`
1275
1229
  });
1276
1230
  const result = await handleApiResponse(response);
1277
1231
  const fileInfo = args.codeFile ? ` from ${args.codeFile}` : "";
1278
- return await addBackgroundContext({
1232
+ return {
1279
1233
  content: [
1280
1234
  {
1281
1235
  type: "text",
@@ -1285,10 +1239,10 @@ ${JSON.stringify(metadata, null, 2)}`
1285
1239
  )
1286
1240
  }
1287
1241
  ]
1288
- });
1242
+ };
1289
1243
  } catch (error) {
1290
1244
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1291
- return await addBackgroundContext({
1245
+ return {
1292
1246
  content: [
1293
1247
  {
1294
1248
  type: "text",
@@ -1296,7 +1250,7 @@ ${JSON.stringify(metadata, null, 2)}`
1296
1250
  }
1297
1251
  ],
1298
1252
  isError: true
1299
- });
1253
+ };
1300
1254
  }
1301
1255
  })
1302
1256
  );
@@ -1315,17 +1269,17 @@ ${JSON.stringify(metadata, null, 2)}`
1315
1269
  }
1316
1270
  });
1317
1271
  const result = await handleApiResponse(response);
1318
- return await addBackgroundContext({
1272
+ return {
1319
1273
  content: [
1320
1274
  {
1321
1275
  type: "text",
1322
1276
  text: formatSuccessMessage(`Edge function '${args.slug}' deleted successfully`, result)
1323
1277
  }
1324
1278
  ]
1325
- });
1279
+ };
1326
1280
  } catch (error) {
1327
1281
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1328
- return await addBackgroundContext({
1282
+ return {
1329
1283
  content: [
1330
1284
  {
1331
1285
  type: "text",
@@ -1333,7 +1287,7 @@ ${JSON.stringify(metadata, null, 2)}`
1333
1287
  }
1334
1288
  ],
1335
1289
  isError: true
1336
- });
1290
+ };
1337
1291
  }
1338
1292
  })
1339
1293
  );
@@ -1350,32 +1304,24 @@ ${JSON.stringify(metadata, null, 2)}`
1350
1304
  const actualApiKey = getApiKey(apiKey);
1351
1305
  const queryParams = new URLSearchParams();
1352
1306
  if (limit) queryParams.append("limit", limit.toString());
1353
- let response = await fetch2(`${API_BASE_URL}/api/logs/${source}?${queryParams}`, {
1307
+ const response = await fetch2(`${API_BASE_URL}/api/logs/analytics/${source}?${queryParams}`, {
1354
1308
  method: "GET",
1355
1309
  headers: {
1356
1310
  "x-api-key": actualApiKey
1357
1311
  }
1358
1312
  });
1359
- if (response.status === 404) {
1360
- response = await fetch2(`${API_BASE_URL}/api/logs/analytics/${source}?${queryParams}`, {
1361
- method: "GET",
1362
- headers: {
1363
- "x-api-key": actualApiKey
1364
- }
1365
- });
1366
- }
1367
1313
  const result = await handleApiResponse(response);
1368
- return await addBackgroundContext({
1314
+ return {
1369
1315
  content: [
1370
1316
  {
1371
1317
  type: "text",
1372
1318
  text: formatSuccessMessage(`Latest logs from ${source}`, result)
1373
1319
  }
1374
1320
  ]
1375
- });
1321
+ };
1376
1322
  } catch (error) {
1377
1323
  const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1378
- return await addBackgroundContext({
1324
+ return {
1379
1325
  content: [
1380
1326
  {
1381
1327
  type: "text",
@@ -1383,7 +1329,7 @@ ${JSON.stringify(metadata, null, 2)}`
1383
1329
  }
1384
1330
  ],
1385
1331
  isError: true
1386
- });
1332
+ };
1387
1333
  }
1388
1334
  })
1389
1335
  );
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-7CREF7XU.js";
4
+ } from "./chunk-CGHSBGKB.js";
5
5
 
6
6
  // src/http/server.ts
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-7CREF7XU.js";
4
+ } from "./chunk-CGHSBGKB.js";
5
5
 
6
6
  // src/stdio/index.ts
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@insforge/mcp",
3
- "version": "1.1.6",
3
+ "version": "1.1.7-dev.1",
4
4
  "description": "MCP (Model Context Protocol) server for Insforge backend-as-a-service",
5
- "mcpName": "io.github.insforge/insforge-mcp",
6
5
  "type": "module",
7
6
  "main": "dist/index.js",
8
7
  "bin": {
@@ -32,8 +31,7 @@
32
31
  },
33
32
  "files": [
34
33
  "dist",
35
- "mcp.json",
36
- "server.json"
34
+ "mcp.json"
37
35
  ],
38
36
  "dependencies": {
39
37
  "@insforge/shared-schemas": "^1.1.1",
package/server.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
3
- "name": "io.github.InsForge/insforge-mcp",
4
- "title": "Insforge",
5
- "description": "MCP server for Insforge BaaS - database, auth, storage, edge functions, and container logs",
6
- "version": "1.1.5",
7
- "packages": [
8
- {
9
- "registryType": "npm",
10
- "identifier": "@insforge/mcp",
11
- "version": "1.1.5",
12
- "transport": {
13
- "type": "stdio"
14
- }
15
- }
16
- ]
17
- }