Skip to content

Add GitHub CLI authentication support#2

Merged
christian-andersson merged 2 commits intomainfrom
add-better-github-access-handling
Jan 23, 2026
Merged

Add GitHub CLI authentication support#2
christian-andersson merged 2 commits intomainfrom
add-better-github-access-handling

Conversation

@christian-andersson
Copy link
Member

Summary

  • Add GitHub CLI (gh auth token) as an authentication fallback method
  • Improves developer experience by using existing gh CLI credentials automatically
  • Add local .mcp.json configuration for "dogfooding" the MCP server during development

Changes

Authentication Enhancement

  • Add getGhCliToken() method in token-resolver.ts to execute gh auth token command
  • Make resolveToken() async to support command execution
  • Update GitHubClient to lazily resolve tokens on first request (async support)
  • Add token caching to prevent repeated gh CLI calls

Authentication Resolution Order

  1. Org-specific tokens (GITHUB_TOKEN_<ORG>) - for multi-org scenarios
  2. Environment variable (GITHUB_TOKEN) - explicit configuration
  3. GitHub CLI (gh auth token) - NEW automatic fallback
  4. Unauthenticated - public repos only

Configuration Updates

  • Add --allow-run=gh permission to all Deno run commands
  • Update all documentation examples with the new permission
  • Add .mcp.json for local development (demonstrates dogfooding)
  • Remove deprecated MCP Gateway configuration from README

Documentation

  • Add "With GitHub CLI" section explaining the new auth method
  • Update authentication flow diagram
  • Clarify when each auth method is recommended

Benefits

  • Zero-config for developers: If you have gh CLI authenticated, it just works
  • Better security: No need to create separate tokens for local development
  • Backwards compatible: Existing token-based configurations continue to work
  • Dogfooding: Project now uses its own MCP server for development

Testing

Tested with:

  • Existing environment variable tokens (no regression)
  • Fresh gh CLI authentication (gh auth login)
  • Unauthenticated mode for public repos

🤖 Generated with Claude Code

christian-andersson and others added 2 commits January 23, 2026 15:24
Add support for automatic token resolution via gh CLI as a fallback
authentication method. This improves developer experience by allowing
the service to use existing gh CLI credentials without requiring manual
token configuration.

Changes:
- Add gh CLI token resolution in token-resolver.ts
- Make token resolution async to support command execution
- Update client to lazily resolve tokens on first request
- Add --allow-run=gh permission to all configurations
- Update documentation with gh CLI setup instructions

Authentication resolution order:
1. Org-specific tokens (GITHUB_TOKEN_<ORG>)
2. Environment variable (GITHUB_TOKEN)
3. GitHub CLI (gh auth token) - NEW
4. Unauthenticated

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add .mcp.json to configure the project to use its own MCP server for
local development and testing. This demonstrates "dogfooding" and
provides a working example for contributors.

Configuration includes:
- Relative path to main.ts for local development
- All required permissions including --allow-run=gh
- MIN_RELEASE_AGE_DAYS environment variable

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@christian-andersson christian-andersson merged commit 3d80eeb into main Jan 23, 2026
@christian-andersson christian-andersson deleted the add-better-github-access-handling branch January 23, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants