Skip to content

Make MCP executable recover on non-FHS Linux#840

Open
st0012 wants to merge 1 commit into
mainfrom
codex/mcp-nix-loader-fallback
Open

Make MCP executable recover on non-FHS Linux#840
st0012 wants to merge 1 commit into
mainfrom
codex/mcp-nix-loader-fallback

Conversation

@st0012

@st0012 st0012 commented Jun 1, 2026

Copy link
Copy Markdown
Member

Context

rubydex_mcp now ships as a precompiled Rust executable inside the gem and is launched through the Ruby wrapper at exe/rubydex_mcp. On normal platforms, the wrapper can exec that packaged binary directly.

Nix-style Linux environments can break that direct launch. The binary is present and executable, but the kernel may still raise ENOENT because the ELF interpreter path baked into the binary, for example /lib64/ld-linux-x86-64.so.2, does not exist in the host filesystem. From an MCP client, this looks like the server cannot start even though the gem installed correctly.

Change

This keeps the normal path unchanged: the wrapper still tries to exec the packaged MCP binary first.

If that direct exec raises Errno::ENOENT, the wrapper now looks for the dynamic loader already mapped into the current Ruby process through /proc/self/maps. When it finds that loader, it re-execs the packaged MCP binary through it.

The launcher logic now lives in Rubydex::MCPServerLauncher, keeping exe/rubydex_mcp small and keeping these process-launch details out of the main Ruby API.

st0012 commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@st0012 st0012 force-pushed the codex/mcp-nix-loader-fallback branch 3 times, most recently from 8b386fc to ba91c7c Compare June 1, 2026 19:03
@st0012 st0012 force-pushed the codex/mcp-nix-loader-fallback branch from ba91c7c to ca485b0 Compare June 1, 2026 20:11
@st0012 st0012 marked this pull request as ready for review June 1, 2026 20:53
@st0012 st0012 requested a review from a team as a code owner June 1, 2026 20:53
@st0012 st0012 added the bugfix A change that fixes an existing bug label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix A change that fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant