Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

fix(mcp): adapt secure SSE responses to web streams - #6726

Open
ump45nose wants to merge 1 commit into
FlowiseAI:mainfrom
ump45nose:bugfix/mcp-sse-web-stream
Open

fix(mcp): adapt secure SSE responses to web streams#6726
ump45nose wants to merge 1 commit into
FlowiseAI:mainfrom
ump45nose:bugfix/mcp-sse-web-stream

Conversation

@ump45nose

Copy link
Copy Markdown

Summary

  • adapt secureFetch's Node.js response stream to a Web ReadableStream before passing it to SSEClientTransport
  • use the adapter for SSE fallback requests both with and without custom headers
  • preserve status, status text, and headers, while leaving non-200 responses untouched for EventSource's normal error handling

Why

secureFetch uses node-fetch v2, whose response body is a Node.js PassThrough. The EventSource implementation used by the MCP SDK requires a Web ReadableStream with getReader(), so the Custom MCP SSE fallback rejected otherwise valid event streams.

Fixes #6715.

Testing

  • npm exec --yes --package=node@24 -- node --max-old-space-size=3072 node_modules/jest/bin/jest.js nodes/tools/MCP/core.test.ts --runInBand (82 passed)
  • node_modules/.bin/eslint packages/components/nodes/tools/MCP/core.ts packages/components/nodes/tools/MCP/core.test.ts --no-report-unused-disable-directives --max-warnings 0
  • node_modules/.bin/prettier --check packages/components/nodes/tools/MCP/core.ts packages/components/nodes/tools/MCP/core.test.ts
  • git diff --check

Notes

The strict lint invocation with --report-unused-disable-directives also reports an existing unused no-control-regex suppression in core.ts; this patch does not change that pre-existing line.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Custom Tool: SSE fallback always fails with 'Invalid response body, expected a web ReadableStream' (node-fetch v2 body is not a web ReadableStream)

1 participant