-
Notifications
You must be signed in to change notification settings - Fork 506
[OAuth] Request all supported scopes when not using the OAuth debugger #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[OAuth] Request all supported scopes when not using the OAuth debugger #455
Conversation
When using the OAuth debugger, it correctly adds the scope search parameter with the ones provided in the `scopes_supported` key. However, the main "connect" button does not pass them to the MCP SDK and they are missing from the call. Some OAuth providers and setups will require you to have them and the OAuth flow fails in these cases. This change fixes that.
opened modelcontextprotocol/typescript-sdk#564 because it seems all clients that I tested need this. |
This would indeed be simpler. However, I was under the impression Related issue in Spring Boot, where this used to be the default and was changed to i.e.
maybe this is a better default, even in the inspector? |
unfortunately, there's no way for the Client to know the correct scope to request without using the oauth server or registered client metadata. MS Entra requires the scope to be passed and the minimal scopes suggested won't be sufficient until we have some way of triggering consent for additional scopes when privileges need to be escalated. |
In the Spring Boot example, it was a convincing argument that defaulting to all scopes is maybe not as good as defaulting to none. I have to agree with @leblancfg that in the Inspector, it would be less problematic than in the SDK. |
@cliffhall I see the "waiting on submitter" tag, anything in particular you'd like me to clarify? |
Really waiting to hear @pcarleton's take. When closing the counterpart PR in the SDK, he said he'd follow up here. I think it's probably ok to request all scopes in the Inspector, but maybe the another solution is a configuration panel field that lets you put in the scopes you want to request, and if nothing is there, we request none. |
@cliffhall a configurable UI panel may be ok for inspector but I can't see it being suitable for other MCP clients. The configuration would be too technical for most users. Even for inspector, users wouldn't understand some scope unless they were also the MCP server dev. |
@dr3s You're right, for other MCP clients a scopes field would not be appropriate at all. But this tool is primarily used by MCP server devs to test their own servers. If you wanted to ensure that your server only authorized and allowed interaction with the requested scopes, this would probably be the easiest way to do it. |
Hey sorry for the delay! Here's the issue we run into, imagine an example like this:
The best we can do with the current spec is to rely on the
This change jumps straight to (3), but also (1) isn't supported in the SDK yet. I think we could either: I'm slightly in favor of (a) since it should reduce confusion and increase compatibility. The biggest downside would be having it be in the inspector and having that be "contagious" where others start using the pattern and it becomes the norm to request all scopes. |
Thanks for weighing in, @pcarleton. I agree the that getting all scopes now but moving quickly to amend when we have a better option sounds like the right thing. |
@leblancfg this needs a |
Adds a "scope" section to the Authorization URL in the OAuth flow, matching the OAuth debugger behaviour.
Motivation and Context
When using the OAuth debugger, it adds the scope search parameter with the ones provided in the
scopes_supported
key.However, the main "connect" button does not pass them to the MCP SDK and they are missing from the call. Some OAuth providers and setups will require you to have them and the OAuth flow fails in these cases. This change fixes that.
Closes #454
How Has This Been Tested?
Local tests for a streamable HTTP MCP server were successful when using the OAuth debugger. The URL generated in the debugger is (scroll to see the end):
but the "Connect" button currently returns:
This PR makes it so scopes are passed if the
scopes_supported
key is present in the authorization server metadata.Breaking Changes
MCP servers that rely on implicitly using default scopes will now have them explicitly set, and those scopes might differ.
Types of changes
Checklist