Skip to content

SSEClientTransport doesn't work with NextJS #210

Open
@michaelgrewal

Description

@michaelgrewal

Has anyone been able to successfully use the SSEClientTransport in their NextJS app (v14) server side code?

I have a route in my app /api/chat and I have a MCP Server running with /sse, I can establish a connection in Postman with GET.

However, I want to establish a connection from my NextJS server code to my MCP Server. But whenever I instantiate the transport, my app's route becomes totally broken and unable to trigger. Meanwhile, if I comment out the transport, then my route becomes functional again. It seems like something with the transport is breaking my app's fetch("/api/chat") functionality.

Does anyone know why? Does this MCP SDK break the default JS fetch() implementation or something?

I also can't find any examples online, and the sample in the official docs for SSEClientTransport is super bare minimum. I find there are plenty of examples for MCP Server but barely any for MCP Client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions