Decide whether the MCP origin serves a copy of MAS's RFC 8414 document, a redirect, or nothing #148
Labels
No labels
blocked
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
waiting-on-julian
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jlxq0/matrix-mcp#148
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#94adds two unauthenticated routes that serve an RFC 8414 authorization-server metadata document from this server's own origin, hand-built fromcfg.authorization_server. It is mechanically green. The decision it waits on is whether this origin should serve that document at all, and that decision is this issue rather than a line in a PR comment.What is measured
MAS's own document, fetched from
https://matrixauthservice.kampong.social/.well-known/oauth-authorization-server, against what#94emits with the deployment's live env:And what the origin does today, with
#94not deployed:Three findings, in the order they bite
issuernames this server rather than MAS. RFC 8414 §2 defines it as the authorization server's identifier. A client that records it and then checks the RFC 9207isson the authorization response comparesmatrixauthservice.kampong.social/againstmatrix-mcp.kampong.socialand must reject the code, after the user has authenticated at MAS. The trailing slash is part of the value:MATRIX_MCP_AUTHORIZATION_SERVERis set with one, andauthorization_server_keeps_its_trailing_slashalready exists to preserve it, so the correct value iscfg.authorization_serververbatim rather than theauthorization_server_base()form the endpoints use.Naming MAS instead does not make it compliant. RFC 8414 §3.3 has the client check that the issuer matches the one it derived the retrieval URL from, and that URL is this origin. So both candidate values fail a strict client, one at retrieval and one after authentication. The route is a compatibility shim for MCP clients predating the 2025-06-18 move to RFC 9728, and it cannot be made compliant, only less wrong. The current code comment says the opposite of RFC 8414 §2 and would teach the next reader the inverted rule.
A hand-built copy of another service's document has no mechanism keeping it in step, and this one already disagrees on two fields. Both disagreements are narrowings and safe in themselves, which is what makes them the wrong thing to focus on. The three endpoint paths match exactly today; that is a measurement of one afternoon rather than a property, and
registration_endpointis where a future mismatch costs most, because asserting it means a client doing dynamic registration POSTs there and connection setup fails outright.The options
issuerset tocfg.authorization_serververbatim and a test that fetches MAS's document and compares the fields, so drift is a red build rather than a client's problem.#94. The compliant path already answers, and the 401 already carries the pointer to it.Whichever is chosen, the
/mcpvariant needs dropping or justifying: its retrieval URL implies issuer…/mcp, which the document does not return under either candidate value.Where this came from
Cross-engine review found the
issuerfault and the §3.3 consequence, asked as can this new code do the wrong thing in the case it was written for rather than as a general review. The drift measurement and the comparison against the live MAS document are mine. Codex also calledregistration_endpointunsafe if MAS lacks RFC 7591, which does not hold here: MAS advertises it at exactly the constructed path.