Skip to content

Fix: MCP Server Trigger reading 'getWebhookName'?!?#28727

Open
shahyashish wants to merge 1 commit inton8n-io:masterfrom
shahyashish:gitfix-patch-28725-1776700893993
Open

Fix: MCP Server Trigger reading 'getWebhookName'?!?#28727
shahyashish wants to merge 1 commit inton8n-io:masterfrom
shahyashish:gitfix-patch-28725-1776700893993

Conversation

@shahyashish
Copy link
Copy Markdown

In n8n trigger nodes, the webhook method receives its execution context (of type IWebhookFunctions) via the 'this' binding rather than as a function argument. By declaring the method with 'context: IWebhookFunctions' as a parameter, the context variable was left undefined when called by the n8n core, resulting in the reported TypeError. The fix updates the method signature to use 'this: IWebhookFunctions' and assigns it to a local 'context' variable to resolve the issue while maintaining compatibility with the rest of the method's logic.

Test: 1. Configure an MCP Server Trigger node in an n8n workflow.
2. Set a path (e.g. 'mcp-server') and Authentication to 'None'.
3. Activate the workflow.
4. Use a tool like 'curl' to make a GET request to the node's setup URL (e.g., http://localhost:5678/rest/oauth2-webhooks/mcp-server/sse).
5. Verify that the request no longer results in a 500 error and the n8n logs do not show the 'Cannot read properties of undefined (reading 'getWebhookName')' error.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@n8n-assistant n8n-assistant Bot added n8n team Authored by the n8n team node/improvement New feature or request community Authored by a community member labels Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member n8n team Authored by the n8n team node/improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants