@insforge/mcp 1.1.7-dev.24 → 1.1.7-dev.25

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.
@@ -1,21 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/shared/context.ts
4
- var workspaceRoots = [];
5
- function setWorkspaceRoots(roots) {
6
- workspaceRoots = roots;
7
- console.error(`[Context] Workspace roots set: ${roots.join(", ")}`);
8
- }
9
- function getWorkspaceRoot() {
10
- return workspaceRoots[0];
11
- }
12
-
13
3
  // src/shared/tools.ts
14
4
  import { z as z14 } from "zod";
15
5
  import fetch2 from "node-fetch";
16
6
  import { promises as fs } from "fs";
17
7
  import { exec } from "child_process";
18
8
  import { promisify } from "util";
9
+ import { tmpdir } from "os";
19
10
 
20
11
  // src/shared/response-handler.ts
21
12
  async function handleApiResponse(response) {
@@ -864,8 +855,8 @@ function registerInsforgeTools(server, config = {}) {
864
855
  "fetch-docs",
865
856
  'Fetch Insforge documentation. Use "instructions" for essential backend setup (MANDATORY FIRST), or select specific SDK docs for database, auth, storage, functions, or AI integration.',
866
857
  {
867
- docType: z14.enum(["instructions", "db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "auth-components-react"]).describe(
868
- '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),'
858
+ docType: z14.enum(["instructions", "db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "auth-components-react", "auth-components-react-router"]).describe(
859
+ '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),'
869
860
  )
870
861
  },
871
862
  withUsageTracking("fetch-docs", async ({ docType }) => {
@@ -1065,7 +1056,7 @@ ${JSON.stringify(metadata, null, 2)}`
1065
1056
  );
1066
1057
  server.tool(
1067
1058
  "download-template",
1068
- "CRITICAL: MANDATORY FIRST STEP for all new InsForge projects. Download pre-configured starter template (React/Next.js/React Router). ALWAYS use this tool BEFORE any other setup when starting a new project.",
1059
+ "CRITICAL: MANDATORY FIRST STEP for all new InsForge projects. Download pre-configured starter template (React) to a temporary directory. After download, you MUST copy files to current directory using the provided command.",
1069
1060
  {
1070
1061
  frame: z14.enum(["react"]).describe("Framework to use for the template (currently only React is supported)"),
1071
1062
  projectName: z14.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")')
@@ -1084,33 +1075,36 @@ ${JSON.stringify(metadata, null, 2)}`
1084
1075
  if (!anonKey) {
1085
1076
  throw new Error("Failed to retrieve anon key from backend");
1086
1077
  }
1078
+ const tempDir = await fs.mkdtemp(`${tmpdir()}/insforge-`);
1087
1079
  const targetDir = projectName || `insforge-${frame}`;
1088
- const command = `npx create-insforge-app ${targetDir} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey}`;
1089
- const workspaceRoot = getWorkspaceRoot();
1090
- const cwd = workspaceRoot || process.cwd();
1091
- console.error(`[download-template] Using working directory: ${cwd}`);
1092
- console.error(`[download-template] Workspace root from client: ${workspaceRoot || "not available"}`);
1080
+ console.error(`[download-template] Downloading to temp: ${tempDir}`);
1081
+ const command = `npx create-insforge-app ${targetDir} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey}`;
1093
1082
  const { stdout, stderr } = await execAsync(command, {
1094
1083
  maxBuffer: 10 * 1024 * 1024,
1095
1084
  // 10MB buffer
1096
- cwd
1085
+ cwd: tempDir
1097
1086
  });
1098
1087
  const output = stdout || stderr || "";
1099
1088
  if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
1100
1089
  throw new Error(`Failed to download template: ${output}`);
1101
1090
  }
1091
+ const templatePath = `${tempDir}/${targetDir}`;
1102
1092
  return {
1103
1093
  content: [
1104
1094
  {
1105
1095
  type: "text",
1106
1096
  text: formatSuccessMessage(
1107
- `React template created successfully`,
1097
+ `React template downloaded to temporary directory`,
1108
1098
  {
1109
1099
  projectName: targetDir,
1110
- location: `./${targetDir}`,
1100
+ tempLocation: templatePath,
1111
1101
  baseUrl: API_BASE_URL,
1112
- nextSteps: [
1113
- `cd ${targetDir}`,
1102
+ criticalNextStep: [
1103
+ `IMPORTANT: The template is in a temporary directory. Run this command to copy it to your current directory:`,
1104
+ ``,
1105
+ `cp -r ${templatePath}/* . && cp -r ${templatePath}/.* . 2>/dev/null || true`,
1106
+ ``,
1107
+ `Then proceed with:`,
1114
1108
  `npm install`,
1115
1109
  `npm run dev`
1116
1110
  ]
@@ -1666,6 +1660,5 @@ ${JSON.stringify(metadata, null, 2)}`
1666
1660
  }
1667
1661
 
1668
1662
  export {
1669
- setWorkspaceRoots,
1670
1663
  registerInsforgeTools
1671
1664
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-UAD5QXNK.js";
4
+ } from "./chunk-P67C663Y.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,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- registerInsforgeTools,
4
- setWorkspaceRoots
5
- } from "./chunk-UAD5QXNK.js";
3
+ registerInsforgeTools
4
+ } from "./chunk-P67C663Y.js";
6
5
 
7
6
  // src/stdio/index.ts
8
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -31,36 +30,5 @@ async function main() {
31
30
  }
32
31
  console.error(`API Base URL: ${toolsConfig.apiBaseUrl}`);
33
32
  console.error(`Tools registered: ${toolsConfig.toolCount}`);
34
- console.error(`process.cwd(): ${process.cwd()}`);
35
- console.error(`PWD env var: ${process.env.PWD || "not set"}`);
36
- console.error(`HOME env var: ${process.env.HOME || "not set"}`);
37
- try {
38
- console.error("Attempting to request workspace roots from client...");
39
- const serverInternal = server.server || server._server;
40
- if (serverInternal && typeof serverInternal.request === "function") {
41
- const rootsResult = await serverInternal.request(
42
- { method: "roots/list" },
43
- {}
44
- );
45
- console.error("Roots response:", JSON.stringify(rootsResult));
46
- if (rootsResult && Array.isArray(rootsResult.roots)) {
47
- const roots = rootsResult.roots.map((root) => {
48
- const uri = root.uri || "";
49
- return uri.replace("file://", "");
50
- }).filter(Boolean);
51
- setWorkspaceRoots(roots);
52
- if (roots.length > 0) {
53
- console.error(`\u2713 Workspace roots available: ${roots.join(", ")}`);
54
- } else {
55
- console.error("\u26A0 No workspace roots returned by client");
56
- }
57
- }
58
- } else {
59
- console.error("\u26A0 Server does not have request method available");
60
- }
61
- } catch (error) {
62
- console.error("\u26A0 Could not get workspace roots from client");
63
- console.error(" Error:", error instanceof Error ? error.message : String(error));
64
- }
65
33
  }
66
34
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insforge/mcp",
3
- "version": "1.1.7-dev.24",
3
+ "version": "1.1.7-dev.25",
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",