GitLab MCP server security: what it can access
GitLab’s hosted MCP server can read code and change merge requests, pipelines and issues. See its OAuth scope, toolsets and how to limit it.
The GitLab MCP server is built into GitLab and hosted at https://<your-gitlab-host>/api/v4/mcp. GitLab’s docs list it as generally available as of GitLab 19.5, after a beta from 18.6. It signs in with an OAuth token that carries the mcp scope, or with a fine-grained personal access token. Its default toolsets include write tools, such as accept_merge_request, so limit the toolsets and ask before writes.
Who runs it and how it signs in
GitLab maintains it, and there is nothing to install for the HTTP transport. An administrator has to allow access first. On GitLab.com that setting is on the top-level group. On Self-Managed and Dedicated it is on the instance.
Clients authenticate in one of two ways. The first is an OAuth access token with the mcp scope, through dynamic client registration or a pre-registered OAuth application. The second is a fine-grained personal access token with the MCP tool resource and Execute permission. GitLab’s docs say legacy personal, project and group access tokens are rejected with a 403 Forbidden, even with scopes like api.
Listing a tool grants nothing by itself. Each call checks the user’s project and namespace permissions.
What the tools can do
Tools are grouped into toolsets. These are the ones the docs name.
| Toolset | Default | Reads | Writes |
|---|---|---|---|
core | On | get_project, list_projects, search | save_project, save_note |
merge_requests | On | get_merge_request, list_merge_requests | save_merge_request, save_merge_request_review, accept_merge_request, apply_suggestion |
work_items | On | get_work_item, list_work_items | save_work_item, link_work_items |
repository | On | get_repository_file, list_commits, list_branches | add_branch, add_commit, fork_repository |
ci | On | get_pipeline, get_job, get_artifact_file | pipeline write tools on GitLab’s tools page |
duo_agent_platform | On if available | list_duo_sessions | start_duo_session, send_duo_session_input |
code_security | Off | list_vulnerabilities, get_vulnerability | save_vulnerability, attach_scan_profile |
wikis, orbit | Off | wiki pages | none listed |
The write tools in repository and merge_requests matter most. add_commit writes to a branch, and accept_merge_request merges.
Limit it at the server
Send the X-Gitlab-Enabled-Mcp-Server-Toolsets header to choose toolsets. A read-only research setup might enable only core and repository, but check which write tools those toolsets still contain, because core includes save_project and save_note. GitLab’s docs don’t describe a read-only switch, so use permissions as the real limit. Sign in as an account that has only the project access the task needs.
Risks that remain
- Issue text, merge request comments, commit messages and file contents are written by others. GitLab’s docs say you are responsible for guarding against prompt injection and should use the tools only on GitLab objects you trust.
- A shared pre-registered
clientIdis not tied to one client. Pre-registered applications created through the REST API don’t enforce PKCE, so check that your client sends it. - Tool results go to your model provider.
Limit it in Claude Code and Codex
Add the server, then deny or ask on the write tools. Claude Code checks deny rules before ask rules, and ask rules before allow rules.
claude mcp add --transport http gitlab https://gitlab.com/api/v4/mcp{
"permissions": {
"deny": ["mcp__gitlab__accept_merge_request", "mcp__gitlab__add_commit"],
"ask": ["mcp__gitlab__save_merge_request", "mcp__gitlab__save_work_item"]
}
}Put the rules in .claude/settings.json for one project or ~/.claude/settings.json for all projects. The default local scope for the server itself is ~/.claude.json.
In Codex, use ~/.codex/config.toml:
[mcp_servers.gitlab]
url = "https://gitlab.com/api/v4/mcp"
disabled_tools = ["accept_merge_request", "add_commit"]The Codex docs say disabled_tools applies after enabled_tools, and that auth defaults to oauth.
Checklist
- Confirm an admin has enabled MCP access for your group or instance.
- Choose toolsets with the header and keep
code_securityoff unless needed. - Use an account that cannot merge to protected branches, and protect them anyway. See what to do after a force push.
- Deny merge and commit tools unless the task needs them.
- Read the merge requests and branches the agent touched afterward.
Checked against the vendor documentation on November 25, 2026. GitLab MCP server · GitLab MCP tools · Claude Code permissions · Claude Code MCP · Codex MCP
Where Excellent fits
Excellent’s free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. It does not inspect MCP servers themselves. For a local report without installing an app, run the free scan. See a sample report.
With Pro, it blocks or asks before the risky actions it checks for, such as a push to main. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Agent coverage · pricing. Pro is US-only for now.

