-
Notifications
You must be signed in to change notification settings - Fork 772
Added example of an MCP App secured by OAuth. #557
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: feat/mcp_agent_oauth
Are you sure you want to change the base?
Added example of an MCP App secured by OAuth. #557
Conversation
- Example in `examples/oauth/protected_by_oauth`, including help script for client registration and README. - Some minor changes to make UX better (e.g. fetch introspection URL from `.well-known/oauth-authorization-server`) - Added test cases for token verifier
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
||
|
||
## Further reading | ||
More details on oauth authorization and the MCP protocal can be found at [https://modelcontextprotocol.io/specification/draft/basic/authorization](https://modelcontextprotocol.io/specification/draft/basic/authorization). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small typo in the README: "protocal" should be "protocol" in the sentence "More details on oauth authorization and the MCP protocol can be found at..."
More details on oauth authorization and the MCP protocal can be found at [https://modelcontextprotocol.io/specification/draft/basic/authorization](https://modelcontextprotocol.io/specification/draft/basic/authorization). | |
More details on oauth authorization and the MCP protocol can be found at [https://modelcontextprotocol.io/specification/draft/basic/authorization](https://modelcontextprotocol.io/specification/draft/basic/authorization). |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can set things up more clearly for users to be able to run this example? Right now it isn't clear all that needs to be updated in order for the example to run successfully.
Even if it includes a test oauth app (or our hosted cloud auth server), that would help a lot in getting the example runnable.
Another alternative is using env vars or mcp_agent.secrets.yaml.example to set the config properties instead of having to update the code samples
metadata_url = str(parsed_url.copy_with(path="/.well-known/oauth-authorization-server" \ | ||
+ parsed_url.path)) | ||
|
||
if metadata_url.endswith('/'): | ||
metadata_url = metadata_url[:-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a url parsing lib that would be better? Specifically thinking about the endswith
check
@@ -0,0 +1,79 @@ | |||
# OAuth protected resource example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include our auth server URL here as an example as well? Same in main.py
import json | ||
|
||
# Authorization server URL. | ||
auth_server_url = "<your oauth authorization server url>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set this to our oauth server URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run make schema
to regenerate the schema as well
examples/oauth/protected_by_oauth
, including help script for client registration and README..well-known/oauth-authorization-server
)