@@ -201,20 +201,25 @@ For stdio mode (local binary execution), you can use OAuth 2.1 with PKCE instead
201201``` bash
202202# 1. Create GitHub OAuth App at https://github.com/settings/developers
203203# 2. Run with Docker (device flow automatic)
204- docker run -i --rm -e GITHUB_OAUTH_CLIENT_ID=your_client_id ghcr.io/github/github-mcp-server
204+ docker run -i --rm \
205+ -e GITHUB_OAUTH_CLIENT_ID=your_client_id \
206+ -e GITHUB_OAUTH_CLIENT_SECRET=your_client_secret \
207+ ghcr.io/github/github-mcp-server
205208# → Displays: Visit https://github.com/login/device and enter code: ABCD-1234
206209```
207210
208211** Option 2: Interactive Flow (Best UX)**
209212``` bash
210213# For native binary
211214export GITHUB_OAUTH_CLIENT_ID=your_client_id
215+ export GITHUB_OAUTH_CLIENT_SECRET=your_client_secret
212216./github-mcp-server stdio
213217# → Browser opens automatically
214218
215219# For Docker with port binding (requires setup in OAuth app callback)
216220docker run -i --rm -p 8080:8080 \
217221 -e GITHUB_OAUTH_CLIENT_ID=your_client_id \
222+ -e GITHUB_OAUTH_CLIENT_SECRET=your_client_secret \
218223 -e GITHUB_OAUTH_CALLBACK_PORT=8080 \
219224 ghcr.io/github/github-mcp-server
220225# → Browser opens automatically (callback works via bound port)
@@ -226,12 +231,11 @@ docker run -i --rm -p 8080:8080 \
226231 - For native binary: Set callback URL to ` http://localhost ` (port is dynamic)
227232 - For Docker with port binding: Set callback URL to ` http://localhost:PORT/callback ` (your chosen port)
228233 - For Docker with device flow: No callback URL needed
229- - For public clients, you can use PKCE without a client secret
230234
2312352 . Set your OAuth app credentials:
232236 ``` bash
233237 export GITHUB_OAUTH_CLIENT_ID=your_client_id
234- export GITHUB_OAUTH_CLIENT_SECRET=your_client_secret # Optional for public clients with PKCE
238+ export GITHUB_OAUTH_CLIENT_SECRET=your_client_secret
235239 ```
236240
2372413 . Run the server without a PAT:
@@ -240,11 +244,15 @@ docker run -i --rm -p 8080:8080 \
240244 ./github-mcp-server stdio
241245
242246 # Docker - device flow (automatic)
243- docker run -i --rm -e GITHUB_OAUTH_CLIENT_ID=your_client_id ghcr.io/github/github-mcp-server
247+ docker run -i --rm \
248+ -e GITHUB_OAUTH_CLIENT_ID=your_client_id \
249+ -e GITHUB_OAUTH_CLIENT_SECRET=your_client_secret \
250+ ghcr.io/github/github-mcp-server
244251
245252 # Docker with port binding - interactive PKCE flow
246253 docker run -i --rm -p 8080:8080 \
247254 -e GITHUB_OAUTH_CLIENT_ID=your_client_id \
255+ -e GITHUB_OAUTH_CLIENT_SECRET=your_client_secret \
248256 -e GITHUB_OAUTH_CALLBACK_PORT=8080 \
249257 ghcr.io/github/github-mcp-server
250258 ```
@@ -254,13 +262,16 @@ The server will automatically detect the environment and use the appropriate OAu
254262#### OAuth Configuration Options
255263
256264- ` --oauth-client-id ` / ` GITHUB_OAUTH_CLIENT_ID ` - Your GitHub OAuth app client ID (required for OAuth flow)
257- - ` --oauth-client-secret ` / ` GITHUB_OAUTH_CLIENT_SECRET ` - Your client secret (optional, PKCE is used )
265+ - ` --oauth-client-secret ` / ` GITHUB_OAUTH_CLIENT_SECRET ` - Your GitHub OAuth app client secret (required )
258266- ` --oauth-scopes ` / ` GITHUB_OAUTH_SCOPES ` - Comma-separated list of scopes (defaults: ` repo,user,gist,notifications,read:org,project ` )
259267- ` --oauth-callback-port ` / ` GITHUB_OAUTH_CALLBACK_PORT ` - Fixed callback port for Docker (0 for random)
260268
261269Example with custom scopes:
262270``` bash
263- ./github-mcp-server stdio --oauth-client-id YOUR_CLIENT_ID --oauth-scopes repo,user
271+ ./github-mcp-server stdio \
272+ --oauth-client-id YOUR_CLIENT_ID \
273+ --oauth-client-secret YOUR_CLIENT_SECRET \
274+ --oauth-scopes repo,user
264275```
265276
266277#### Pre-configured MCP Host Setup
@@ -271,8 +282,13 @@ OAuth can be pre-configured for MCP hosts (similar to PAT distribution). For Doc
271282``` bash
272283claude mcp add github \
273284 -e GITHUB_OAUTH_CLIENT_ID=your_client_id \
285+ -e GITHUB_OAUTH_CLIENT_SECRET=your_client_secret \
274286 -e GITHUB_OAUTH_CALLBACK_PORT=8080 \
275- -- docker run -i --rm -p 8080:8080 -e GITHUB_OAUTH_CLIENT_ID -e GITHUB_OAUTH_CALLBACK_PORT ghcr.io/github/github-mcp-server
287+ -- docker run -i --rm -p 8080:8080 \
288+ -e GITHUB_OAUTH_CLIENT_ID \
289+ -e GITHUB_OAUTH_CLIENT_SECRET \
290+ -e GITHUB_OAUTH_CALLBACK_PORT \
291+ ghcr.io/github/github-mcp-server
276292```
277293
278294** VS Code (settings.json):**
@@ -282,9 +298,14 @@ claude mcp add github \
282298 "servers" : {
283299 "github" : {
284300 "command" : " docker" ,
285- "args" : [" run" , " -i" , " --rm" , " -p" , " 8080:8080" , " -e" , " GITHUB_OAUTH_CLIENT_ID" , " -e" , " GITHUB_OAUTH_CALLBACK_PORT" , " ghcr.io/github/github-mcp-server" ],
301+ "args" : [" run" , " -i" , " --rm" , " -p" , " 8080:8080" ,
302+ " -e" , " GITHUB_OAUTH_CLIENT_ID" ,
303+ " -e" , " GITHUB_OAUTH_CLIENT_SECRET" ,
304+ " -e" , " GITHUB_OAUTH_CALLBACK_PORT" ,
305+ " ghcr.io/github/github-mcp-server" ],
286306 "env" : {
287307 "GITHUB_OAUTH_CLIENT_ID" : " ${input:github_oauth_client_id}" ,
308+ "GITHUB_OAUTH_CLIENT_SECRET" : " ${input:github_oauth_client_secret}" ,
288309 "GITHUB_OAUTH_CALLBACK_PORT" : " 8080"
289310 }
290311 }
0 commit comments