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. 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.

  2. added
    good first issueGood for newcomers - can be tackled without deep knowledge of the codebase
    P3Nice to haves, rare edge cases
    v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes
    needs designValid issue but needs maintainer alignment on design or approach
    and removed
    good first issueGood for newcomers - can be tackled without deep knowledge of the codebase
    on Dec 16, 2025
  3. ghost added
    potentially closeBot recommends closing — needs maintainer review
    on Apr 17, 2026
  4. 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

    P3Nice to haves, rare edge casesbugSomething isn't workingneeds designValid issue but needs maintainer alignment on design or approachpotentially closeBot recommends closing — needs maintainer reviewv2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions