Skip to content

feat(http): add --authorization-server flag to override OAuth AS URL - #2900

Merged
SamMorrowDrums merged 2 commits into
github:mainfrom
Anika-Sol:feat/authorization-server-override
Aug 20, 2026
Merged

SamMorrowDrums merged 2 commits into
github:mainfrom
Anika-Sol:feat/authorization-server-override

Conversation

@Anika-Sol

Copy link
Copy Markdown
Contributor

Summary

Adds a --authorization-server CLI flag (and GITHUB_AUTHORIZATION_SERVER env var) to the http subcommand, allowing operators to override the authorization server URL advertised in the OAuth Protected Resource Metadata (/.well-known/oauth-protected-resource).

Why

When deploying the MCP server against GitHub Enterprise Server, GHES does not natively support RFC 8414, RFC 7591, or PKCE — making direct MCP OAuth impossible. A common solution is to deploy a thin OAuth proxy in front of GHES that implements the MCP OAuth spec. However, the MCP server always derives authorization_servers from GITHUB_HOST, so clients are pointed at GHES directly instead of the proxy. Without this flag, operators must intercept /.well-known/oauth-protected-resource at the ingress layer as a workaround.

The AuthorizationServer field already exists in pkg/http/oauth/oauth.Config with the conditional in place — it simply wasn't reachable from any configuration surface.

What changed

  • Added AuthorizationServer string field to pkg/http/server.go ServerConfig
  • Wired cfg.AuthorizationServer into the oauth.Config struct in RunHTTPServer
  • Added --authorization-server flag on httpCmd in cmd/github-mcp-server/main.go
  • Added viper binding so GITHUB_AUTHORIZATION_SERVER env var works automatically

MCP impact

  • No tool or API changes — only affects OAuth metadata discovery; no tools, schemas, or API behavior changed

Prompts tested (tool changes only)

  • N/A

Security / limits

  • Auth / permissions considered — when set, this flag redirects clients to a different authorization server. Operators are responsible for ensuring the configured URL points to a trusted proxy. No change to token validation or API access control.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

@Anika-Sol
Anika-Sol requested a review from a team as a code owner July 17, 2026 13:51
Anika-Sol and others added 2 commits August 20, 2026 16:17
When deploying the MCP server behind an OAuth proxy (e.g. for GHES,
which does not natively support RFC 8414, RFC 7591, or PKCE), the
/.well-known/oauth-protected-resource endpoint currently always derives
the authorization_servers URL from GITHUB_HOST. There is no way to
point clients at a different authorization server without intercepting
that endpoint at the ingress/proxy layer.

The oauth.Config struct already has an AuthorizationServer field with
the conditional logic in place (pkg/http/oauth/oauth.go), but it was
never wired to any configuration surface.

This commit exposes it as:
- --authorization-server CLI flag on the http subcommand
- GITHUB_AUTHORIZATION_SERVER environment variable (via viper's
  existing GITHUB_ prefix + automatic env mapping)

When set, the value is passed through ServerConfig into oauth.Config,
and the protected resource metadata advertises it directly instead of
calling apiHost.AuthorizationServerURL().
Verify the HTTP-only configuration surface, unchanged host-derived default, and explicit override propagation through OAuth metadata.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SamMorrowDrums
SamMorrowDrums force-pushed the feat/authorization-server-override branch from 84ca9bb to 2aea819 Compare August 20, 2026 14:23
@SamMorrowDrums
SamMorrowDrums merged commit a7c3b49 into github:main Aug 20, 2026
15 of 16 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
github-mcp-server 1.11.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Highlights

- **Smarter OAuth challenges:** per-call scope checks request only the permissions each tool invocation needs with runtime checks where required.
- **Improved browser OAuth support:** CORS now works across OAuth discovery routes, with configurable authorization-server URLs.
- **Improved sub-issue workflow:** create parent and sub-issues atomically.
- **Better HTTP caching for STDIO:** REST responses support ETag conditional requests.
- **Runtime refresh:** upgraded to Go 1.27authorizationauthorization plus routine security and dependency updates.

## What's Changed
* feat(http): add --authorization-server flag to override OAuth AS URL by @Anika-Sol in github/github-mcp-server#2900
* Name the root command after the installed binary by @plusky in github/github-mcp-server#2998
* fix(http): preserve CORS across OAuth routes by @SamMorrowDrums in github/github-mcp-server#3147
* Add atomic parent issue creation by @zwick in github/github-mcp-server#3134
* Add ETag conditional requests to the REST transport by @joshfree in github/github-mcp-server#3026
* build(deps): bump github/codeql-action from 4 to 4.37.4 by @dependabot[bot] in github/github-mcp-server#3004
* Add per-call OAuth scope checks by @SamMorrowDrums in github/github-mcp-server#3128
* build(deps): bump docker/setup-buildx-action from 4.2.0 to 4.3.0 by @dependabot[bot] in github/github-mcp-server#3157
* build(deps): bump github.com/go-chi/chi/v5 from 5.3.1 to 5.3.2 by @dependabot[bot] in github/github-mcp-server#3156
* build(deps): bump distroless/base-debian12 from `76b3162` to `fabbf1c` by @dependabot[bot] in github/github-mcp-server#3154
* build(deps): bump golang from 1.25.13-alpine to 1.27.0-alpine by @dependabot[bot] in github/github-mcp-server#3153
* build(deps): bump github.com/stretchr/testify from 1.12.0 to 1.12.1 by @dependabot[bot] in github/github-mcp-server#3155

## New Contributors
* @Anika-Sol made their first contribution in github/github-mcp-server#2900
* @plusky made their first contribution in github/github-mcp-server#2998
* @joshfree made their first contribution in github/github-mcp-server#3026

**Full Changelog**: https://github.com/github/github-mcp-server/compare/v1.10.1...v1.11.0</pre>
  <p>View the full release notes at <a href="https://github.com/github/github-mcp-server/releases/tag/v1.11.0">https://github.com/github/github-mcp-server/releases/tag/v1.11.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants