@insforge/mcp 1.1.7-dev.15 → 1.1.7-dev.17

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.
@@ -4,6 +4,8 @@
4
4
  import { z as z14 } from "zod";
5
5
  import fetch2 from "node-fetch";
6
6
  import { promises as fs } from "fs";
7
+ import { exec } from "child_process";
8
+ import { promisify } from "util";
7
9
 
8
10
  // src/shared/response-handler.ts
9
11
  async function handleApiResponse(response) {
@@ -735,6 +737,7 @@ var functionUpdateRequestSchema = z13.object({
735
737
 
736
738
  // src/shared/tools.ts
737
739
  import FormData from "form-data";
740
+ var execAsync = promisify(exec);
738
741
  var TOOL_VERSION_REQUIREMENTS = {
739
742
  "upsert-schedule": "1.1.1",
740
743
  // 'get-schedules': '1.1.1',
@@ -851,8 +854,8 @@ function registerInsforgeTools(server, config = {}) {
851
854
  "fetch-docs",
852
855
  'Fetch Insforge documentation. Use "instructions" for essential backend setup (MANDATORY FIRST), or select specific SDK docs for database, auth, storage, functions, or AI integration.',
853
856
  {
854
- docType: z14.enum(["instructions", "db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "auth-components-react", "auth-components-nextjs", "auth-components-react-router"]).describe(
855
- 'Documentation type: "instructions" (essential backend setup - use FIRST), "db-sdk" (database operations), "storage-sdk" (file storage), "functions-sdk" (edge functions), "ai-integration-sdk" (AI features), "auth-components-react" (authentication components for React+Vite applications), "auth-components-nextjs" (authentication components for Next.js applications), "auth-components-react-router" (authentication components for React + React Router applications),'
857
+ docType: z14.enum(["instructions", "db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "auth-components-react", "auth-components-react-router"]).describe(
858
+ 'Documentation type: "instructions" (essential backend setup - use FIRST), "db-sdk" (database operations), "storage-sdk" (file storage), "functions-sdk" (edge functions), "ai-integration-sdk" (AI features), "auth-components-react" (authentication components for React+Vite applications), "auth-components-react-router" (authentication components for React + React Router applications),'
856
859
  )
857
860
  },
858
861
  withUsageTracking("fetch-docs", async ({ docType }) => {
@@ -1050,9 +1053,71 @@ ${JSON.stringify(metadata, null, 2)}`
1050
1053
  }
1051
1054
  })
1052
1055
  );
1056
+ server.tool(
1057
+ "download-template",
1058
+ 'Download a React starter template with InsForge integration. Creates a new "insforge-react" directory with React + TypeScript setup and pre-configured with your backend URL and anon key.',
1059
+ {
1060
+ frame: z14.enum(["react"]).describe("Framework to use for the template (currently only React is supported)")
1061
+ },
1062
+ withUsageTracking("download-template", async ({ frame }) => {
1063
+ try {
1064
+ const response = await fetch2(`${API_BASE_URL}/api/auth/tokens/anon`, {
1065
+ method: "POST",
1066
+ headers: {
1067
+ "x-api-key": getApiKey(),
1068
+ "Content-Type": "application/json"
1069
+ }
1070
+ });
1071
+ const result = await handleApiResponse(response);
1072
+ const anonKey = result.token;
1073
+ if (!anonKey) {
1074
+ throw new Error("Failed to retrieve anon key from backend");
1075
+ }
1076
+ const targetDir = `insforge-${frame}`;
1077
+ const command = `npx create-insforge-app insforge-${frame} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey}`;
1078
+ const { stdout, stderr } = await execAsync(command, {
1079
+ maxBuffer: 10 * 1024 * 1024
1080
+ // 10MB buffer
1081
+ });
1082
+ const output = stdout || stderr || "Template downloaded successfully";
1083
+ return {
1084
+ content: [
1085
+ {
1086
+ type: "text",
1087
+ text: formatSuccessMessage(
1088
+ `React template downloaded to ${targetDir}`,
1089
+ {
1090
+ targetDir,
1091
+ baseUrl: API_BASE_URL,
1092
+ command,
1093
+ output: output.trim(),
1094
+ nextSteps: [
1095
+ `cd ${targetDir}`,
1096
+ `npm install`,
1097
+ `npm run dev`
1098
+ ]
1099
+ }
1100
+ )
1101
+ }
1102
+ ]
1103
+ };
1104
+ } catch (error) {
1105
+ const errMsg = error instanceof Error ? error.message : "Unknown error occurred";
1106
+ return {
1107
+ content: [
1108
+ {
1109
+ type: "text",
1110
+ text: `Error downloading template: ${errMsg}`
1111
+ }
1112
+ ],
1113
+ isError: true
1114
+ };
1115
+ }
1116
+ })
1117
+ );
1053
1118
  server.tool(
1054
1119
  "bulk-upsert",
1055
- "Bulk insert or update data from CSV or JSON file. Supports upsert operations with a unique key.",
1120
+ "Bulk insert or updallet data from CSV or JSON file. Supports upsert operations with a unique key.",
1056
1121
  {
1057
1122
  apiKey: z14.string().optional().describe("API key for authentication (optional if provided via --api_key)"),
1058
1123
  ...bulkUpsertRequestSchema.shape,
@@ -1578,7 +1643,7 @@ ${JSON.stringify(metadata, null, 2)}`
1578
1643
  return {
1579
1644
  apiKey: GLOBAL_API_KEY,
1580
1645
  apiBaseUrl: API_BASE_URL,
1581
- toolCount: 16
1646
+ toolCount: 17
1582
1647
  };
1583
1648
  }
1584
1649
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-AOU5TUFZ.js";
4
+ } from "./chunk-W6MBRSUD.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-AOU5TUFZ.js";
4
+ } from "./chunk-W6MBRSUD.js";
5
5
 
6
6
  // src/stdio/index.ts
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insforge/mcp",
3
- "version": "1.1.7-dev.15",
3
+ "version": "1.1.7-dev.17",
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",