Preserve ${VAR} placeholders in MCP server headers for runtime expansion#398
Merged
Conversation
…xpansion
configure_mcp_server() interpolated the MCP --header (and the Windows --env) into the claude mcp add bash command using double quotes, so a ${VAR} placeholder in an Authorization header was expanded by the installer shell at setup time, baking the resolved token (or an empty string when the variable was unset) into the config instead of preserving the placeholder.
Switch these interpolations to shlex.quote, matching the Unix --env path that already did so, so the literal ${VAR} reaches claude mcp add and is stored verbatim; Claude Code then expands it from the environment at runtime, making env-var-referencing MCP headers work at user, local, and project scope, deterministically and independent of OS or shell.
Invert two tests that encoded the old double-quote behavior, add a Windows sibling unit test and a real cross-OS e2e test that drives the actual platform shell via a fake claude recorder, and document the runtime ${VAR} expansion, shell/OS independence, and the must-be-set / ${VAR:-default} caveat.
…e guard test_install_claude_below_error_threshold asserted install_claude.py stays under a 120 KiB ceiling (Linux MAX_ARG_STRLEN/E2BIG), but the file is ~182 KiB, so it had been marked xfail. That ceiling is obsolete: the Linux/macOS bootstrap scripts download install_claude.py to a file (curl -o) and run it via uv run <file>, never passing it inline as an execve() argument, so file size no longer maps to a real failure mode. Replace the xfail'd hard gate (and the now-unused ERROR_THRESHOLD_BYTES) with a parametrized test asserting the real invariant -- every Linux/macOS bootstrap downloads install_claude.py to a file and never pipes a fetched script into uv/python -- while keeping the informational size warning.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
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.
No description provided.