You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add StartDeviceFlow for environments without callback capabilities
- Add StartOAuthFlow that auto-selects between device and interactive flows
- Detect Docker environment and use device flow automatically
- Add --oauth-callback-port flag for advanced Docker users with port binding
- Support fixed ports in callback server for Docker -p usage
- Update all OAuth endpoints to include device auth URL
- Comprehensive tests for both flows and port configurations
- Update README with Docker-specific OAuth instructions
Co-authored-by: SamMorrowDrums <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,10 +190,17 @@ To keep your GitHub PAT secure and reusable across different MCP hosts:
190
190
191
191
For stdio mode (local binary execution), you can use OAuth 2.1 with PKCE instead of a Personal Access Token. This provides an interactive browser-based login flow.
192
192
193
+
**The OAuth flow automatically adapts to your environment:**
-**Docker with port binding**: Can use PKCE flow with `--oauth-callback-port`
197
+
193
198
#### Prerequisites for OAuth
194
199
195
200
1. Create a GitHub OAuth App at [https://github.com/settings/developers](https://github.com/settings/developers)
196
-
- Set the callback URL to `http://localhost` (the actual port will be dynamically assigned)
201
+
- For native binary: Set callback URL to `http://localhost` (port is dynamic)
202
+
- For Docker with port binding: Set callback URL to `http://localhost:PORT/callback` (your chosen port)
203
+
- For Docker with device flow: No callback URL needed
197
204
- For public clients, you can use PKCE without a client secret
198
205
199
206
2. Set your OAuth app credentials:
@@ -204,22 +211,47 @@ For stdio mode (local binary execution), you can use OAuth 2.1 with PKCE instead
204
211
205
212
3. Run the server without a PAT:
206
213
```bash
214
+
# Native binary - interactive PKCE flow
207
215
./github-mcp-server stdio
216
+
217
+
# Docker - device flow (automatic)
218
+
docker run -i --rm -e GITHUB_OAUTH_CLIENT_ID=your_client_id ghcr.io/github/github-mcp-server
219
+
220
+
# Docker with port binding - interactive PKCE flow
221
+
docker run -i --rm -p 8080:8080 \
222
+
-e GITHUB_OAUTH_CLIENT_ID=your_client_id \
223
+
-e GITHUB_OAUTH_CALLBACK_PORT=8080 \
224
+
ghcr.io/github/github-mcp-server
208
225
```
209
226
210
-
The server will automatically detect the OAuth configuration and launch your browser for authorization. After you approve, the server will receive the token and start normally.
227
+
The server will automatically detect the environment and use the appropriate OAuth flow.
211
228
212
229
#### OAuth Configuration Options
213
230
214
231
-`--oauth-client-id` / `GITHUB_OAUTH_CLIENT_ID` - Your GitHub OAuth app client ID (required for OAuth flow)
215
232
-`--oauth-client-secret` / `GITHUB_OAUTH_CLIENT_SECRET` - Your client secret (optional, PKCE is used)
216
233
-`--oauth-scopes` / `GITHUB_OAUTH_SCOPES` - Comma-separated list of scopes (defaults: `repo,user,gist,notifications,read:org,project`)
234
+
-`--oauth-callback-port` / `GITHUB_OAUTH_CALLBACK_PORT` - Fixed callback port for Docker (0 for random)
0 commit comments