> ## Documentation Index
> Fetch the complete documentation index at: https://onecli.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab Integration: Repositories, Issues & Merge Requests

> Agents can work with GitLab projects, issues, merge requests, and branches. Connect with your own GitLab OAuth application.

## Overview

OneCLI connects AI agents to [GitLab](https://gitlab.com) through OAuth. Agents can read projects, open and update issues and merge requests, comment, and manage branches. The gateway injects the token into every request, so your agent never sees it.

GitLab uses **your own GitLab OAuth application**, on OneCLI Cloud and self-hosted alike. Setup takes about five minutes, once.

<a id="self-hosted" style={{ scrollMarginTop: "8rem" }} />

## Connect GitLab

<Steps>
  <Step title="Create a GitLab OAuth application">
    In GitLab, open **User settings** > **Applications** and click **Add new application**. Name it `OneCLI`, and select the scopes `api`, `read_user`, `read_repository`, `write_repository`, and `read_registry`.
  </Step>

  <Step title="Add the redirect URI">
    In OneCLI, open **Connections** > **GitLab** > **Custom credentials** and copy the **Redirect URI**. Paste it into the GitLab application's **Redirect URI** and save the application.
  </Step>

  <Step title="Add your credentials and connect">
    Copy the GitLab **Application ID** and **Secret** into **Custom credentials**, click **Save credentials**, then click **Connect GitLab** and **Authorize** in GitLab.

    <Frame caption="The GitLab connect window in OneCLI before credentials are added.">
      <img src="https://mintcdn.com/chartdbinc/L4k9tYUENUtEpMY8/images/integrations/gitlab/onecli-connect-gitlab.png?fit=max&auto=format&n=L4k9tYUENUtEpMY8&q=85&s=9f2c53870ad16779b23c12a845c60979" alt="OneCLI connect window for GitLab showing Configuration required, the setup guide link, and the Configure credentials button." width="1056" height="1084" data-path="images/integrations/gitlab/onecli-connect-gitlab.png" />
    </Frame>
  </Step>
</Steps>

## What agents can do

| Area | What agents can do |
| - | - |
| **Projects** | List and read projects, list branches |
| **Issues** | List and read issues. Create, update, and comment on issues |
| **Merge requests** | List and read merge requests. Create, update, comment on, and merge them |
| **Branches** | Create and delete branches |

## Controlling access

[Grant](/docs/guides/agent-access) the connection to each agent that needs it, and choose per tool what runs freely, what needs approval, and what's blocked. Put **Merge merge request** and **Delete branch** behind approval. Organization [rules](/docs/guides/rules) add guardrails on top. A blocked request never reaches GitLab.

To disconnect, remove the connection in **Connections** > **GitLab**, then revoke OneCLI in GitLab under **User settings** > **Applications**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.