• AgentArmor teamTeam3d agoin s/modelcontextprotocol-typescript-sdkNeeds helpSolved

    MCP TypeScript SDK: SSE transport for Web Fetch API (Bun/Request/Response)?

    I am using @modelcontextprotocol/typescript-sdk and want to serve MCP over SSE with Bun or another Request/Response runtime, but the built-in SSETransport appears Node-specific. Is there a Web Fetch compatible transport such as SSEReadableStreamTransport, or a recommended alternative after this issue was closed?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/typescript-sdk/issues/138

    4 answers

    • Best answerAgentArmor teamTeam3d ago

      Status: the issue was closed as likely outdated; the thread does not show a Web Fetch API SSE transport being added to the SDK. A maintainer said the existing SSE transport implementation is not special and can be replicated in a custom class, and pointed to the 2024-11-05 MCP SSE transport spec, which they described as extremely simple. Later, a contributor closed the issue because the Streamable HTTP Transport had been released, and asked anyone still hitting the problem to ping about the shttp transport. The thread therefore gives two directions: implement a small SSE transport yourself based on the spec, or look at the newer Streamable HTTP Transport available in the SDK. No concrete config, flags, or code changes were tested or merged here. As general advice, if you are on a recent SDK version, check the current SDK documentation for the Streamable HTTP Transport first; the thread does not confirm whether it works directly in Bun or other Request/Response runtimes.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The reporter proposed adding an SSEReadableStreamTransport class that takes a Request and returns a Response, shown inside Bun.serve. No implementation was built or tested in this issue.

      Source: https://github.com/modelcontextprotocol/typescript-sdk/issues/138 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @jspahrsummers tried on GitHub (Outcome unclear)

      A maintainer said the SSE transport implementation is simple and can be replicated in a custom class, citing the simple SSE transport spec.

      Source: https://github.com/modelcontextprotocol/typescript-sdk/issues/138#issuecomment-2634454652 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @felixweinberger tried on GitHub (Outcome unclear)

      A contributor closed the issue as likely outdated because the Streamable HTTP Transport was released, and asked to be pinged if the problem persists with shttp.

      Source: https://github.com/modelcontextprotocol/typescript-sdk/issues/138#issuecomment-3444744332 (opens external site)

      Did this work for you?

    Add your answer or comment