Feature/mcp v1.1#64
Conversation
Add get_config() to the Model interface and BaseModel implementation. Enables policy classes to read per-feature config sections for capability gating.
Replace ModelRestPolicy with McpPolicy for MCP-specific gating in AbilityRegistrar. Update MCP service with mcp_policy() lazy-loader.
Refactor ModelRestPolicy to resolve capabilities from per-feature config sections (config.meta.show_in_rest) instead of the old saltus_rest capabilities array. Health and models capabilities remain always-on when show_in_rest is not false. Drop per-model saltus_rest opt-in.
Update REST controller and MetaFieldProvider error messages to reference the new per-feature config section syntax (e.g. add show_in_rest under the duplicate section) instead of the old saltus_rest capabilities array.
Add 14 test cases for McpPolicy covering health bypass, model-type filtering, mcp_tools gating, show_in_mcp toggling. Update MCPFeatureTest and AbilityRegistrarTest to use config-section pattern.
Update DuplicateControllerTest, MetaControllerTest, ModelsControllerTest, ReorderControllerTest, RestServerTest, and SettingsControllerTest to use the new config-section pattern with show_in_rest in feature-level sections instead of the saltus_rest array.
Update MCP.md with config-section model, per-feature show_in_rest/show_in_mcp flags, and new model config examples. Sync CURRENT.md and ROADMAP.md.
Add McpPolicy line to Current Status. Bump test count from 236/655 to 250/669.
Add Working item for MCP/REST gating refactor. Add Recent Changes entry for McpPolicy config-section gating refactor.
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating in the Saltus framework, transitioning from the legacy saltus_rest array to a per-feature configuration model under the config key. It introduces the McpPolicy class to handle MCP-specific gating and the MCPConfig utility class to make the MCP namespace, ability category, and prefix filterable. Additionally, REST controllers, tools, documentation, and tests have been updated to support these changes. Feedback is provided to improve robustness in MCPConfig::get_ability_category by merging filtered arrays with defaults to avoid undefined key warnings, and to correct an invalid @param annotation in McpPolicy::get_model.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Replace match expressions (PHP 8.0+) with associative array lookups in resolve_show_in_mcp and resolve_show_in_rest. Restores PHP 7.4 compatibility and reduces cyclomatic complexity below the PHPCS threshold of 10.
Add inline @var assertions for non-falsy-string and array shape return types that PHPStan cannot infer through apply_filters().
Add local @var non-falsy-string assertions in register_routes() methods so PHPStan can verify register_rest_route namespace parameter type.
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating by introducing the McpPolicy class and migrating ModelRestPolicy to a per-feature config-section model. It also introduces the MCPConfig utility class to make the MCP namespace, ability category, and ability prefix filterable. Review feedback highlights potential PHP warnings in McpPolicy and ModelRestPolicy when accessing nested array keys under $config['features'] directly. Additionally, improvements are suggested to defensively handle empty strings from the namespace filter in MCPConfig and to safely trim slashes when constructing routes in RestTool.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating in the Saltus Framework, transitioning from the saltus_rest option array to a per-feature configuration model under the config key. It introduces the McpPolicy class for MCP-specific gating, the MCPConfig utility class to make the MCP namespace, category, and prefix filterable, and updates REST controllers and MCP tools to use these new configurations. Additionally, test coverage has been expanded with several new test cases. Feedback on the changes suggests removing the unnecessary use of esc_url_raw() when constructing internal REST routes in RestTool::mcp_route(), as it is conceptually incorrect and can be replaced with simple string concatenation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating by transitioning from the saltus_rest array to a per-feature configuration model, introducing the McpPolicy class, and adding a filterable MCPConfig utility to customize MCP namespaces, categories, and prefixes. Feedback on the changes suggests correcting the error hint messages in DuplicateController and ExportController to accurately reflect that the duplicate and single_export configurations are nested under the features key in the model config.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating by introducing the MCPConfig utility class for filterable configurations and the McpPolicy class for MCP-specific tool gating. It also transitions ModelRestPolicy from a hardcoded saltus_rest array to a per-feature config-section model, updating controllers, tools, and tests accordingly. One issue was identified in bin/generate-mcp-docs.php where the use of the mixed type hint in the apply_filters stub function breaks PHP 7.4 compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating in the Saltus Framework, transitioning from the legacy saltus_rest array to a per-feature configuration model under the config key. It introduces the McpPolicy class for handling MCP-specific gating and the MCPConfig utility class to make the MCP namespace, category, and prefix filterable. Additionally, REST controllers and MCP tools have been updated to use these new configurations, and comprehensive unit tests have been added. Feedback on the pull request highlights a logical gap in McpPolicy::is_enabled(), which should explicitly check if show_in_rest is set to false to avoid registering MCP tools for models with disabled REST routes, along with a recommendation to add a corresponding test case.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating by introducing the McpPolicy class and transitioning ModelRestPolicy to a per-feature configuration-section model. It also adds the MCPConfig utility class to make the MCP namespace, ability category, and prefix filterable via WordPress filters, updating all REST controllers, MCP tools, documentation, and tests accordingly. Feedback on these changes highlights that McpPolicy::is_enabled currently fails to respect the master show_in_rest option, which should disable all model-scoped capabilities when set to false. To address this, a check for show_in_rest should be added to McpPolicy::is_enabled, along with a corresponding test case in McpPolicyTest to verify the behavior.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating in the Saltus Framework, replacing the legacy saltus_rest array with a per-feature config-section model (show_in_rest and show_in_mcp). It introduces the McpPolicy class for MCP-specific gating and adds the MCPConfig utility class to make the MCP namespace, ability category, and prefix filterable. Additionally, REST controllers and MCP tools have been updated to support these configuration changes, alongside corresponding test coverage. Feedback is provided regarding some draft notes that appear to have been accidentally left at the end of the ROADMAP.md file.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating to use a per-feature config-section model with show_in_rest and show_in_mcp gates, replacing the legacy saltus_rest array. It introduces the McpPolicy class, adds get_config() to the Model interface, and implements the MCPConfig utility class to make MCP configurations filterable. Additionally, REST controllers and MCP tools are updated to use dynamic namespaces, and extensive test coverage is added. Feedback on the changes suggests correcting extra blank lines and misaligned docblock formatting in src/Modeler.php.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP and REST capability gating by introducing a per-feature configuration model with show_in_rest and show_in_mcp gates, supported by a new McpPolicy class. It also introduces the MCPConfig utility class to make MCP namespaces, categories, and prefixes filterable. The review feedback highlights a potential security issue where show_in_mcp is only validated during ability registration rather than at runtime, which could allow clients to bypass gating for specific models.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| private function is_enabled_tool( ToolInterface $tool ): bool { | ||
| if ( ! $this->policy ) { | ||
| if ( ! $this->mcp_policy ) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Gating Bypass Issue: show_in_mcp is only checked at registration time
The is_enabled_tool check is performed globally during ability registration. If at least one registered model has mcp_tools and show_in_mcp enabled for a given capability, the corresponding ability (e.g., saltus/update-meta-fields) is registered globally in WordPress.
However, at runtime (during ability execution or permission checks), there is no validation against McpPolicy to ensure that the specific model requested in $args (via post_type or the post type of post_id) actually has show_in_mcp enabled.
Impact
If a developer configures show_in_mcp => false for Model A, but enables it for Model B, a client can still successfully execute the ability for Model A because the global ability is registered, and the REST controller only checks ModelRestPolicy (which checks show_in_rest, not show_in_mcp).
Recommendation
Consider passing McpPolicy (or the Modeler) to AbilityDefinitionFactory and updating the permission_callback or execute_callback to dynamically validate the requested model against the MCP policy at runtime.
No description provided.