@insforge/mcp 1.1.7-dev.23 → 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";
|
|
@@ -1076,9 +1086,14 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1076
1086
|
}
|
|
1077
1087
|
const targetDir = projectName || `insforge-${frame}`;
|
|
1078
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"}`);
|
|
1079
1093
|
const { stdout, stderr } = await execAsync(command, {
|
|
1080
|
-
maxBuffer: 10 * 1024 * 1024
|
|
1094
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
1081
1095
|
// 10MB buffer
|
|
1096
|
+
cwd
|
|
1082
1097
|
});
|
|
1083
1098
|
const output = stdout || stderr || "";
|
|
1084
1099
|
if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
|
|
@@ -1651,5 +1666,6 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1651
1666
|
}
|
|
1652
1667
|
|
|
1653
1668
|
export {
|
|
1669
|
+
setWorkspaceRoots,
|
|
1654
1670
|
registerInsforgeTools
|
|
1655
1671
|
};
|
package/dist/http-server.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
registerInsforgeTools
|
|
4
|
-
|
|
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