Repository navigation
docs: keep PAT references literal in environment-variable install examples - #3788
shhhhhhjokerist wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The warnings in README.md and the Claude installation guide incorrectly imply that expanding $GITHUB_PAT exposes the token in Bash history, rather than only in process arguments and saved configuration.
1 open issue
What changed in this PR
This docs-only PR addresses #3758 by keeping personal access token references literal in Claude Code installation commands, allowing expansion at connection time rather than during registration.
Changes:
- Uses single-quoted
${GITHUB_PAT}references in Bash and PowerShell examples. - Loads
GITHUB_PATbefore Docker and legacy registration commands. - Clarifies environment-variable expansion in configuration examples; no tools or APIs change.
| File | Description |
|---|---|
README.md |
Updates secure PAT guidance and literal environment-variable references. |
docs/installation-guides/install-claude.md |
Updates HTTP, Docker, and legacy installation examples to defer token expansion. |
Review effort: Balanced (auto)
|
|
||
| 3. **Reference the token in configurations** | ||
|
|
||
| Quote the value when you add the server so the host expands `${GITHUB_PAT}` when it connects. Letting the shell expand it instead writes the token into the command line, the shell history, and the saved configuration: |
There was a problem hiding this comment.
Thanks - fixed in 3bbcdb9. Bash keeps the command as typed, so the notes now say the token reaches process arguments and the saved configuration; the same correction is in docs/installation-guides/install-claude.md:45, and the PR body no longer claims shell history either.
The "With an environment variable" examples in the Claude Code installation guide
and the README expanded GITHUB_PAT in the shell before passing it to the client:
claude mcp add github -- docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT ...
That puts the token value in the process arguments and in whatever configuration
the client saves, which is exactly what the installation guide is trying to avoid.
Both hosts expand ${VAR} themselves in command, args, env, url and headers when
they connect, so pass the reference through unexpanded instead:
- Linux/macOS and Docker examples export GITHUB_PAT first and then use single
quotes: -e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PAT}' and
-H 'Authorization: Bearer ${GITHUB_PAT}'.
- The PowerShell example quotes each argument with '...' and uses
$env:GITHUB_PAT, which the shell does not expand either.
The remaining examples (Windows legacy cmd, the plain docker -e form, and the
"paste the token" alternatives) are unchanged because they either cannot
reference an environment variable at all or intentionally inline the value.
Bash keeps a command in history exactly as typed, so the surrounding notes now
say that shell expansion exposes the token in process arguments and saved
configuration, not in shell history.
ea87692 to
3bbcdb9
Compare

Summary
Docs-only change: the "environment variable" install examples expand the PAT in the shell instead of storing a
${GITHUB_PAT}reference, so the token ends up in the process arguments and the saved MCP configuration.Why
Fixes #3758. Claude Code expands
${VAR}references inurl,headers,env,commandandargswhen it connects, so quoting the reference keeps the token in the environment only.What changed
README.md— "Handling PATs Securely": the CLI and config-file examples now use a single-quoted${GITHUB_PAT}reference, and a short note explains why.docs/installation-guides/install-claude.md— the Linux/macOS, PowerShell, Docker and legacy "with an environment variable" examples keep the reference literal:add-jsonexamples no longer splice the shell-expanded token into the JSON argument; PowerShell now uses single quotes.addexamples exportGITHUB_PATfrom.envfirst and pass-e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PAT}'/-H 'Authorization: Bearer ${GITHUB_PAT}'.$env:GITHUB_PATand quotes the header, instead of interpolating$pat.MCP impact
Prompts tested (tool changes only)
Not applicable — docs only.
Security / limits
The token is no longer written to argv or the stored configuration: it stays in the host environment and is expanded at connect time.
Tool renaming