ERR_UNKNOWN_FILE_EXTENSION: Unknown file extension ".ts"
- Spec
2026-07-28- Evidence
- E2Reproducedarm64
- TypeScript SDK (server)
@modelcontextprotocol/server@2.4.0- Verified
What it means
Section titled “What it means”The command was something like node /path/to/server.ts. Node.js 22.18 and later strip TypeScript types and run the file; according to the Node.js documentation, type stripping is enabled by default since v22.18.0 and v23.6.0. A Node.js that does not strip types refuses the file:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /path/to/server.tsWe reproduced the message on Node.js 24.21 with stripping turned off. The process exits immediately, so the client usually reports Connection closed and this line appears only in the server’s log.
The client runs an older Node.js
Section titled “The client runs an older Node.js”node --version in your terminal may show 24, while the client finds a different node: an older system install, or the first one on a PATH that does not include nvm. Fix it in one of these ways:
- Put the full path of a recent Node.js in
command, for example/Users/me/.nvm/versions/node/v24.21.0/bin/node. - Compile to JavaScript (
tsc) and point the client at the.jsfile. This works on any Node.js the SDK supports (20 or later for the TypeScript SDK v2).
Type stripping is turned off
Section titled “Type stripping is turned off”If the Node.js version is recent enough, look for --no-strip-types in the command, or in the NODE_OPTIONS environment variable the client passes. Remove it, or run the compiled .js file.
Type stripping only removes types. Code that needs real TypeScript compilation, such as enum or parameter properties, still fails, with a different error. Run it through tsc or tsx in that case.
Related
Section titled “Related”- Your first server in TypeScript
- spawn … ENOENT: when the client cannot find
nodeat all.
Sources
MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.