Repository navigation
Fixes #35539: serve MCP under a non-root BASE_PATH (backport 2.0 #35771) - #36224
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
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. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Backport of #35771 to
2.0. Fixes #35539.BASE_PATH: routes matched the raw request URI, the login form posted to/mcp/loginat 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-configurationis served with the OpenID discovery fields.BasicAuthLoginServletTestis not on 2.0, so its one added assertion is left out.

Confidence 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.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"]Reviews (2) · Last reviewed commit: "greptile feedback" · Reviewed by Greptile