FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(http): preserve CORS across OAuth routes by SamMorrowDrums · Pull Request #3147 · github/github-mcp-server · GitHub

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

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

fix(http): preserve CORS across OAuth routes#3147
SamMorrowDrums merged 2 commits into
mainfrom
sammorrowdrums-fix-http-cors-support

Conversation

SamMorrowDrums commented Aug 24, 2026
edited
Loading

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Review details

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

SamMorrowDrums merged commit 8898db9 into main Aug 24, 2026
20 checks passed
SamMorrowDrums deleted the sammorrowdrums-fix-http-cors-support branch August 24, 2026 13:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL