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

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,5 +1,15 @@
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
+
3
13
  // src/shared/tools.ts
4
14
  import { z as z14 } from "zod";
5
15
  import fetch2 from "node-fetch";
@@ -1058,10 +1068,9 @@ ${JSON.stringify(metadata, null, 2)}`
1058
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
1069
  {
1060
1070
  frame: z14.enum(["react"]).describe("Framework to use for the template (currently only React is supported)"),
1061
- projectName: z14.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")'),
1062
- workingDirectory: z14.string().optional().describe("Working directory path where project should be created")
1071
+ projectName: z14.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")')
1063
1072
  },
1064
- withUsageTracking("download-template", async ({ frame, projectName, workingDirectory }) => {
1073
+ withUsageTracking("download-template", async ({ frame, projectName }) => {
1065
1074
  try {
1066
1075
  const response = await fetch2(`${API_BASE_URL}/api/auth/tokens/anon`, {
1067
1076
  method: "POST",
@@ -1076,8 +1085,11 @@ ${JSON.stringify(metadata, null, 2)}`
1076
1085
  throw new Error("Failed to retrieve anon key from backend");
1077
1086
  }
1078
1087
  const targetDir = projectName || `insforge-${frame}`;
1079
- const cwd = workingDirectory || process.cwd();
1080
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"}`);
1081
1093
  const { stdout, stderr } = await execAsync(command, {
1082
1094
  maxBuffer: 10 * 1024 * 1024,
1083
1095
  // 10MB buffer
@@ -1087,7 +1099,6 @@ ${JSON.stringify(metadata, null, 2)}`
1087
1099
  if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
1088
1100
  throw new Error(`Failed to download template: ${output}`);
1089
1101
  }
1090
- const fullPath = `${cwd}/${targetDir}`;
1091
1102
  return {
1092
1103
  content: [
1093
1104
  {
@@ -1096,7 +1107,7 @@ ${JSON.stringify(metadata, null, 2)}`
1096
1107
  `React template created successfully`,
1097
1108
  {
1098
1109
  projectName: targetDir,
1099
- location: fullPath,
1110
+ location: `./${targetDir}`,
1100
1111
  baseUrl: API_BASE_URL,
1101
1112
  nextSteps: [
1102
1113
  `cd ${targetDir}`,
@@ -1655,5 +1666,6 @@ ${JSON.stringify(metadata, null, 2)}`
1655
1666
  }
1656
1667
 
1657
1668
  export {
1669
+ setWorkspaceRoots,
1658
1670
  registerInsforgeTools
1659
1671
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-UVGZW3SJ.js";
4
+ } from "./chunk-UAD5QXNK.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,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- registerInsforgeTools
4
- } from "./chunk-UVGZW3SJ.js";
3
+ registerInsforgeTools,
4
+ setWorkspaceRoots
5
+ } from "./chunk-UAD5QXNK.js";
5
6
 
6
7
  // src/stdio/index.ts
7
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -30,5 +31,36 @@ async function main() {
30
31
  }
31
32
  console.error(`API Base URL: ${toolsConfig.apiBaseUrl}`);
32
33
  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
+ }
33
65
  }
34
66
  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.22",
3
+ "version": "1.1.7-dev.24",
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",