Skip to content

StreamableHTTPClientTransport is not implementing Transport properly #861

Open

Description

@utkarshpandey6

Describe the bug
There is a mismatch in type of Transport and StreamableHTTPClientTransport

To Reproduce
Typescript compilation is failing

Expected behavior
StreamableHTTPClientTransport should implement Transport properly

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    on Aug 10, 2025
  2. nicolasff commented on Aug 27, 2025

    @nicolasff

    I'm seeing this as well. More details:

    import { Client } from "@modelcontextprotocol/sdk/client/index.js";
    import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
    
    const transport = new StreamableHTTPClientTransport(new URL(url), {
        requestInit: { headers: {'X-Foo': 'bar'}}, 
    });
    
    const mcpClient = new Client(
        { name: "my-client", version: "1.0.0", },
        { capabilities: {}, }
    );
    
    await mcpClient.connect(transport); // linter warning on the `transport` parameter to connect()

    The type mismatch I'm getting is:

    Argument of type 'StreamableHTTPClientTransport' is not assignable to parameter of type 'Transport' with 'exactOptionalPropertyTypes: true'.
    Consider adding 'undefined' to the types of the target's properties.
      Types of property 'sessionId' are incompatible.
        Type 'string | undefined' is not assignable to type 'string'.
          Type 'undefined' is not assignable to type 'string'
    

    Seen with Deno 2.4.5, npm:@modelcontextprotocol/sdk@1.17.4 in deno.json.

  3. added
    good first issue
    P3
    v2
    needs design
    and removed
    good first issue
    on Dec 16, 2025
  4. ghost added
    potentially close
    on Apr 17, 2026
  5. alex-feel commented on Oct 16, 2026

    @alex-feel

    Still reproduces on 1.32.1 (npm latest), TypeScript 7.0.2, strict + exactOptionalPropertyTypes:

    import { Client } from "@modelcontextprotocol/sdk/client/index.js";
    import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
    
    const transport = new StreamableHTTPClientTransport(new URL("http://localhost/mcp"));
    const client = new Client({ name: "repro", version: "0.0.0" });
    await client.connect(transport);
    src/main.ts(6,22): error TS2379: Argument of type 'StreamableHTTPClientTransport' is not assignable to parameter of type 'Transport' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
      Types of property 'sessionId' are incompatible.
        Type 'string | undefined' is not assignable to type 'string'.
          Type 'undefined' is not assignable to type 'string'.
    

    The fix, #2814 (backport of #1766), merged into v1.x on 2026-10-05, after 1.32.1 shipped, so no release carries it yet. The pkg.pr.new build of its merge commit 6919e95 type-checks this file clean.

    Could you cut a v1 patch release with it? I can post the tsconfig and commands if useful.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugneeds designpotentially closev2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions