GitLab 19.6 puts real limits on MCP tools
GitLab can now audit MCP calls and block tools on the server, even when the client does not enforce permissions.
The problem is not just the prompt
Connecting Claude Code or Cursor to GitLab through MCP is useful: the agent can inspect issues, review merge requests, and work with the actual context of a Laravel project. The problem starts when that connection also exposes write or delete actions and security depends entirely on the client asking for permission. If the client interprets a policy badly, runs an older version, or skips the confirmation flow, that control is only a recommendation.
GitLab 19.6 adds the missing piece for this setup: MCP tool governance can be enforced by GitLab itself. It is not a rule that the agent is expected to follow voluntarily, but a check that happens before the call is executed. For anyone running a self-managed instance, that distinction matters far more than another prompt instruction.
Audit events show what the agent did
Every action performed through GitLab’s MCP server now creates an audit event. The record identifies the actor, the action, the affected resource, and the time, while also marking the event as originating from the MCP server rather than from a direct human action. At the top-level group, these records are available under AI > Governance in the audit events tab.
This does not magically make an agent safe, but it removes a common blind spot. If Claude Code opens an issue, posts a note, or tries to act on a merge request, there is a trace without installing separate telemetry on every developer machine. In small teams and homelabs where one person often manages GitLab, runners, and services, having that central record makes unexpected actions much easier to investigate.
Three modes for each tool
From AI > Governance, GitLab lets you assign one of three modes to each tool: Always Allow, Always Ask, or Always Deny. Rules can be set on a top-level group and refined at project level where needed. A project rule takes precedence over the group rule, but it can only be equally restrictive or stricter.
Always Allow runs the tool without a confirmation step. Always Ask marks the action as requiring approval, while Always Deny hides the tool from the agent and blocks its execution. Tools are classified as read, write, or delete actions, and the default matrix allows reads while requiring approval for write and delete operations.
The important part for Claude Code, Cursor, and other external MCP clients is that GitLab enforces Always Deny on the server. Even if a client calls a denied tool directly, GitLab refuses the request before the tool runs. The client receives a tool execution error, so protection does not depend on the client hiding an option or following an instruction.
A minimal Claude Code setup
A direct Claude Code connection to a self-managed GitLab instance uses HTTP transport and the instance MCP endpoint. This command adds the server for the current user and also limits the toolsets returned to the client. Restricting toolsets does not replace governance rules, but it reduces the surface area exposed to the agent from the start.
claude mcp add -s user --transport http GitLab https://gitlab.example.com/api/v4/mcp \
--header "X-Gitlab-Enabled-Mcp-Server-Toolsets: core,work_items"After connecting it, I would set the actual rules in GitLab’s interface, not in Claude Code’s local configuration. For a group containing several Laravel repositories, my baseline would be to allow necessary read actions, request confirmation for writes, and deny tools that delete resources or create changes outside the normal workflow. Projects holding infrastructure, secrets, or homelab automation deserve stricter rules than a disposable test application.
The fine print behind Always Ask
There is an important caveat: Always Ask is not enforced by the server for third-party MCP clients. GitLab annotates the tool so that the client can ask for confirmation, but the client decides whether that confirmation is shown and respected. According to GitLab’s documentation, Claude Code 2.1.199 and later prompts for confirmation, while Cursor, Windsurf, and other clients can run the tool without prompting.
That means I would not treat Always Ask as a security boundary for an external client. It is useful as operational friction when you control the client and want to inspect a change before accepting it. If a tool must not run from Claude Code, Cursor, or any other MCP client, Always Deny is the appropriate setting.
It is not an absolute block
Always Deny is evaluated against the group or project named in the tool arguments. A tool that does not act on a project or group, such as get_mcp_server_version, cannot be governed in that way and always runs. GitLab also makes clear that these rules are an additional layer, not a replacement for normal GitLab permissions.
There is another practical detail: if a client does not send the X-Gitlab-Namespace-Id header, the tool list may be built from the default GitLab Duo namespace, or remain unfiltered if no default exists. That does not remove enforcement when a denied call is executed, but it can make the client display tools that will fail later. It is worth configuring the group context properly and testing the integration with the real accounts and projects each developer will use.
There is also a known issue around search tools. Denying the aggregated search tool does not necessarily remove every search capability, because GitLab can expose narrower tools again. If the goal is to block issue, blob, or merge request searches, review the rules for those specific tools too and verify the result in an actual MCP session.
The right boundary is on the server
GitLab 19.6 does not remove the need for caution around MCP. You still need to limit permissions, treat repository and issue content as a possible prompt-injection source, and separate sensitive projects from experimentation. What changes is that a deny decision can now live on the server protecting the data instead of in every local agent configuration.
That is the sensible use case for me: connect agents to GitLab to speed up repetitive work, while deciding from the instance what they can read, what requires approval, and what they cannot execute. Audit events provide context when something goes wrong; Always Deny provides a technical boundary when trusting the client is not enough.
Source: GitLab 19.6 release notes
Official documentation: Agent tool governance · GitLab MCP server