http mode: support static token auth (env) for single-tenant self-hosted deployments
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- api, authentication, backend
Direzione di ricerca
Inizia da pkg/http/middleware/token.go e cmd/github-mcp-server/main.go, quindi confronta il modo in cui il comando stdio legge GITHUB_PERSONAL_ACCESS_TOKEN e GITHUB_ACCESS_TOKEN. Il lavoro è completato quando un opt-in esplicito alla modalità HTTP può usare il token d’ambiente configurato quando Authorization è assente, mentre i token per richiesta continuano ad avere la precedenza e le richieste senza nessuno dei due rimangono non autorizzate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the feature or problem you’d like to solve
github-mcp-server http requires a per-request Authorization header and never reads GITHUB_PERSONAL_ACCESS_TOKEN from the environment - token extraction happens only in pkg/http/middleware/token.go (ExtractUserToken), and httpCmd's ServerConfig has no token field (cmd/github-mcp-server/main.go). The env var is consulted only by the stdio command.
That fits the multi-tenant/centralized use case http mode was built for (#471, #997). But it leaves a gap for single-tenant self-hosted deployments: an org running one server instance with one service credential, fronted by a gateway/tunnel that cannot inject custom headers (in our case, Anthropic's MCP tunnels; the same applies to any transport that forwards requests as-is). The server starts cleanly with the env var set, then 401s every request - a confusing failure, since the README's env-var examples don't mention they're stdio-only.
Proposed solution
In http mode, when no Authorization header is present on a request, fall back to a statically configured token (GITHUB_PERSONAL_ACCESS_TOKEN / GITHUB_ACCESS_TOKEN), opt-in via a flag, e.g.:
github-mcp-server http --static-auth # or --token-from-env
Per-request tokens would still take precedence, preserving the multi-tenant behavior. Notably, the 2026-01-28 GitHub changelog announcing HTTP mode described exactly this fallback ("falls back GITHUB_PERSONAL_ACCESS_TOKEN if no header is provided"), but the shipped behavior doesn't include it.
- Lingua principale
- Go
- Stelle
- 33.1k
- Fork
- 5k
- Merge medio
- 2g 15h
- PR unite (30g)
- 27
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/github-mcp-server
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github/github-mcp-server#3235 ·
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
github/github-mcp-server#3042 · 2 commenti ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/github-mcp-server#3032 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
github/github-mcp-server#2803 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
github/github-mcp-server#2740 ·
Tutte le issue di github/github-mcp-server
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/registry#1654 ·
-
Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
milvus-io/birdwatcher#545 ·