github / github/github-mcp-server

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

オープン
#2,050 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
request ai review
主要言語
Go
スター
33k
フォーク
5k
平均マージ
2日 1時間
マージ済み PR(30日)
52

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。