@insforge/mcp 1.1.7-dev.23 → 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.
|
@@ -6,6 +6,7 @@ import fetch2 from "node-fetch";
|
|
|
6
6
|
import { promises as fs } from "fs";
|
|
7
7
|
import { exec } from "child_process";
|
|
8
8
|
import { promisify } from "util";
|
|
9
|
+
import { tmpdir } from "os";
|
|
9
10
|
|
|
10
11
|
// src/shared/response-handler.ts
|
|
11
12
|
async function handleApiResponse(response) {
|
|
@@ -854,8 +855,8 @@ function registerInsforgeTools(server, config = {}) {
|
|
|
854
855
|
"fetch-docs",
|
|
855
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.',
|
|
856
857
|
{
|
|
857
|
-
docType: z14.enum(["instructions", "db-sdk", "storage-sdk", "functions-sdk", "ai-integration-sdk", "auth-components-react"]).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),'
|
|
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),'
|
|
859
860
|
)
|
|
860
861
|
},
|
|
861
862
|
withUsageTracking("fetch-docs", async ({ docType }) => {
|
|
@@ -1055,7 +1056,7 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1055
1056
|
);
|
|
1056
1057
|
server.tool(
|
|
1057
1058
|
"download-template",
|
|
1058
|
-
"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.",
|
|
1059
1060
|
{
|
|
1060
1061
|
frame: z14.enum(["react"]).describe("Framework to use for the template (currently only React is supported)"),
|
|
1061
1062
|
projectName: z14.string().optional().describe('Name for the project directory (optional, defaults to "insforge-react")')
|
|
@@ -1074,28 +1075,36 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1074
1075
|
if (!anonKey) {
|
|
1075
1076
|
throw new Error("Failed to retrieve anon key from backend");
|
|
1076
1077
|
}
|
|
1078
|
+
const tempDir = await fs.mkdtemp(`${tmpdir()}/insforge-`);
|
|
1077
1079
|
const targetDir = projectName || `insforge-${frame}`;
|
|
1078
|
-
|
|
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}`;
|
|
1079
1082
|
const { stdout, stderr } = await execAsync(command, {
|
|
1080
|
-
maxBuffer: 10 * 1024 * 1024
|
|
1083
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
1081
1084
|
// 10MB buffer
|
|
1085
|
+
cwd: tempDir
|
|
1082
1086
|
});
|
|
1083
1087
|
const output = stdout || stderr || "";
|
|
1084
1088
|
if (output.toLowerCase().includes("error") && !output.includes("successfully")) {
|
|
1085
1089
|
throw new Error(`Failed to download template: ${output}`);
|
|
1086
1090
|
}
|
|
1091
|
+
const templatePath = `${tempDir}/${targetDir}`;
|
|
1087
1092
|
return {
|
|
1088
1093
|
content: [
|
|
1089
1094
|
{
|
|
1090
1095
|
type: "text",
|
|
1091
1096
|
text: formatSuccessMessage(
|
|
1092
|
-
`React template
|
|
1097
|
+
`React template downloaded to temporary directory`,
|
|
1093
1098
|
{
|
|
1094
1099
|
projectName: targetDir,
|
|
1095
|
-
|
|
1100
|
+
tempLocation: templatePath,
|
|
1096
1101
|
baseUrl: API_BASE_URL,
|
|
1097
|
-
|
|
1098
|
-
`
|
|
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:`,
|
|
1099
1108
|
`npm install`,
|
|
1100
1109
|
`npm run dev`
|
|
1101
1110
|
]
|
package/dist/http-server.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED