@insforge/mcp 1.1.7-dev.24 → 1.1.7-dev.26
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.
- package/dist/{chunk-UAD5QXNK.js → chunk-XLOYXKUP.js} +29 -33
- package/dist/http-server.js +1 -1
- package/dist/index.js +2 -34
- package/package.json +1 -1
|
@@ -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
|
|
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,16 +1075,23 @@ ${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 = tmpdir();
|
|
1087
1079
|
const targetDir = projectName || `insforge-${frame}`;
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1080
|
+
const templatePath = `${tempDir}/${targetDir}`;
|
|
1081
|
+
console.error(`[download-template] Target path: ${templatePath}`);
|
|
1082
|
+
try {
|
|
1083
|
+
const stats = await fs.stat(templatePath);
|
|
1084
|
+
if (stats.isDirectory()) {
|
|
1085
|
+
console.error(`[download-template] Removing existing template at ${templatePath}`);
|
|
1086
|
+
await fs.rm(templatePath, { recursive: true, force: true });
|
|
1087
|
+
}
|
|
1088
|
+
} catch (error) {
|
|
1089
|
+
}
|
|
1090
|
+
const command = `npx create-insforge-app ${targetDir} --frame ${frame} --base-url ${API_BASE_URL} --anon-key ${anonKey}`;
|
|
1093
1091
|
const { stdout, stderr } = await execAsync(command, {
|
|
1094
1092
|
maxBuffer: 10 * 1024 * 1024,
|
|
1095
1093
|
// 10MB buffer
|
|
1096
|
-
cwd
|
|
1094
|
+
cwd: tempDir
|
|
1097
1095
|
});
|
|
1098
1096
|
const output = stdout || stderr || "";
|
|
1099
1097
|
if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
|
|
@@ -1103,19 +1101,18 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1103
1101
|
content: [
|
|
1104
1102
|
{
|
|
1105
1103
|
type: "text",
|
|
1106
|
-
text:
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
)
|
|
1104
|
+
text: `\u2705 React template downloaded successfully
|
|
1105
|
+
|
|
1106
|
+
\u{1F4C1} Template Location: ${templatePath}
|
|
1107
|
+
|
|
1108
|
+
\u26A0\uFE0F IMPORTANT: The template is in a temporary directory and NOT in your current working directory.
|
|
1109
|
+
|
|
1110
|
+
\u{1F534} CRITICAL NEXT STEP REQUIRED:
|
|
1111
|
+
You MUST copy ALL files (INCLUDING HIDDEN FILES like .env, .gitignore, etc.) from the temporary directory to your current project directory.
|
|
1112
|
+
|
|
1113
|
+
Copy all files from: ${templatePath}
|
|
1114
|
+
To: Your current project directory
|
|
1115
|
+
`
|
|
1119
1116
|
}
|
|
1120
1117
|
]
|
|
1121
1118
|
};
|
|
@@ -1666,6 +1663,5 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1666
1663
|
}
|
|
1667
1664
|
|
|
1668
1665
|
export {
|
|
1669
|
-
setWorkspaceRoots,
|
|
1670
1666
|
registerInsforgeTools
|
|
1671
1667
|
};
|
package/dist/http-server.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
registerInsforgeTools
|
|
4
|
-
|
|
5
|
-
} from "./chunk-UAD5QXNK.js";
|
|
3
|
+
registerInsforgeTools
|
|
4
|
+
} from "./chunk-XLOYXKUP.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