@enfyra/mcp-server 0.0.78 → 0.0.79
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/package.json +1 -1
- package/src/mcp-server-entry.mjs +24 -1
package/package.json
CHANGED
package/src/mcp-server-entry.mjs
CHANGED
|
@@ -513,6 +513,8 @@ function scriptRecordLabel(tableName, record) {
|
|
|
513
513
|
const method = record.method?.name || record.method?.method || null;
|
|
514
514
|
const route = record.route?.path || null;
|
|
515
515
|
const flow = record.flow?.name || null;
|
|
516
|
+
const gateway = record.gateway?.path || null;
|
|
517
|
+
const gqlTable = record.table?.name || null;
|
|
516
518
|
return {
|
|
517
519
|
tableName,
|
|
518
520
|
id: getId(record),
|
|
@@ -520,9 +522,26 @@ function scriptRecordLabel(tableName, record) {
|
|
|
520
522
|
route,
|
|
521
523
|
method,
|
|
522
524
|
flow,
|
|
525
|
+
gateway,
|
|
526
|
+
gqlTable,
|
|
523
527
|
};
|
|
524
528
|
}
|
|
525
529
|
|
|
530
|
+
function scriptTraceFields(tableName) {
|
|
531
|
+
const common = 'id,_id,name,key,eventName,sourceCode,handlerScript,connectionHandlerScript,code,scriptLanguage';
|
|
532
|
+
const byTable = {
|
|
533
|
+
route_handler_definition: `${common},route.id,route.path,method.id,method.name`,
|
|
534
|
+
pre_hook_definition: `${common},route.id,route.path,methods.id,methods.name,isGlobal`,
|
|
535
|
+
post_hook_definition: `${common},route.id,route.path,methods.id,methods.name,isGlobal`,
|
|
536
|
+
flow_step_definition: `${common},flow.id,flow.name`,
|
|
537
|
+
websocket_event_definition: `${common},gateway.id,gateway.path`,
|
|
538
|
+
websocket_definition: `${common},path`,
|
|
539
|
+
gql_definition: `${common},table.id,table.name`,
|
|
540
|
+
bootstrap_script_definition: common,
|
|
541
|
+
};
|
|
542
|
+
return byTable[tableName] || '*';
|
|
543
|
+
}
|
|
544
|
+
|
|
526
545
|
async function findMethodRecordByName(method) {
|
|
527
546
|
const filter = encodeURIComponent(JSON.stringify({ name: { _eq: method } }));
|
|
528
547
|
const result = await fetchAPI(ENFYRA_API_URL, `/method_definition?filter=${filter}&limit=1&fields=id,_id,name,buttonColor,textColor,isSystem`);
|
|
@@ -1874,7 +1893,11 @@ server.tool(
|
|
|
1874
1893
|
const sourceContains = (record) => getRecordSource(record).sourceCode.toLowerCase().includes(lower);
|
|
1875
1894
|
|
|
1876
1895
|
const scriptTableResults = await Promise.all(SCRIPT_BACKED_TABLES.map(async (tableName) => {
|
|
1877
|
-
const
|
|
1896
|
+
const fields = scriptTraceFields(tableName);
|
|
1897
|
+
let result = await fetchAPI(ENFYRA_API_URL, `/${tableName}?limit=1000&fields=${encodeURIComponent(fields)}`).catch((error) => ({ error }));
|
|
1898
|
+
if (result?.error && fields !== '*') {
|
|
1899
|
+
result = await fetchAPI(ENFYRA_API_URL, `/${tableName}?limit=1000&fields=*`).catch((error) => ({ error }));
|
|
1900
|
+
}
|
|
1878
1901
|
return { tableName, records: unwrapData(result), error: result?.error?.message || null };
|
|
1879
1902
|
}));
|
|
1880
1903
|
const scriptMatches = [];
|