github / github/github-mcp-server
Feature: Auto-select token based on repository owner (multi-account support)
- Lingua principale
- Go
- Stelle
- 33k
- Fork
- 5k
- Merge medio
- 2g 1h
- PR unite (30g)
- 52
Descrizione
## Problem
When working across multiple GitHub accounts or organizations (e.g., personal repos + work org), users currently need to either:
1. Run multiple MCP server instances with different tokens (leads to duplicate toolsets)
2. Manually switch tokens when context changes
3. Use a single token that may not have access to all repos they work with
This creates friction for developers who contribute to both personal projects and organization repositories.
## Proposed Solution
Add support for automatic token selection based on the `owner` parameter in API calls.
### Configuration
```json
{
"accounts": {
"MagnetForensics": "ghp_org_token...",
"coconutbird": "ghp_personal_token...",
"*": "ghp_default_fallback..."
}
}
```
Or via environment variables:
```bash
GITHUB_ACCOUNT_MAGNETFORENSICS=ghp_org_token...
GITHUB_ACCOUNT_COCONUTBIRD=ghp_personal_token...
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_default_fallback... # fallback
```
### Behavior
- When a tool is called with `owner: "MagnetForensics"`, use the mapped token
- When a tool is called with `owner: "coconutbird"`, use that token
- Fall back to default/`*` token for unmapped owners
- For tools without an `owner` param (e.g., `list_notifications`), use the default token
## Use Cases
1. **Work + Personal** - Developer uses personal GitHub for side projects, org account for work
2. **Multiple orgs** - Contractor working across several client organizations
3. **Bot accounts** - Using a bot token for CI-related operations, personal token for reviews
4. **Scoped permissions** - Read-only token for some orgs, full access for others
## Alternatives Considered
- Running multiple server instances (works but duplicates all tools)
- Manual token switching (poor UX)
- GitHub App (more complex setup, not always feasible)
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.