modelcontextprotocol / modelcontextprotocol/typescript-sdk
Published package omits `src/` but `dist/**/*.js.map` references it, breaking source-map consumers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
Describe the bug
The published @modelcontextprotocol/sdk npm tarball ships dist/**/*.js.map source maps whose sources field references ../../../../src/**/*.ts, but the src/ directory is not included in the published package. Any bundler that resolves source maps (e.g. webpack's source-map-loader) fails to read the referenced TypeScript files and emits a warning for every SDK file it touches.
Verified on @modelcontextprotocol/sdk@1.29.0.
To Reproduce
Steps to reproduce the behavior:
- Install
@modelcontextprotocol/sdk@1.29.0in a project bundled with webpack andsource-map-loaderenabled (the default for@nx/webpackNode apps withsourceMap: true). - Import something from
@modelcontextprotocol/sdk— e.g. anything that pulls indist/cjs/experimental/tasks/helpers.js. - Run the build.
Inspecting the shipped map confirms the dangling reference:
// dist/cjs/experimental/tasks/helpers.js.map
{"version":3,"file":"helpers.js","sources":["../../../../src/experimental/tasks/helpers.ts"], ...}
The tarball contents:
package.json // no "files" field
LICENSE
README.md
dist/ // shipped
src/ // NOT shipped
Every dist/**/*.js.map in the package has the same broken sources path, so any imported file can trigger this — the experimental tasks helpers happened to surface it for us.
Expected behavior
The shipped source maps resolve cleanly. Either the referenced src/ files are included in the tarball, or the sources are inlined into the maps (sourcesContent / --inlineSources), or the maps are not shipped at all.
Logs
WARNING in .../@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/helpers.js
Module Warning (from .../source-map-loader/dist/cjs.js):
Failed to parse source map from '.../@modelcontextprotocol/sdk/src/experimental/tasks/helpers.ts'
file: Error: ENOENT: no such file or directory, open
'.../@modelcontextprotocol/sdk/src/experimental/tasks/helpers.ts'
WARNING in .../@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js
Module Warning (from .../source-map-loader/dist/cjs.js):
Failed to parse source map from '.../@modelcontextprotocol/sdk/src/experimental/tasks/interfaces.ts'
file: Error: ENOENT: no such file or directory, open
'.../@modelcontextprotocol/sdk/src/experimental/tasks/interfaces.ts'
WARNING in .../@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/mcp-server.js
Module Warning (from .../source-map-loader/dist/cjs.js):
Failed to parse source map from '.../@modelcontextprotocol/sdk/src/experimental/tasks/mcp-server.ts'
file: Error: ENOENT: no such file or directory, open
'.../@modelcontextprotocol/sdk/src/experimental/tasks/mcp-server.ts'
Additional context
Possible fixes (any one resolves it):
- Add
"src"to thefilesarray inpackage.jsonso the referenced TypeScript sources ship alongside the maps. - Build with
--inlineSources(or post-process the maps to populatesourcesContent) so consumers don't needsrc/on disk — typically the cleanest option for a published library. - Strip the
//# sourceMappingURL=comments and omit.js.mapfiles if maps aren't intended for downstream consumption.
Happy to open a PR for whichever direction maintainers prefer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect package.json and a representative dist/**/*.js.map, especially dist/cjs/experimental/tasks/helpers.js.map, to understand how the published tarball and source-map paths are produced. Reproduce the warning with webpack and source-map-loader, then verify that the chosen packaging or source-map change lets the shipped maps resolve without warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100