github / github/github-mcp-server

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

Ouverte
#2,050 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
request ai review
Langage dominant
Go
Étoiles
33k
Forks
5k
Merge moyen
2 j 1 h
PR mergées (30 j)
52

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

The issue names no files, tests, or entry points. Start by locating the Go server's configuration and token-selection path, then trace how tool calls receive an owner. Done means account mappings, environment-variable configuration, default fallback behavior, and owner-less calls are covered, with tests for each routing case.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
authentication, backend
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.