github / github/github-mcp-server

http mode: support static token auth (env) for single-tenant self-hosted deployments

Abierto
#2,946 2 comentarios 1 reacción 0 asignados Ver en GitHub
enhancement request ai review
Lenguaje dominante
Go
Estrellas
33k
Forks
5k
Merge medio
2 d 1 h
PR fusionados (30 d)
52

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with pkg/http/middleware/token.go and cmd/github-mcp-server/main.go, then compare how the stdio command reads GITHUB_PERSONAL_ACCESS_TOKEN and GITHUB_ACCESS_TOKEN. Done means an explicit HTTP-mode opt-in can use the configured environment token when Authorization is absent, while per-request tokens still take precedence and requests without either remain unauthorized.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
go
Área
api, authentication, backend
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
68/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.