Skip to content

feat(auth): support manual PRM override#2717

Open
duwenxin99 wants to merge 6 commits intometadatafrom
prm-flag
Open

feat(auth): support manual PRM override#2717
duwenxin99 wants to merge 6 commits intometadatafrom
prm-flag

Conversation

@duwenxin99
Copy link
Contributor

Description

Should include a concise description of the changes (bug or feature), it's
impact, along with a summary of the solution

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

@duwenxin99 duwenxin99 requested a review from a team as a code owner March 11, 2026 19:27
@duwenxin99 duwenxin99 changed the base branch from main to metadata March 11, 2026 19:27
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the authentication capabilities by introducing the option to provide a manual Protected Resource Metadata (PRM) file. This allows for greater flexibility and control over the PRM configuration, enabling users to define custom metadata instead of relying solely on the auto-generated version.

Highlights

  • Manual PRM File Support: Introduced a new command-line flag --mcp-prm-file to allow users to specify a path to a custom Protected Resource Metadata (PRM) JSON file, overriding the default auto-generation.
  • PRM Handler Logic Update: Modified the prmHandler to prioritize serving the content of the manually provided PRM file if the --mcp-prm-file flag is set, otherwise falling back to the existing auto-generation logic.
  • Configuration and Server Integration: Updated the server configuration and Server struct to store the path to the manual PRM file, ensuring it's accessible when handling PRM requests.
  • Comprehensive Testing: Added a new test case to verify the correct behavior of the PRM endpoint when a manual PRM file is provided, ensuring the system correctly reads and serves its content.
Changelog
  • cmd/root.go
    • Added a new --mcp-prm-file flag for specifying a manual PRM JSON file.
  • internal/server/config.go
    • Added McpPrmFile field to ServerConfig struct to hold the path to the manual PRM file.
  • internal/server/mcp.go
    • Imported the os package.
    • Updated the mcpRouter condition to enable the PRM endpoint if a manual PRM file is specified.
    • Modified prmHandler to read and serve the content of the manual PRM file if s.mcpPrmFile is set, otherwise proceeding with auto-generation.
  • internal/server/mcp_test.go
    • Added TestPRMEndpoint_ManualFile to test the PRM endpoint's behavior when a manual PRM file is provided.
  • internal/server/server.go
    • Added mcpPrmFile field to the Server struct.
    • Initialized the mcpPrmFile field in NewServer from the ServerConfig.
Activity
  • No human activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a useful feature to allow overriding the auto-generated Protected Resource Metadata (PRM) with a manually provided JSON file. The implementation is straightforward, adding a new command-line flag and handling the file serving logic in the prmHandler. The changes are well-tested with a new unit test covering the happy path.

I have one suggestion to improve the robustness of this feature by adding validation for the provided JSON file.

@github-actions
Copy link
Contributor

@duwenxin99 duwenxin99 assigned averikitsch and unassigned Yuan325 Mar 11, 2026
@github-actions
Copy link
Contributor

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.

3 participants