Skip to content

fix(mcp): emit Node-resolvable ESM imports - #861

Merged
Aymericr merged 4 commits into
mainfrom
codex/fix-mcp-node-esm
Sep 12, 2026
Merged

fix(mcp): emit Node-resolvable ESM imports#861
Aymericr merged 4 commits into
mainfrom
codex/fix-mcp-node-esm

Conversation

@Aymericr

@Aymericr Aymericr commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

The published @pascal-app/mcp@1.0.0 exits under Node before transport setup because both MCP and its @pascal-app/core peer emit extensionless relative ESM imports. For example, Node cannot resolve dist/bridge/node-shims from the CLI entrypoint.

This adds a shared post-build rewrite for emitted JavaScript in core and MCP, then gates the MCP workflow and both packages' publish hooks with real Node imports. It fixes the runtime half of #704; the cloud-to-local capture handoff remains tracked by #737.

Validation:

  • @pascal-app/core build + Node import smoke
  • @pascal-app/mcp build + Node CLI/subpath import smoke
  • MCP suite: 366 passed
  • packed core and MCP tarballs installed into an isolated consumer and loaded under Node 26
  • Biome and git diff --check

Note

Medium Risk
Build-time rewriting of all published ESM output affects every consumer import path; mitigated by Node smoke tests in CI and publish hooks.

Overview
Fixes Node ESM resolution for published @pascal-app/core and @pascal-app/mcp by rewriting extensionless relative imports in emitted dist .js and .d.ts after tsc.

Adds scripts/fix-node-esm-imports.ts, wired into both packages’ build (MCP also rewrites sibling ../core/dist). smoke:node checks (node import of core entry; pascal-mcp --help for MCP) run in prepublishOnly and in mcp-ci after the MCP build. CHANGELOG notes that pascal-mcp and subpath exports no longer depend on Bun’s extensionless import behavior.

Reviewed by Cursor Bugbot for commit 6fbcc6e. Bugbot is set up for automated code reviews on this repo. Configure here.

@pascal

pascal Bot commented Sep 12, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 49c7bb74-20d3-4f19-b408-6b8c826f0909

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2b1e350. Configure here.

Comment thread packages/mcp/package.json
@Aymericr
Aymericr merged commit 5275f3e into main Sep 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant