github / github/github-mcp-server

Feature: Auto-select token based on repository owner (multi-account support)

Abierto
#2,050 1 comentario 0 reacciones 0 asignados Ver en GitHub
request ai review
Lenguaje dominante
Go
Estrellas
33k
Forks
5k
Merge medio
2 d 1 h
PR fusionados (30 d)
52

Descripción

## 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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.