Skip to content

Commit d06c181

Browse files
committed
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
1 parent eb4c099 commit d06c181

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ To keep your GitHub PAT secure and reusable across different MCP hosts:
215215

216216
```bash
217217
# CLI usage
218-
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
218+
export GITHUB_PERSONAL_ACCESS_TOKEN="$GITHUB_PAT"
219+
claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
219220

220221
# In config files (where supported)
221222
"env": {

docs/installation-guides/install-claude.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,21 @@ claude mcp add-json github "{`"type`":`"http`",`"url`":`"https://api.githubcopil
6767
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):
6868

6969
```bash
70-
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
70+
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
7171
```
7272

7373
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.
7474

7575
To authenticate with a Personal Access Token instead (it takes precedence over OAuth):
7676
1. Run the following command in the terminal (not in Claude Code CLI):
7777
```bash
78-
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
78+
claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT ghcr.io/github/github-mcp-server
7979
```
8080

8181
With an environment variable:
8282
```bash
83-
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
83+
export GITHUB_PERSONAL_ACCESS_TOKEN="$(grep '^GITHUB_PAT=' .env | cut -d '=' -f2-)"
84+
claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
8485
```
8586
2. Restart Claude Code
8687
3. Run `claude mcp list` to see if the GitHub server is configured

0 commit comments

Comments
 (0)