Skip to content

fix(http): preserve CORS across OAuth routes - #3147

Merged
SamMorrowDrums merged 2 commits into
mainfrom
sammorrowdrums-fix-http-cors-support
Aug 24, 2026
Merged

SamMorrowDrums merged 2 commits into
mainfrom
sammorrowdrums-fix-http-cors-support

Conversation

@SamMorrowDrums

@SamMorrowDrums SamMorrowDrums commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • apply the browser CORS contract at the root HTTP router so MCP, protected-resource metadata, 401/500, 404, and 405 responses retain CORS headers
  • expose WWW-Authenticate and Mcp-Session-Id without enabling credentialed wildcard requests
  • register RFC 9728 protected-resource metadata for every readonly, insiders, and toolset route combination
  • document the RFC 8414 authorization-server discovery boundary and browser-compatible OAuth proxy option

Validation

  • script/lint
  • script/test
  • browser-equivalent probes with Origin: https://confer.to

Hosted dependencies

  • Copilot API header forwarding/exposure: https://github.com/github/copilot-api/pull/37229
  • GitHub MCP remote server must consume this route contract and provide terminal CORS handling
  • the advertised GitHub authorization-server metadata endpoint must support browser CORS

Addresses the OSS server portion of #3095.

Apply the browser CORS contract at the root router so authentication, metadata, error, and fallback responses retain the required headers. Register protected-resource metadata for every MCP route variant and verify each challenge round trip.\n\nRefs #3095\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 24, 2026 10:14
@SamMorrowDrums
SamMorrowDrums requested a review from a team as a code owner August 24, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Centralizes CORS handling for all HTTP routes and expands OAuth protected-resource discovery across every MCP route variant.

Changes:

  • Apply CORS middleware at the root router.
  • Add OAuth metadata routes for readonly, insiders, and toolset combinations.
  • Expand contract tests and OAuth/CORS documentation.
Show a summary per file
File Description
pkg/http/server.go Centralizes HTTP router construction and CORS handling.
pkg/http/server_test.go Tests CORS and OAuth metadata route contracts.
pkg/http/oauth/oauth.go Adds missing protected-resource route variants.
pkg/http/oauth/oauth_test.go Verifies the complete metadata route matrix.
pkg/http/middleware/cors.go Preserves existing exposed response headers.
pkg/http/middleware/cors_test.go Tests preflight and exposed-header behavior.
docs/streamable-http.md Documents OAuth discovery and browser proxy requirements.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Prevent unrecognized protected-resource metadata paths from falling through to the MCP root mount and producing recursive authentication challenges.\n\nRefs #3095\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@SamMorrowDrums
SamMorrowDrums merged commit 8898db9 into main Aug 24, 2026
20 checks passed
@SamMorrowDrums
SamMorrowDrums deleted the sammorrowdrums-fix-http-cors-support branch August 24, 2026 13:08
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