feat(mcp): add support for mcp oauth#2911
Conversation
Client ID Metadata Documents (CIMD)The MCP 2025-11-25 spec recommends Client ID Metadata Documents as the preferred client registration method over Dynamic Client Registration (DCR). We currently only use DCR. What is it?Instead of each client dynamically registering with every server (DCR), the client publishes a JSON metadata document at a stable HTTPS URL (e.g. {
"client_id": "https://crush.charm.land/.well-known/oauth-client.json",
"client_name": "Crush",
"redirect_uris": ["http://127.0.0.1/callback"],
"grant_types": ["authorization_code"],
"token_endpoint_auth_method": "none"
}The auth server fetches this URL to learn about the client — no registration endpoint needed. The client uses the URL itself as its Why it matters
What we'd need
Current stateDCR works for Linear and most servers today. The SDK handles the fallback order (CIMD → preregistered → DCR), so adding CIMD later is backwards-compatible. References |
ec990ba to
371e1c5
Compare
2e0be13 to
86046d2
Compare
86046d2 to
b2de39f
Compare
b2de39f to
c0699db
Compare
|
Hey, I only just noticed this PR today. I've been maintaining a personal branch implementing MCP OAuth2 in Crush for a while. One reason I didn't send a PR yet is that the go-sdk has some deficiencies around token handling. I have an API proposal that would allow using the go-sdk's AuthorizationCodeHandler to fully manage the lifecycle of the oauth2 session. I've also implemented the proposal in a branch here. From what I can tell, this branch wraps the go-sdk AuthorizationCodeHandler and implements a lot of the callback logic in crush? I think with the changes I proposed in the go-sdk that can be avoided and you can use AuthorizationCodeHandler directly. Maybe you want to take a look at that proposal? Other differences I can see from a brief revew of this code:
Anyway, if you are interested in taking any ideas (or not!) from my branch feel free. Also if you agree that the go-sdk proposal has merit or could be improved please add a comment on there. Thanks! |
|
oh that looks wonderful! thank you for your work! I had made this as an initial proof of concept but your implementation is far more polished and the change in the sdk I think is a good move |
4609bc2 to
ab412ab
Compare
|
i incorporated a bunch of things from your branch in! I still think it makes more sense to have a separate oauth dialog for mcps since its a different code flow than the copy code and poll style. I also normally manage my crush config with nix so its immutable but I haven't had any issues here. When we use the config write function it writes into the |
3629dce to
50f4c82
Compare
Co-Authored-By: Scott Leggett <scott@sl.id.au>
50f4c82 to
47187f5
Compare
adds support for the 2025-11-25 mcp oauth spec