Table of contents

When developers hand a task to Codex, they write a description of what needs to be built. But that description is a summary of the issue, not the issue itself.
The ticket has acceptance criteria, linked issues, label context, milestone constraints, and discussion threads that shaped the spec. None of that makes it into the task description.
Codex writes against what it's given. If all it has is a developer's paraphrase, the implementation reflects the paraphrase, not the actual requirements. Connecting GitLab gives Codex direct access to the source so it can read the issue before it starts writing.
To give Codex direct access to GitLab as it works through your coding tasks, we'll show you how to connect GitLab with Merge Agent Handler's GitLab MCP server.
Merge Agent Handler connects Codex to the GitLab API through the Merge CLI. You install the CLI, authenticate once, and run a single setup command from your project root.
That command writes a Merge CLI section to your project's AGENTS.md file, which tells Codex when to call merge search-tools and merge execute-tool to reach GitLab.
Once authenticated, Merge handles credential storage and token refresh on your behalf, so you never embed a personal access token in your repo or manage rotation yourself.
Related: How to use the GitLab MCP in Claude Code
Before getting started, you'll need the following:
pipx --version to confirm, or install via pip install pipx)If you want to connect Merge Agent Handler's GitLab MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
Install the CLI with pipx: pipx install merge-api
Verify your installation: merge --version
Authenticate the CLI with your Merge Agent Handler account: merge login
This links the CLI to your Merge account and stores your session credentials locally.
Run the following from the root of the project where you want Codex to have access to GitLab:
This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task requires GitLab data. The command is idempotent — safe to re-run if you need to reset the configuration.
Commit the updated AGENTS.md so the configuration travels with the repo.
Related: A guide to integrating the GitLab MCP with Cursor
Create a Codex task that requires live GitLab data.
This can be something like: "Read issue #312 in the payments-service project, including its acceptance criteria and linked issues, then scaffold the feature implementation with the correct file structure and function signatures."
The first time Codex invokes a GitLab tool, a Magic Link will appear to complete connector authentication.

Once authenticated, Codex has access to your GitLab projects through Merge for all subsequent tasks in this project.
{{this-blog-only-cta}}
In case you have more questions on setting up and using the GitLab MCP with Codex, we've addressed several more commonly-asked questions below.
With GitLab connected, Codex can:
.gitlab-ci.yml content from GitLab so any pipeline additions Codex generates follow the existing stage structure, variable conventions, and job templates already in useYou can run a self-hosted GitLab MCP server and wire it to Codex directly. That means generating a personal access token, standing up an MCP process, and keeping both the token and the server available for every Codex task that needs them.
Where it breaks down is at the team level. A shared token has no per-user attribution, so you can't tell which Codex task read which issue, or which developer's agent made a change. Rotating that token means updating every developer's configuration at once.
Merge Agent Handler adds a managed layer: per-user authentication so each developer connects with their own GitLab identity, Merge-handled token storage and refresh so credentials never live in the repo, and full audit logging on every tool call.
For teams running Codex on production codebases, knowing exactly which issues were read during a generation task is meaningfully different from having no record of it.
GitLab is where the actual requirements live. Acceptance criteria, architectural notes, discussion threads, linked blockers—all of it is in the issue, not in the task description a developer writes when creating a Codex job.
Codex works best when it has the source, not a summary of it. Without GitLab access, it writes against whatever context the developer provided. With it, Codex can pull the issue directly and use what the ticket actually says.
That matters most for tasks where the details are load-bearing: issues with specific constraints that aren't obvious from the title, MRs with linked issues that explain why a change was made, CI jobs that reference variables defined elsewhere in the project. Connecting GitLab closes the gap between the spec and the implementation.
Yes, Merge for Workforce is built to help engineering organizations provision, secure, and govern how employees connect AI tools like Codex to project management systems like GitLab.
Common patterns include:
Taken together, employees can use the GitLab MCP to read issue requirements before generating code, pull MR context for release notes, and query CI configs while building pipeline tooling, while IT keeps centralized control over which projects and namespaces each developer's agent can reach.
Use Merge Agent Handler’s 150+ connectors (including GitLab) to power reliable, secure, and powerful agents.