Skip to content

error TS2420: Class 'StreamableHTTPServerTransport' incorrectly implements interface 'Transport'. #1314

Closed

Description

@jetbuster

I've updated to 1.25.1, and I get

../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts:58:22 - error TS2420: Class 'StreamableHTTPServerTransport' incorrectly implements interface 'Transport'.
Types of property 'onclose' are incompatible.
Type '(() => void) | undefined' is not assignable to type '() => void'.
Type 'undefined' is not assignable to type '() => void'.

58 export declare class StreamableHTTPServerTransport implements Transport {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.

I suspect this is due to "exactOptionalPropertyTypes": true in my tsconfig.json.

Activity

  1. felixweinberger commented on Dec 18, 2025

    @felixweinberger
    Contributor

    Thanks for reporting! We don't currently support exactOptionalPropertyTypes - there are other type errors when enabled beyond this one.

    Workaround: Add "skipLibCheck": true to your tsconfig.json. This skips type checking of .d.ts files in node_modules (we use this ourselves).

    Probably won't get to this on the team in the short term but happy to review a PR.

  2. added
    P3Nice to haves, rare edge cases
    help wantedContributions especially welcome if you have a good knowledge of the codebase and language
    on Dec 18, 2025
  3. added a commit that references this issue on Feb 9, 2026
    c725192
  4. added a commit that references this issue on Mar 11, 2026
    a831292
  5. added a commit that references this issue on Mar 23, 2026
    70178e6
  6. added a commit that references this issue on Mar 26, 2026
    1497412
  7. vultrarex21-dev commented on Aug 24, 2026

    @vultrarex21-dev

    Hi! I'd like to work on this issue.
    I'll investigate the type errors caused by enabling exactOptionalPropertyTypes, add the necessary fixes and regression tests, and submit a PR.
    Please let me know if there are any constraints or preferred approaches I should follow before I start.

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 workinghelp wantedContributions especially welcome if you have a good knowledge of the codebase and language

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions