github / github/github-mcp-server

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

Đang mở
#2,050 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
request ai review
Ngôn ngữ chính
Go
Star
33k
Fork
5k
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
52

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.