Skip to content

Conversation

roman-van-der-krogt
Copy link
Contributor

  • 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

- 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
Copy link

coderabbitai bot commented Oct 17, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/oauth-secured-example

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.



## 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).
Copy link
Contributor

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..."

Suggested change
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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator

@saqadri saqadri left a 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

Comment on lines +57 to +61
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]
Copy link
Collaborator

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
Copy link
Collaborator

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>"
Copy link
Collaborator

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?

Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants