feat(MCP Server Trigger Node): Add MCP Server Trigger node to expose tools to MCP clients (#14403)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
jeanpaul
2025-04-09 14:45:24 +02:00
committed by GitHub
parent a495d81c13
commit 8360283c6f
36 changed files with 942 additions and 105 deletions

View File

@@ -48,6 +48,7 @@ import { finished } from 'stream/promises';
import { ActiveExecutions } from '@/active-executions';
import config from '@/config';
import { MCP_TRIGGER_NODE_TYPE } from '@/constants';
import type { Project } from '@/databases/entities/project';
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
@@ -446,6 +447,32 @@ export async function executeWebhook(
}
}
// TODO: remove this hack, and make sure that execution data is properly created before the MCP trigger is executed
if (workflowStartNode.type === MCP_TRIGGER_NODE_TYPE) {
// Initialize the data of the webhook node
const nodeExecutionStack: IExecuteData[] = [];
nodeExecutionStack.push({
node: workflowStartNode,
data: {
main: [],
},
source: null,
});
runExecutionData =
runExecutionData ||
({
startData: {},
resultData: {
runData: {},
},
executionData: {
contextData: {},
nodeExecutionStack,
waitingExecution: {},
},
} as IRunExecutionData);
}
try {
webhookResultData = await Container.get(WebhookService).runWebhook(
workflow,