Description
Is your feature request related to a problem? Please describe.
I am writing MCP client code that needs to control networking (e.g. proxying/traffic filtering). Although the MCP client transports options offer some flexibility (RequestInit
for Streamable HTTP and SSE transports, fetch
override in EventSourceInit
for SSE transport), I really need to just control all uses of fetch
within these transports.
Describe the solution you'd like
Add a fetch
option to both StreamableHTTPClientTransportOptions
and SSEClientTransportOptions
. All fetch
calls within these transports use the provided fetch
implementation, falling back to native fetch
.
Describe alternatives you've considered
I can work around this issue either by providing custom transport implementations, or by locally patching the SDK to allow overriding fetch
.
Additional context
I'm happy to provide a PR, please let me know if the contribution would be welcome.