Skip to content

Conversation

@mcmatan
Copy link
Contributor

@mcmatan mcmatan commented Jan 26, 2026

Motivation

  • Ensure MCP servers (skills) start reliably in packaged macOS/Windows builds even when system Node is missing by routing their commands through the bundled Node runtime and shipping tsx runtime files with the app.
  • Make NODE_BIN_PATH and a bundled-Node PATH available to MCP child processes so tools like npx/tsx and Playwright install run without requiring a host Node installation.

Description

  • Added getBundledTsxPath(), getMcpEnvironment(), and getMcpCommand() to apps/desktop/src/main/opencode/config-generator.ts and use them to construct MCP server command and environment so packaged apps run MCP servers with the bundled Node and bundled tsx when available and fall back to ['npx','tsx', ...] otherwise.
  • Imported getNodePath/getBundledNodePaths and expose NODE_BIN_PATH and prepend bundled Node bin to PATH for MCP processes so CLI tools work without system Node.
  • Added tsx as a runtime dependency in apps/desktop/package.json and included node_modules/tsx, node_modules/esbuild, and node_modules/get-tsconfig in the packaging files and asarUnpack lists so tsx and its runtime deps are present inside packaged releases.
  • Updated pnpm-lock.yaml to reflect the added tsx dependency.

Testing

  • No automated tests were executed as part of this change; CI will run the repository's existing unit, integration, and typecheck jobs per .github/workflows/ci.yml.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c35d81fedf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 135 to 136
"node_modules/esbuild/**",
"node_modules/tsx/**",

Choose a reason for hiding this comment

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

P1 Badge Unpack tsx runtime deps with bundled tsx

In packaged builds you run tsx from app.asar.unpacked/.../node_modules/tsx/dist/cli.mjs, but only tsx and esbuild are listed in asarUnpack here. tsx has a runtime dependency on get-tsconfig; because module resolution from an unpacked path does not traverse into the packed app.asar sibling, get-tsconfig will be MODULE_NOT_FOUND at runtime unless it is also unpacked alongside tsx. This will prevent MCP servers from starting in packaged apps when the bundled tsx path is used.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codex fix

Choose a reason for hiding this comment

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

Summary

Testing

  • Not run (not requested).

View task →

@mcmatan
Copy link
Contributor Author

mcmatan commented Jan 26, 2026

@codex review

@mcmatan
Copy link
Contributor Author

mcmatan commented Jan 26, 2026

@codex fix the CI failures

@chatgpt-codex-connector
Copy link

Summary

Testing

  • ⚠️ Not run (not requested).

View task →

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c35d81fedf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 135 to 136
"node_modules/esbuild/**",
"node_modules/tsx/**",

Choose a reason for hiding this comment

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

P1 Badge Unpack get-tsconfig with tsx for bundled Node

In packaged builds the MCP servers are started via bundled Node executing app.asar.unpacked/node_modules/tsx/dist/cli.mjs, which runs under a standalone Node process that cannot read modules from app.asar. tsx depends on get-tsconfig (see pnpm-lock.yaml entry for tsx@4.21.0), but only tsx and esbuild are unpacked here, leaving get-tsconfig inside app.asar. That will make the bundled Node process fail to resolve get-tsconfig at runtime (e.g., Cannot find module 'get-tsconfig'), preventing MCP servers from starting in packaged builds. Consider adding node_modules/get-tsconfig/** to asarUnpack or otherwise colocating it with the unpacked tsx tree.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codex fix

Choose a reason for hiding this comment

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

Summary

Testing

  • Not run (not requested).

View task →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants