Repository navigation
improvement(api): declare OAuth scopes in OpenAPI, JSON 404s for unknown API paths, and root MCP resource metadata - #9026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThis PR declares OAuth flows and per-operation scopes in OpenAPI, adds JSON 404s for unknown API paths, and serves root resource metadata on the dedicated MCP host.
|
…own API paths, and root MCP resource metadata
…out of the dev-server e2e
waleedlatif1
force-pushed
the
improvement/agent-readiness
branch
from
October 14, 2026 17:45
dd7a524 to
deeddaa
Compare
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was successfully deployed
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
oauthBeareris now a standardoauth2authorization-code scheme (authorize/token/refresh URLs,api:read/api:write/offline_accessscopes) instead ofhttpbearer with scopes only in prosesecuritynames its least-privilege scope (oauthBearer: ["api:read"]), derived from the application operation'soauthScope— the same single source asx-oauth-scopeoauth2(not theoauthBearername) and fails if an operation's scope isn't declared by the scheme's flowoauth2scheme asAuthorization: Bearer; the playground keeps its manual token field/.well-known/oauth-protected-resourcetoo — the fallback MCP clients try after the path-inserted URL (MCP authorization spec, Protected Resource Metadata Discovery).resourcestays the MCP URL; the app host still has no root documentapp/api/[[...segments]]returns a JSON 404 for unknown/api/*paths instead of the HTML not-found page, mirroring the existing/api/v2fallbackCompatibility
Authorization: Bearer,x-oauth-scopeand the document-levelsecurityare kept, the anonymous alternative on workflow execute is keptresource), which is what/api/v2accepts/api/*paths stay 404, now as JSON; every existing route, the/api/v2and/api/authcatch-alls, andnext.config/apiheader rules are unaffected (Next only routes here when nothing more specific matches)resourceis the MCP URL, same document as the path-inserted oneType of Change
Testing
scripts/openapitests (generator + documents),host-routing.test.ts; confirmed the per-operation scope assertion fails with the derivation removed, and generation fails with a scope dropped from the schemegenerate:openapi --check,check:api-validation:strict,check-api-contract-routes, docstsc, linttest-mcp-host-e2e.ts(CIcligroup): no root metadata on the app host, JSON 404 for unknown/apiGET/POST. The MCP-host metadata mapping is covered byhost-routing.test.ts, not E2E: that group runsnext dev, where proxy rewrites on the dedicated host 404 for every rewritten path (the existing/mcp→/api/mcpincluded; reproduced locally). Production serves the existing path-inserted URL through the same rewrite targetcheck-openapi-specs,generate:cli-api --check(CLI client unchanged),check-unused-exportscheck:audits, and test suites left to CIChecklist
test-auditauthoring gate)