mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user