# GitHub MCP Setup Guide The GitHub MCP server failed to connect with error: ``` Authorization header is badly formatted ``` ## Fixing the GitHub MCP Connection 1. **Check MCP configuration** (likely in `.claude/mcp.json` or Claude app settings): ```json { "mcpServers": { "github": { "command": "...", "args": [...], "env": { "GITHUB_TOKEN": "your-token-here" } } } } ``` 2. **Verify GitHub token**: - Token should be a GitHub Personal Access Token (PAT) - Required scopes: `repo`, `read:org` - Generate at: https://github.com/settings/tokens 3. **Token format**: - Classic PAT: `ghp_...` (starts with ghp_) - Fine-grained PAT: `github_pat_...` - No extra quotes or whitespace 4. **Common issues**: - Token expired (regenerate on GitHub) - Wrong token format (not base64 encoded, just raw token) - Authorization header format (should be `Bearer ` or `token `) 5. **Test token manually**: ```bash curl -H "Authorization: token YOUR_TOKEN" https://api.github.com/user ``` ## What GitHub MCP Would Enable Once connected, I could: - Create PRs directly from conversation - Check CI/CD status - Link commits to issues - Review PR comments - Update issue status ## Alternative: Manual Git + GitHub CLI If MCP stays broken, you can use `gh` CLI: ```bash # Install GitHub CLI if not present winget install --id GitHub.cli # Authenticate gh auth login # I can then use gh commands via Bash tool gh pr create --title "..." --body "..." gh pr status ``` ## To Diagnose Check Claude Code settings or MCP config file for the github server configuration and verify the token is valid.