Skip to content

Cannot find module '@modelcontextprotocol/sdk/types' or its corresponding type declarations, when my tsconfig has moduleResolution set to nodenext. #122

Closed

Description

@life2015

Describe the bug
TS error: Cannot find module ‘@modelcontextprotocol/sdk/types’ or its corresponding type declarations.

This happens when my tsconfig has moduleResolution set to nodenext.

image

To Reproduce
tsConfig.json:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "./out",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Expected behavior
TypeScript Language Server no error.

Activity

  1. jspahrsummers commented on Jan 14, 2025

    @jspahrsummers
    Member

    You need to add .js to your import paths. This is an ESM requirement.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions