@insforge/mcp 1.2.4-deployment.6 → 1.2.4-deployment.8
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-AE5PW7UP.js → chunk-O33PL3H4.js} +93 -99
- package/dist/http-server.js +2 -2
- package/dist/index.js +12 -9
- package/package.json +1 -1
|
@@ -1180,75 +1180,75 @@ var listDeploymentsResponseSchema = z20.object({
|
|
|
1180
1180
|
import FormData from "form-data";
|
|
1181
1181
|
var execAsync = promisify(exec);
|
|
1182
1182
|
var TOOL_VERSION_REQUIREMENTS = {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1183
|
+
// Schedule tools - require backend v1.1.1+
|
|
1184
|
+
"upsert-schedule": { minVersion: "1.1.1" },
|
|
1185
|
+
"delete-schedule": { minVersion: "1.1.1" },
|
|
1186
|
+
// 'get-schedules': { minVersion: '1.1.1' },
|
|
1187
|
+
// 'get-schedule-logs': { minVersion: '1.1.1' },
|
|
1188
|
+
// Deployment tools - require backend v1.2.0+
|
|
1189
|
+
"create-deployment": { minVersion: "1.2.0" }
|
|
1190
|
+
// Example of a deprecated tool (uncomment when needed):
|
|
1191
|
+
// 'legacy-tool': { minVersion: '1.0.0', maxVersion: '1.5.0' },
|
|
1187
1192
|
};
|
|
1188
|
-
function
|
|
1189
|
-
const
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
if (
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
try {
|
|
1200
|
-
const response = await fetch2(`${API_BASE_URL}/api/health`, {
|
|
1201
|
-
method: "GET",
|
|
1202
|
-
headers: {
|
|
1203
|
-
"Content-Type": "application/json"
|
|
1204
|
-
}
|
|
1205
|
-
});
|
|
1206
|
-
if (!response.ok) {
|
|
1207
|
-
throw new Error(`Health check failed with status ${response.status}`);
|
|
1208
|
-
}
|
|
1209
|
-
const health = await response.json();
|
|
1210
|
-
versionCache = {
|
|
1211
|
-
version: health.version,
|
|
1212
|
-
timestamp: now
|
|
1213
|
-
};
|
|
1214
|
-
return health.version;
|
|
1215
|
-
} catch (error) {
|
|
1216
|
-
const errMsg = error instanceof Error ? error.message : "Unknown error";
|
|
1217
|
-
throw new Error(`Failed to fetch backend version: ${errMsg}`);
|
|
1218
|
-
}
|
|
1193
|
+
function compareVersions(v1, v2) {
|
|
1194
|
+
const clean1 = v1.replace(/^v/, "").split("-")[0];
|
|
1195
|
+
const clean2 = v2.replace(/^v/, "").split("-")[0];
|
|
1196
|
+
const parts1 = clean1.split(".").map(Number);
|
|
1197
|
+
const parts2 = clean2.split(".").map(Number);
|
|
1198
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
1199
|
+
const part1 = parts1[i] || 0;
|
|
1200
|
+
const part2 = parts2[i] || 0;
|
|
1201
|
+
if (part1 > part2) return 1;
|
|
1202
|
+
if (part1 < part2) return -1;
|
|
1219
1203
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
const part1 = parts1[i] || 0;
|
|
1227
|
-
const part2 = parts2[i] || 0;
|
|
1228
|
-
if (part1 > part2) return 1;
|
|
1229
|
-
if (part1 < part2) return -1;
|
|
1230
|
-
}
|
|
1231
|
-
return 0;
|
|
1204
|
+
return 0;
|
|
1205
|
+
}
|
|
1206
|
+
function shouldRegisterTool(toolName, backendVersion) {
|
|
1207
|
+
const requirement = TOOL_VERSION_REQUIREMENTS[toolName];
|
|
1208
|
+
if (!requirement) {
|
|
1209
|
+
return true;
|
|
1232
1210
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
throw error;
|
|
1248
|
-
}
|
|
1249
|
-
console.warn(`Warning: Could not verify backend version for tool '${toolName}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1211
|
+
const { minVersion, maxVersion } = requirement;
|
|
1212
|
+
if (minVersion && compareVersions(backendVersion, minVersion) < 0) {
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
if (maxVersion && compareVersions(backendVersion, maxVersion) > 0) {
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1218
|
+
return true;
|
|
1219
|
+
}
|
|
1220
|
+
async function fetchBackendVersion(apiBaseUrl) {
|
|
1221
|
+
const response = await fetch2(`${apiBaseUrl}/api/health`, {
|
|
1222
|
+
method: "GET",
|
|
1223
|
+
headers: {
|
|
1224
|
+
"Content-Type": "application/json"
|
|
1250
1225
|
}
|
|
1226
|
+
});
|
|
1227
|
+
if (!response.ok) {
|
|
1228
|
+
throw new Error(`Health check failed with status ${response.status}`);
|
|
1251
1229
|
}
|
|
1230
|
+
const health = await response.json();
|
|
1231
|
+
return health.version;
|
|
1232
|
+
}
|
|
1233
|
+
async function registerInsforgeTools(server, config = {}) {
|
|
1234
|
+
const GLOBAL_API_KEY = config.apiKey || process.env.API_KEY || "";
|
|
1235
|
+
const API_BASE_URL = config.apiBaseUrl || process.env.API_BASE_URL || "http://localhost:7130";
|
|
1236
|
+
const usageTracker = new UsageTracker(API_BASE_URL, GLOBAL_API_KEY);
|
|
1237
|
+
const backendVersion = await fetchBackendVersion(API_BASE_URL);
|
|
1238
|
+
console.error(`Backend version: ${backendVersion}`);
|
|
1239
|
+
let toolCount = 0;
|
|
1240
|
+
const registerTool = (toolName, ...args) => {
|
|
1241
|
+
if (shouldRegisterTool(toolName, backendVersion)) {
|
|
1242
|
+
server.tool(toolName, ...args);
|
|
1243
|
+
toolCount++;
|
|
1244
|
+
return true;
|
|
1245
|
+
} else {
|
|
1246
|
+
const req = TOOL_VERSION_REQUIREMENTS[toolName];
|
|
1247
|
+
const reason = req?.minVersion && compareVersions(backendVersion, req.minVersion) < 0 ? `requires backend >= ${req.minVersion}` : `deprecated after backend ${req?.maxVersion}`;
|
|
1248
|
+
console.error(`Skipping tool '${toolName}': ${reason} (current: ${backendVersion})`);
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
1252
|
async function trackToolUsage(toolName, success = true) {
|
|
1253
1253
|
if (GLOBAL_API_KEY) {
|
|
1254
1254
|
await usageTracker.trackUsage(toolName, success);
|
|
@@ -1305,28 +1305,23 @@ function registerInsforgeTools(server, config = {}) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
};
|
|
1307
1307
|
const addBackgroundContext = async (response) => {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
const
|
|
1311
|
-
if (
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
type: "text",
|
|
1316
|
-
text: `
|
|
1308
|
+
const isLegacyVersion = compareVersions(backendVersion, "1.1.7") < 0;
|
|
1309
|
+
if (isLegacyVersion) {
|
|
1310
|
+
const context = await fetchInsforgeInstructionsContext();
|
|
1311
|
+
if (context && response.content && Array.isArray(response.content)) {
|
|
1312
|
+
response.content.push({
|
|
1313
|
+
type: "text",
|
|
1314
|
+
text: `
|
|
1317
1315
|
|
|
1318
1316
|
---
|
|
1319
1317
|
\u{1F527} INSFORGE DEVELOPMENT RULES (Auto-loaded):
|
|
1320
1318
|
${context}`
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1319
|
+
});
|
|
1323
1320
|
}
|
|
1324
|
-
} catch {
|
|
1325
|
-
console.warn("Could not determine backend version, skipping background context");
|
|
1326
1321
|
}
|
|
1327
1322
|
return response;
|
|
1328
1323
|
};
|
|
1329
|
-
|
|
1324
|
+
registerTool(
|
|
1330
1325
|
"fetch-docs",
|
|
1331
1326
|
'Fetch Insforge documentation. Use "instructions" for essential backend setup (MANDATORY FIRST), or select specific SDK docs for database, auth, storage, functions, or AI integration.',
|
|
1332
1327
|
{
|
|
@@ -1359,7 +1354,7 @@ ${context}`
|
|
|
1359
1354
|
}
|
|
1360
1355
|
})
|
|
1361
1356
|
);
|
|
1362
|
-
|
|
1357
|
+
registerTool(
|
|
1363
1358
|
"get-anon-key",
|
|
1364
1359
|
"Generate an anonymous JWT token that never expires. Requires admin API key. Use this for client-side applications that need public access.",
|
|
1365
1360
|
{
|
|
@@ -1398,7 +1393,7 @@ ${context}`
|
|
|
1398
1393
|
}
|
|
1399
1394
|
})
|
|
1400
1395
|
);
|
|
1401
|
-
|
|
1396
|
+
registerTool(
|
|
1402
1397
|
"get-table-schema",
|
|
1403
1398
|
"Returns the detailed schema(including RLS, indexes, constraints, etc.) of a specific table",
|
|
1404
1399
|
{
|
|
@@ -1437,7 +1432,7 @@ ${context}`
|
|
|
1437
1432
|
}
|
|
1438
1433
|
})
|
|
1439
1434
|
);
|
|
1440
|
-
|
|
1435
|
+
registerTool(
|
|
1441
1436
|
"get-backend-metadata",
|
|
1442
1437
|
"Index all backend metadata",
|
|
1443
1438
|
{
|
|
@@ -1477,7 +1472,7 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1477
1472
|
}
|
|
1478
1473
|
})
|
|
1479
1474
|
);
|
|
1480
|
-
|
|
1475
|
+
registerTool(
|
|
1481
1476
|
"run-raw-sql",
|
|
1482
1477
|
"Execute raw SQL query with optional parameters. Admin access required. Use with caution as it can modify data directly.",
|
|
1483
1478
|
{
|
|
@@ -1522,7 +1517,7 @@ ${JSON.stringify(metadata, null, 2)}`
|
|
|
1522
1517
|
}
|
|
1523
1518
|
})
|
|
1524
1519
|
);
|
|
1525
|
-
|
|
1520
|
+
registerTool(
|
|
1526
1521
|
"download-template",
|
|
1527
1522
|
"CRITICAL: MANDATORY FIRST STEP for all new InsForge projects. Download pre-configured starter template to a temporary directory. After download, you MUST copy files to current directory using the provided command.",
|
|
1528
1523
|
{
|
|
@@ -1598,7 +1593,7 @@ To: Your current project directory
|
|
|
1598
1593
|
}
|
|
1599
1594
|
})
|
|
1600
1595
|
);
|
|
1601
|
-
|
|
1596
|
+
registerTool(
|
|
1602
1597
|
"bulk-upsert",
|
|
1603
1598
|
"Bulk insert or update data from CSV or JSON file. Supports upsert operations with a unique key.",
|
|
1604
1599
|
{
|
|
@@ -1655,7 +1650,7 @@ To: Your current project directory
|
|
|
1655
1650
|
}
|
|
1656
1651
|
})
|
|
1657
1652
|
);
|
|
1658
|
-
|
|
1653
|
+
registerTool(
|
|
1659
1654
|
"create-bucket",
|
|
1660
1655
|
"Create new storage bucket",
|
|
1661
1656
|
{
|
|
@@ -1696,7 +1691,7 @@ To: Your current project directory
|
|
|
1696
1691
|
}
|
|
1697
1692
|
})
|
|
1698
1693
|
);
|
|
1699
|
-
|
|
1694
|
+
registerTool(
|
|
1700
1695
|
"list-buckets",
|
|
1701
1696
|
"Lists all storage buckets",
|
|
1702
1697
|
{},
|
|
@@ -1731,7 +1726,7 @@ To: Your current project directory
|
|
|
1731
1726
|
}
|
|
1732
1727
|
})
|
|
1733
1728
|
);
|
|
1734
|
-
|
|
1729
|
+
registerTool(
|
|
1735
1730
|
"delete-bucket",
|
|
1736
1731
|
"Deletes a storage bucket",
|
|
1737
1732
|
{
|
|
@@ -1770,7 +1765,7 @@ To: Your current project directory
|
|
|
1770
1765
|
}
|
|
1771
1766
|
})
|
|
1772
1767
|
);
|
|
1773
|
-
|
|
1768
|
+
registerTool(
|
|
1774
1769
|
"create-function",
|
|
1775
1770
|
"Create a new edge function that runs in Deno runtime. The code must be written to a file first for version control",
|
|
1776
1771
|
{
|
|
@@ -1829,7 +1824,7 @@ To: Your current project directory
|
|
|
1829
1824
|
}
|
|
1830
1825
|
})
|
|
1831
1826
|
);
|
|
1832
|
-
|
|
1827
|
+
registerTool(
|
|
1833
1828
|
"get-function",
|
|
1834
1829
|
"Get details of a specific edge function including its code",
|
|
1835
1830
|
{
|
|
@@ -1866,7 +1861,7 @@ To: Your current project directory
|
|
|
1866
1861
|
}
|
|
1867
1862
|
})
|
|
1868
1863
|
);
|
|
1869
|
-
|
|
1864
|
+
registerTool(
|
|
1870
1865
|
"update-function",
|
|
1871
1866
|
"Update an existing edge function code or metadata",
|
|
1872
1867
|
{
|
|
@@ -1932,7 +1927,7 @@ To: Your current project directory
|
|
|
1932
1927
|
}
|
|
1933
1928
|
})
|
|
1934
1929
|
);
|
|
1935
|
-
|
|
1930
|
+
registerTool(
|
|
1936
1931
|
"delete-function",
|
|
1937
1932
|
"Delete an edge function permanently",
|
|
1938
1933
|
{
|
|
@@ -1969,7 +1964,7 @@ To: Your current project directory
|
|
|
1969
1964
|
}
|
|
1970
1965
|
})
|
|
1971
1966
|
);
|
|
1972
|
-
|
|
1967
|
+
registerTool(
|
|
1973
1968
|
"get-container-logs",
|
|
1974
1969
|
"Get latest logs from a specific container/service. Use this to help debug problems with your app.",
|
|
1975
1970
|
{
|
|
@@ -2019,15 +2014,16 @@ To: Your current project directory
|
|
|
2019
2014
|
}
|
|
2020
2015
|
})
|
|
2021
2016
|
);
|
|
2022
|
-
|
|
2017
|
+
registerTool(
|
|
2023
2018
|
"create-deployment",
|
|
2024
2019
|
"Deploy source code from a directory. This tool zips files, uploads to cloud storage, and triggers deployment with optional environment variables and project settings.",
|
|
2025
2020
|
{
|
|
2026
|
-
sourceDirectory: z21.string().describe(
|
|
2021
|
+
sourceDirectory: z21.string().describe('Absolute path to the source directory containing files to deploy (e.g., /Users/name/project or C:\\Users\\name\\project). Do not use relative paths like "."'),
|
|
2027
2022
|
...startDeploymentRequestSchema.shape
|
|
2028
2023
|
},
|
|
2029
2024
|
withUsageTracking("create-deployment", async ({ sourceDirectory, projectSettings, envVars, meta }) => {
|
|
2030
2025
|
try {
|
|
2026
|
+
const resolvedSourceDir = sourceDirectory;
|
|
2031
2027
|
const createResponse = await fetch2(`${API_BASE_URL}/api/deployments`, {
|
|
2032
2028
|
method: "POST",
|
|
2033
2029
|
headers: {
|
|
@@ -2043,9 +2039,6 @@ To: Your current project directory
|
|
|
2043
2039
|
archive.on("data", (chunk) => chunks.push(chunk));
|
|
2044
2040
|
archive.on("end", () => resolve(Buffer.concat(chunks)));
|
|
2045
2041
|
archive.on("error", (err) => reject(err));
|
|
2046
|
-
archive.on("warning", (err) => {
|
|
2047
|
-
console.warn("Archiver warning:", err.message);
|
|
2048
|
-
});
|
|
2049
2042
|
const excludePatterns = [
|
|
2050
2043
|
"node_modules",
|
|
2051
2044
|
".git",
|
|
@@ -2055,7 +2048,7 @@ To: Your current project directory
|
|
|
2055
2048
|
".env.local",
|
|
2056
2049
|
".DS_Store"
|
|
2057
2050
|
];
|
|
2058
|
-
archive.directory(
|
|
2051
|
+
archive.directory(resolvedSourceDir, false, (entry) => {
|
|
2059
2052
|
const normalizedName = entry.name.replace(/\\/g, "/");
|
|
2060
2053
|
for (const pattern of excludePatterns) {
|
|
2061
2054
|
if (normalizedName.startsWith(pattern + "/") || normalizedName === pattern || normalizedName.endsWith("/" + pattern) || normalizedName.includes("/" + pattern + "/")) {
|
|
@@ -2124,7 +2117,8 @@ To: Your current project directory
|
|
|
2124
2117
|
return {
|
|
2125
2118
|
apiKey: GLOBAL_API_KEY,
|
|
2126
2119
|
apiBaseUrl: API_BASE_URL,
|
|
2127
|
-
toolCount
|
|
2120
|
+
toolCount,
|
|
2121
|
+
backendVersion
|
|
2128
2122
|
};
|
|
2129
2123
|
}
|
|
2130
2124
|
|
package/dist/http-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
registerInsforgeTools
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O33PL3H4.js";
|
|
5
5
|
|
|
6
6
|
// src/http/server.ts
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -91,7 +91,7 @@ app.post("/mcp", async (req, res) => {
|
|
|
91
91
|
name: "insforge-mcp",
|
|
92
92
|
version: "1.0.0"
|
|
93
93
|
});
|
|
94
|
-
registerInsforgeTools(mcpServer, {
|
|
94
|
+
await registerInsforgeTools(mcpServer, {
|
|
95
95
|
apiKey,
|
|
96
96
|
apiBaseUrl
|
|
97
97
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
registerInsforgeTools
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O33PL3H4.js";
|
|
5
5
|
|
|
6
6
|
// src/stdio/index.ts
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -12,15 +12,15 @@ program.option("--api_base_url <value>", "API Base URL");
|
|
|
12
12
|
program.parse(process.argv);
|
|
13
13
|
var options = program.opts();
|
|
14
14
|
var { api_key, api_base_url } = options;
|
|
15
|
-
var server = new McpServer({
|
|
16
|
-
name: "insforge-mcp",
|
|
17
|
-
version: "1.0.0"
|
|
18
|
-
});
|
|
19
|
-
var toolsConfig = registerInsforgeTools(server, {
|
|
20
|
-
apiKey: api_key,
|
|
21
|
-
apiBaseUrl: api_base_url || process.env.API_BASE_URL
|
|
22
|
-
});
|
|
23
15
|
async function main() {
|
|
16
|
+
const server = new McpServer({
|
|
17
|
+
name: "insforge-mcp",
|
|
18
|
+
version: "1.0.0"
|
|
19
|
+
});
|
|
20
|
+
const toolsConfig = await registerInsforgeTools(server, {
|
|
21
|
+
apiKey: api_key,
|
|
22
|
+
apiBaseUrl: api_base_url || process.env.API_BASE_URL
|
|
23
|
+
});
|
|
24
24
|
const transport = new StdioServerTransport();
|
|
25
25
|
await server.connect(transport);
|
|
26
26
|
console.error("Insforge MCP server started");
|
|
@@ -30,6 +30,9 @@ async function main() {
|
|
|
30
30
|
console.error("API Key: Not configured (will require api_key in tool calls)");
|
|
31
31
|
}
|
|
32
32
|
console.error(`API Base URL: ${toolsConfig.apiBaseUrl}`);
|
|
33
|
+
if (toolsConfig.backendVersion) {
|
|
34
|
+
console.error(`Backend Version: ${toolsConfig.backendVersion}`);
|
|
35
|
+
}
|
|
33
36
|
console.error(`Tools registered: ${toolsConfig.toolCount}`);
|
|
34
37
|
}
|
|
35
38
|
main().catch(console.error);
|
package/package.json
CHANGED