From d06c1812aa8fccae88bea255a9d733a9a5fe5fad Mon Sep 17 00:00:00 2001 From: syf2211 Date: Mon, 10 Aug 2026 00:01:50 +0000 Subject: [PATCH] docs(claude): fix Docker install commands for claude mcp add Remove unsupported -e flags from claude mcp add and pass environment variables through docker run instead. Fixes incorrect CLI usage that produced 'error: unknown option -e'. Fixes #3032 --- README.md | 3 ++- docs/installation-guides/install-claude.md | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f3114fb900..e116deaa93 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,8 @@ To keep your GitHub PAT secure and reusable across different MCP hosts: ```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 + export GITHUB_PERSONAL_ACCESS_TOKEN="$GITHUB_PAT" + claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server # In config files (where supported) "env": { diff --git a/docs/installation-guides/install-claude.md b/docs/installation-guides/install-claude.md index 04658c4520..efcc1830fb 100644 --- a/docs/installation-guides/install-claude.md +++ b/docs/installation-guides/install-claude.md @@ -67,7 +67,7 @@ claude mcp add-json github "{`"type`":`"http`",`"url`":`"https://api.githubcopil Log in with OAuth instead of a token. On github.com the official image already includes the app credentials, so you provide none yourself — the server opens a browser login on first use and keeps the token in memory only. In Docker, publish a fixed callback port to loopback. Run the following command in the terminal (not in Claude Code CLI): ```bash -claude mcp add github -e GITHUB_OAUTH_CALLBACK_PORT=8085 -- docker run -i --rm -p 127.0.0.1:8085:8085 -e GITHUB_OAUTH_CALLBACK_PORT ghcr.io/github/github-mcp-server +claude mcp add github -- docker run -i --rm -p 127.0.0.1:8085:8085 -e GITHUB_OAUTH_CALLBACK_PORT=8085 ghcr.io/github/github-mcp-server ``` See **[Local Server OAuth Login](../oauth-login.md)** for the native-binary flow (no fixed port), headless/device-code fallback, GitHub Enterprise, and bringing your own OAuth or GitHub App. @@ -75,12 +75,13 @@ See **[Local Server OAuth Login](../oauth-login.md)** for the native-binary flow To authenticate with a Personal Access Token instead (it takes precedence over OAuth): 1. Run the following command in the terminal (not in Claude Code CLI): ```bash -claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server +claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT ghcr.io/github/github-mcp-server ``` With an environment variable: ```bash -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 +export GITHUB_PERSONAL_ACCESS_TOKEN="$(grep '^GITHUB_PAT=' .env | cut -d '=' -f2-)" +claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server ``` 2. Restart Claude Code 3. Run `claude mcp list` to see if the GitHub server is configured