Skip to content

Fixes #35539: serve MCP under a non-root BASE_PATH (backport 2.0 #35771) - #36224

Merged
Vishnuujain merged 2 commits into
2.0from
mcp-base-path-2.0
Oct 26, 2026
Merged

Vishnuujain merged 2 commits into
2.0from
mcp-base-path-2.0

Conversation

@Vishnuujain

@Vishnuujain Vishnuujain commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #35771 to 2.0. Fixes #35539.

  • MCP OAuth broke under a non-root BASE_PATH: routes matched the raw request URI, the login form posted to /mcp/login at the host root, and a trailing slash in the base URL doubled up. Routes now match the path inside the context, the form posts relative, the slash is trimmed, and /mcp/.well-known/openid-configuration is served with the OpenID discovery fields.
  • BasicAuthLoginServletTest is not on 2.0, so its one added assertion is left out.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; all four previous findings are addressed.

Summary

This backport makes MCP routes and OAuth discovery work under a non-root BASE_PATH.

  • MCP and OAuth routes match correctly under a non-root base path.
  • MCP login and callback URLs stay under the configured base path.
  • MCP serves OpenID discovery metadata at the issuer path.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Request under BASE_PATH"] --> B["Strip context path"]
  B --> C["Match MCP or OAuth route"]
  C --> D["Serve shared discovery metadata"]
  C --> E["Serve login form"]
  E --> F["Post to relative login URL"]
Loading

Reviews (2) · Last reviewed commit: "greptile feedback" · Reviewed by Greptile

@Vishnuujain Vishnuujain added the safe to test Add this label to run secure Github workflows on PRs label Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@Vishnuujain Vishnuujain self-assigned this Oct 26, 2026
@Vishnuujain
Vishnuujain enabled auto-merge (squash) October 26, 2026 09:24
@gitar-bot

gitar-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Changing MCP OAuth route matching and discovery under BASE_PATH could misroute metadata or login flows, preventing clients from authenticating.

Backports the MCP non-root BASE_PATH fix to 2.0: MCP and OAuth routes now match paths inside the application context, the login form posts relatively, the base URL slash is trimmed, and OpenID discovery is served under the MCP path. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants