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 is wip (!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

  1. 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)
  2. In AI > Governance > Tool management for that group, set Local access for get_project to Deny.

  3. Call get_project on a project in the group through POST /api/v4/mcp, for example from Claude Code.

  4. The call succeeds. The Deny is ignored because the local flag is off.

How to test the fix

  1. Repeat the steps above on this branch.
  2. The call is refused with JSON-RPC error -32002 and HTTP 403.
  3. Disable duo_mcp_server_governance_rule_enforcement for the group. The call succeeds again.
bin/rspec ee/spec/lib/ai/tool_rules/mcp_governance_spec.rb

References

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.

Edited by Raounak Sharma

Merge request reports

Loading
Loading