Stop gating MCP tool governance on local tool governance
What does this MR do and why?
MCP tool governance now depends only on duo_mcp_server_governance_rule_enforcement. It no longer also needs duo_workflow_local_tool_governance.
The MCP server needs nothing technical from the local flag. We tied the two together in review, so that turning off local governance for a group also turned it off for MCP calls (!258209 (comment 3977660758)). That tie means MCP governance can't reach customers until #613544 and its open blockers are done. We agreed to drop it in https://gitlab.com/groups/gitlab-org/-/work_items/21113#note_4103360101.
After this MR, duo_mcp_server_governance_rule_enforcement is the only kill switch for MCP governance. We plan to remove it in 19.7 after a bake period.
The change is in Ai::ToolRules::McpGovernance.enabled_anywhere? and .governs?.
Docs changes in tool-governance.md, as asked in https://gitlab.com/groups/gitlab-org/-/work_items/21113#note_4103360101:
- The history note now names one flag.
- A new note under Access types says that local access modes apply only to calls to the GitLab MCP server. They don't apply to the built-in tools of the IDE extensions or the Duo CLI. The note doesn't name
duo_workflow_local_tool_governance, because that flag iswip(!266221 (comment 4138738081)). - The note that said these rules don't govern Claude Code or Cursor is gone. It now says the server enforces Always Deny for them, and the client handles Always Ask.
How to reproduce the issue
-
On
master, enable only the MCP flag for a group:group = Group.find_by_full_path('<group>') Feature.enable(:duo_mcp_server_governance_rule_enforcement, group) Feature.disable(:duo_workflow_local_tool_governance) -
In AI > Governance > Tool management for that group, set Local access for
get_projectto Deny. -
Call
get_projecton a project in the group throughPOST /api/v4/mcp, for example from Claude Code. -
The call succeeds. The Deny is ignored because the local flag is off.
How to test the fix
- Repeat the steps above on this branch.
- The call is refused with JSON-RPC error
-32002and HTTP 403. - Disable
duo_mcp_server_governance_rule_enforcementfor the group. The call succeeds again.
bin/rspec ee/spec/lib/ai/tool_rules/mcp_governance_spec.rbReferences
- Rollout issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/632906
- Decision: https://gitlab.com/groups/gitlab-org/-/work_items/21113#note_4103360101
- Original review thread: !258209 (comment 3977660758)
- Local tool governance flag: #613544
Screenshots or screen recordings
Not applicable. There is no UI change.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.