Skip to content

Override client transport fetch #476

@domnit

Description

@domnit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature that's not currently supported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions