docs(install-claude): "environment variable" examples put the PAT in argv and the saved config
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- markdown
調査の方向性
docs/installation-guides/install-claude.mdのコマンド例とREADME.mdのトークン設定例から始め、それぞれがPATをClaude Codeに渡す方法を比較してください。issueが引用しているClaude Codeの環境変数展開に関するドキュメントを確認し、サポートされている構文を確かめてください。完了条件は、列挙されたすべての環境変数の例で、保存された設定に変数参照が保持され、PATがコマンド引数に展開されなくなることです。
索引モデルが issue の本文から書いたものです。
説明
Problem
Several Claude Code commands in docs/installation-guides/install-claude.md (and one in README.md) expand the personal access token in the shell before Claude Code runs, so the token ends up in the process argument list, in shell history, and as a literal value in the saved MCP configuration:
install-claude.md, "With an environment variable (Linux/macOS)":"Bearer '"$GITHUB_PAT"'"closes the single quotes so the shell substitutes the token into theclaude mcp add-jsonargument.install-claude.md, "With an environment variable (Windows PowerShell)":"Bearer $env:GITHUB_PAT"inside a double-quoted string, same effect.install-claude.md, Docker "With an environment variable":-e GITHUB_PERSONAL_ACCESS_TOKEN=$(grep GITHUB_PAT .env | cut -d '=' -f2).install-claude.md, legacy format:-H "Authorization: Bearer $(grep GITHUB_PAT .env | cut -d '=' -f2)", and the PowerShell variant$pat = "YOUR_GITHUB_PAT"followed by-H "Authorization: Bearer $pat".README.md, "Reference the token in configurations":-e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT.
The sections are labelled "With an environment variable", but the stored configuration does not reference the variable; it holds the token itself.
Suggested fix
Claude Code expands ${VAR} references in an MCP server's url, headers, env, command, and args when it connects (Claude Code MCP docs, "Environment variable expansion"). Keeping the reference in single quotes stores ${GITHUB_PAT} literally, so the token stays in the environment and never reaches argv, history, or the config file. Minimal diff, against main at 99d6d6503a7b2a133e2f8a595d6d0ba24b4086d3:
--- a/README.md
+++ b/README.md
@@ -226,8 +226,8 @@
3. **Reference the token in configurations**
```bash
- # CLI usage
- claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
+ # CLI usage (single quotes: Claude Code expands ${GITHUB_PAT} at start-up, so the token stays out of argv and the saved config)
+ claude mcp add github -e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PAT}' -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
# In config files (where supported)
"env": {
--- a/docs/installation-guides/install-claude.md
+++ b/docs/installation-guides/install-claude.md
@@ -40,14 +40,16 @@
With an environment variable (Linux/macOS):
```bash
export GITHUB_PAT="$(grep '^GITHUB_PAT=' .env | cut -d '=' -f2-)"
-claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer '"$GITHUB_PAT"'"}}'
+claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer ${GITHUB_PAT}"}}'
+The single quotes keep ${GITHUB_PAT} literal. Claude Code expands it from the environment when it connects, so the token stays out of the command line, shell history, and the saved configuration. Set GITHUB_PAT in the environment Claude Code starts from.
+
With an environment variable (Windows PowerShell):
$githubPatLine = Get-Content .env | Select-String "^\s*GITHUB_PAT\s*=" | Select-Object -First 1
$env:GITHUB_PAT = ($githubPatLine.Line -split "=", 2)[1].Trim().Trim('"').Trim("'")
-claude mcp add-json github "{`"type`":`"http`",`"url`":`"https://api.githubcopilot.com/mcp`",`"headers`":{`"Authorization`":`"Bearer $env:GITHUB_PAT`"}}"
+claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer ${GITHUB_PAT}"}}'
About the
--scopeflag (optional): Use this to specify where the configuration is stored:
@@ -80,7 +82,7 @@
With an environment variable:
-claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=$(grep GITHUB_PAT .env | cut -d '=' -f2) -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
+claude mcp add github -e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PAT}' -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
- Restart Claude Code
- Run
claude mcp listto see if the GitHub server is configured
@@ -112,7 +114,7 @@
With an environment variable:
-claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer $(grep GITHUB_PAT .env | cut -d '=' -f2)"
+claude mcp add --transport http github https://api.githubcopilot.com/mcp -H 'Authorization: Bearer ${GITHUB_PAT}'
Windows (PowerShell)
@@ -120,8 +122,7 @@
If you see missing required argument 'name', put the server name immediately after claude mcp add:
-$pat = "YOUR_GITHUB_PAT"
-claude mcp add github --transport http https://api.githubcopilot.com/mcp/ -H "Authorization: Bearer $pat"
+claude mcp add github --transport http https://api.githubcopilot.com/mcp/ -H 'Authorization: Bearer ${GITHUB_PAT}'
The placeholder variants (`YOUR_GITHUB_PAT`) are left as they are. I can open this as a pull request if that is easier to review.
- 主要言語
- Go
- スター
- 34.2k
- フォーク
- 5.3k
- 平均マージ
- 5日 18時間
- マージ済み PR(30日)
- 13
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/github-mcp-server のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
github/github-mcp-server#3760 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
github/github-mcp-server#3729 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
github/github-mcp-server#3722 ·
メンテナーはふだん 2 日以内に返信
-
Insiders Feedback: PR created UI doesn't link to the PR対応中かも @genius-0963 が 5 日前に担当しました。 オープンbug insiders user-experience
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
github/github-mcp-server#3658 ·
メンテナーはふだん 2 日以内に返信
-
Inconsistent parameter names対応中かも @huong8373tt-beep が 10 日前に担当しました。 オープンbug tool-improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
github/github-mcp-server#3605 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
github/github-mcp-server の issue をすべて見る
似ている issue
-
ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hexlet-basics/hexlet-basics#962 ·
メンテナーはふだん 1 日以内に返信
-
imapproxy closeForMaintenance grace timer calls clientConn.Close() before closeMaintenanceTransport対応中かも @dejanstrbac が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
renovate-health
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Netcracker/qubership-network-latency-exporter#267 ·
メンテナーはふだん 1 日以内に返信
-
Network capture does not work対応中かも @KSpaceer が今日担当しました。 オープンkind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aquasecurity/tracee#5395 ·