fix(cli): stdio mcp-remote bridge for Claude Desktop onboarding#96
Draft
d-mo wants to merge 1 commit into
Draft
Conversation
Claude Desktop's claude_desktop_config.json only supports stdio MCP
servers (command/args/env); remote servers are added through the app's
Settings -> Connectors UI. Onboarding previously wrote a remote-shaped
entry ({url, transport, headers}) into the file, which Claude Desktop
cannot parse and which can wedge the app's entire MCP subsystem
(observed bricking an external tester's install on an older build).
Changes:
- BuildManagedServer now emits an mcp-remote stdio bridge for Claude
Desktop: command "npx", args ["-y", "mcp-remote", <url>, "--header",
"Authorization:${AUTH_HEADER}"] with env {AUTH_HEADER: "Bearer
<token>"}. The header is split into a space-free arg plus an env
block per the mcp-remote README workaround for Claude Desktop's
arg-space mangling.
- Preflight: onboarding writes no Preloop entry at all when npx/node
is not resolvable (there is no valid fallback shape). The plan marks
the MCP-config step skipped, records it in the enrollment validation
result, and tells the user their options: install Node.js and re-run,
or add Preloop as a custom connector via Settings -> Connectors using
the MCP URL (the endpoint supports the MCP OAuth flow). The existing
preloop-entry prune still removes any broken remote-shaped entry left
by an earlier onboard.
- ValidateManagedConfig validates the bridge shape for Claude Desktop
(npx + mcp-remote + endpoint URL in args, --header auth via env or
literal) and rejects the legacy remote shape.
- Onboarding output no longer claims MCP-firewall governance when the
MCP-config step was skipped.
New seam resolveClaudeDesktopBridgeRuntime (package-level var, in the
style of resolveNpmExecutable) lets tests stub runtime resolution.
Adds 5 tests covering the bridge shape, JSON round-trip validation,
legacy-shape rejection, and both preflight outcomes.
Contributor
🔍 Preloop Code ReviewLast Updated: 2026-07-20 📝 SummaryWell-structured fix for the Claude Desktop MCP onboarding issue. The PR correctly replaces the invalid remote-shaped entry with an mcp-remote stdio bridge, adds preflight checks for Node.js availability, updates validation to match the new shape, and provides clear user guidance when the bridge can't be written. Follows existing code patterns consistently. ✅ What Looks Good
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Onboarding wrote a remote-shaped MCP entry (
{url, transport, headers}) intoclaude_desktop_config.json. Claude Desktop's config file only supports stdio servers (command/args/env) — remote servers are added via Settings → Connectors — and the invalid entry can wedge the app's whole MCP subsystem. This bricked an external tester's Claude Desktop (older build, Intel Mac) until they logged out/in.Fix (Claude Desktop only; other agents' shapes untouched)
BuildManagedServernow writes the mcp-remote stdio bridge:{ "command": "npx", "args": ["-y", "mcp-remote", "<url>", "--header", "Authorization:${AUTH_HEADER}"], "env": {"AUTH_HEADER": "Bearer <token>"} }envblock, per the mcp-remote README workaround for Claude Desktop mangling spaces in args.npx/nodeis not resolvable, no Preloop entry is written at all (there is no valid fallback shape). The enrollment marks the MCP-config step skipped and tells the user their options: install Node.js and re-run, or add Preloop as a custom connector in Settings → Connectors using the MCP URL (the endpoint supports the MCP OAuth flow). The existing prune still removes any broken remote-shaped entry left by an earlier onboard, so re-running the CLI repairs bricked configs.ValidateManagedConfigvalidates the bridge shape for Claude Desktop and rejects the legacy remote shape.mcp_config_skipped).Testing
resolveClaudeDesktopBridgeRuntimetest seam).go build ./... && go test ./...green (350 tests in internal/cmd),gofmt -lclean.Note
Low Risk
Well-structured fix following existing patterns; only affects Claude Desktop onboarding path.
Overview
Replaces the invalid remote-shaped MCP entry in Claude Desktop config with an mcp-remote stdio bridge. Adds preflight checks for Node.js availability, updates validation, and provides clear fallback guidance.
Written by Preloop PR Reviewer for commit fix/claude-desktop-mcp-bridge. Updates automatically on new commits.