GitLab Agent
| You want | Do this |
|---|---|
Let mbm2 answer /mbm notes on a GitLab project |
Sign in with mbm2 console login https://tui.mbm.mn, then in a clone run mbm2 gitlab install and follow its steps (Set Up) |
| Ask about an issue or a merge request | Comment /mbm <your request> (or /oc β¦) on it (Usage Examples) |
| Use a self-hosted GitLab | Give its URL when install asks; a GitLab under a path such as https://git.example.com/gitlab works too |
| Stop the agent | Delete the webhook, revoke the two tokens (Remove It) |
What It Does
GitLab cannot start a pipeline from a comment, so tui.mbm.mn does it for you. Your project's webhook
sends each new note to tui.mbm.mn. When the note starts with /mbm or /oc and its author is a
Developer or higher, tui.mbm.mn starts the project's pipeline with the note's details. The mbm job then
installs mbm2 and runs mbm2 gitlab run. That reads the note, adds a π award, runs your request on the
mBm engine in the checked-out project and answers as a note. When the agent changed files it commits them
(with you as co-author) and pushes them. For a merge request they go to its source branch. For an issue
they go to a new branch, with a merge request that closes the issue.
note "/mbm fix the crash" GitLab webhook tui.mbm.mn GitLab CI
βββββββββββββββββββββββββΆ (Comments, secret) βββββΆ /api/gitlab/webhook/<id> ββΆ pipeline trigger
checks secret, project, β
/mbm, Developer role βΌ
mbm job: mbm2 gitlab run
mBm engine, your request
note, branch, merge request
Anyone below Developer is ignored: tui.mbm.mn starts no pipeline for them. If a pipeline is started some
other way, the job checks the role again and answers User <name> does not have Developer access.
Set Up
- Sign in to tui.mbm.mn:
mbm2 console login https://tui.mbm.mn. The project is registered under this account. - In a clone of the project run
mbm2 gitlab install. It suggests the GitLab URL from youroriginremote; press Enter or type another one. - Pick the provider and the model. The job has no mbm2 sign-in, so with mBm it uses the free models; for another provider you add its key as a variable.
- Create a project access token when
installasks (Settings β Access tokens): role Developer or higher, scopes api and write_repository. Paste it. - Create a pipeline trigger token (Settings β CI/CD β Pipeline trigger tokens) and paste it.
installregisters the project with tui.mbm.mn, writes.gitlab/mbm.ymland prints the rest.
$ mbm2 gitlab install
β Install GitLab agent
β
β GitLab URL (https://gitlab.com)
β
β Select provider
β 1. mBm (recommended)
β¦
β Create a project access token at https://gitlab.com/acme/app/-/settings/access_tokens
β role Developer (or higher), scopes api and write_repository
β
β Project access token
β
β Pipeline trigger token
β
β Registered acme/app with https://tui.mbm.mn
β
β Added CI file: ".gitlab/mbm.yml"
β
β Next steps:
1. Commit `.gitlab/mbm.yml` and `.gitlab-ci.yml` and push
2. Add these CI/CD variables in https://gitlab.com/acme/app/-/settings/ci_cd (Variables, masked)
- MBM_GITLAB_TOKEN the project access token
- MBM2_PASSWORD
3. Add a webhook in https://gitlab.com/acme/app/-/hooks
URL https://tui.mbm.mn/api/gitlab/webhook/glp_β¦
Secret token glw_β¦
Trigger Comments
The secret is shown only once; run install again for a new one.
4. Go to a GitLab issue and comment `/mbm summarize` to see the agent in action
Then do the steps it prints:
| Step | Where | What |
|---|---|---|
| Commit | your clone | .gitlab/mbm.yml, and .gitlab-ci.yml when install created it. If the project already had a .gitlab-ci.yml, add include: - local: .gitlab/mbm.yml to it yourself |
| Variables | Settings β CI/CD β Variables | MBM_GITLAB_TOKEN (the project access token), MBM2_PASSWORD (your mbm2 install password) and the provider's keys; mark them masked |
| Webhook | Settings β Webhooks | The URL and secret token install printed; trigger Comments only |
The job install writes, with the model you picked:
mbm:
image: debian:bookworm-slim
rules:
- if: $CI_PIPELINE_SOURCE == "trigger" && $MBM_NOTE_ID
variables:
GIT_DEPTH: "20"
MODEL: mbm/m-free-1
script:
- apt-get update -qq && apt-get install -y -qq ca-certificates curl git >/dev/null
- curl -fsSL https://tui.mbm.mn/install | bash -s -- --no-modify-path
- ~/.mbm2/bin/mbm2 gitlab run
A triggered pipeline also runs your other jobs whose rules allow it. To keep them out, add
- if: $MBM_NOTE_ID with when: never to their rules.
Usage Examples
| Note | What the agent does |
|---|---|
/mbm on an issue |
Summarizes the thread |
/oc summarize |
The same, with your words as the request |
/mbm fix this on an issue |
Works on a new branch mbm/issue<n>-β¦; when it changed files, opens a merge request Closes #<n> and notes Created MR !<m> |
/mbm add a test for this on a merge request |
Checks out the merge request's source branch, pushes its commit there and answers. For a fork's merge request it opens a new merge request instead |
Every answer ends with a link to the job; for a public project (or with SHARE: "true") also a link to
the shared mbm session. In the job the agent reads and edits files only: it runs no shell commands and
fetches no web pages, so text in an issue cannot make it use the job's tokens.
Settings
Set these as the job's variables: or as CI/CD variables.
| Variable | Meaning |
|---|---|
MODEL |
provider/model; required |
MBM_GITLAB_TOKEN |
The project access token; required |
PROMPT |
Use this request instead of the note |
SHARE |
true shares the session, false never does; unset shares it for public projects |
The trigger passes MBM_NOTE_ID, MBM_TARGET_TYPE (Issue or MergeRequest), MBM_TARGET_IID and
MBM_PROJECT_ID; the job refuses a project id that is not its own.
How Your Tokens Are Kept
| Token | Where it lives |
|---|---|
| Project access token | A masked CI/CD variable for the job, and at tui.mbm.mn encrypted (AES-256-GCM); tui.mbm.mn uses it only to check a note author's role |
| Pipeline trigger token | Only at tui.mbm.mn, encrypted, to start the pipeline |
| Webhook secret | Shown once by install; tui.mbm.mn keeps only its hash and compares it in constant time |
tui.mbm.mn never logs a token, talks to your GitLab over https only, and accepts at most 60 webhook deliveries per project in 10 minutes.
Remove It
- Delete the webhook in Settings β Webhooks; nothing reaches tui.mbm.mn after that.
- Revoke the project access token and the trigger token in GitLab; the stored copies stop working.
- Delete
.gitlab/mbm.ymland itsinclude.
When It Fails
| You see | Why |
|---|---|
Not logged in to https://tui.mbm.mn⦠from install |
Run mbm2 console login https://tui.mbm.mn first |
Could not find a <url> project in the origin remote⦠|
The origin remote is not on the GitLab URL you gave |
GitLab did not accept the token for this project |
The token is wrong, expired, or for another project |
The token's role must be Developer or higher |
Create the token with the Developer role or higher |
This project is registered by another account |
Someone else installed it; ask them to remove it, or sign in with that account |
GitLab agent is not configured |
The backend is not set up yet |
The webhook's Recent events show {"status":"ignored"} |
The note does not start with /mbm or /oc, or it is the agent's own note |
The webhook's Recent events show {"status":"refused"} |
The note's author is below Developer |
401 Invalid token in Recent events |
The webhook's secret token is not the one install printed; run install again for a new one |
Environment variable "MBM_GITLAB_TOKEN" is not set in the job |
Add the masked variable |
mbm2 gitlab runs on Linux and macOS with the mBm engine.
Published from revision f88fc66f 2026-11-30