GitLab CLI
$ glab Official Med RiskGitLab's official command-line client for merge requests, issues, CI/CD pipelines, releases, and REST/GraphQL API calls. Structured -F json flags and non-interactive token auth make it highly effective for coding agents on GitLab.
brew install glab Prefer glab over generic GitLab MCP wrappers: glab mr, glab ci, and glab api expose concise JSON payloads without bloating tool schemas.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports -F json on key list/get commands, glab api for full API access, NO_COLOR=1, and headless GITLAB_TOKEN auth.
- Supports
-F json/--output jsonacross core resource commands - Includes
glab apifor direct REST and GraphQL queries
Supports scoped GITLAB_TOKEN and --draft / --yes explicit flags, though merge and delete commands lack a universal --dry-run.
- Scoped
GITLAB_TOKENenv var isolation - Missing universal
--dry-runacross remote mutation subcommands
Single static Go binary distributed via Homebrew, apt, winget, and GitLab Releases across macOS, Linux, and Windows.
- Zero runtime dependencies and fast binary startup
Covers MRs, issues, pipelines, releases, and raw API calls in one cohesive CLI.
- End-to-end GitLab workflow coverage with
glab apifallback
First-party official CLI maintained by GitLab under MIT license.
- Official
gitlab-org/cliproject
Well-documented CLI manual in GitLab docs and structured --help output.
- Official GitLab CLI documentation and subcommand help
Security, Auth & Guardrails
Stores host tokens in ~/.config/glab-cli/config.yml and accepts GITLAB_TOKEN / GITLAB_HOST environment variables.
MIT open-source CLI; subject to GitLab.com or self-managed instance rate limits.
# GitLab CLI (glab) Agent Rules - Pass `-F json` or use `glab api` for structured reads. - Always supply `--yes`, `--title`, and `--description` explicitly on `glab mr create` or `glab issue create`. - Never run `glab mr merge` or `glab repo delete` without explicit user approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
glab mr list -F json --per-page 20
Returns structured merge request metadata without terminal table formatting.
glab ci get -F json
Fetches the current branch pipeline and job statuses in JSON format.
Controlled Writes & Previews
glab mr create --draft --yes --title "chore: update pipeline" --description "Automated update"
Passes --draft, --yes, --title, and --description explicitly to avoid interactive prompts and accidental merges.
Strengths for Agents
- + Structured
-F jsonoutput andglab apisimplify automated MR and pipeline triage. - + First-class support for self-hosted instances via
GITLAB_HOSTandGITLAB_TOKEN. - + Single Go binary installs cleanly in local and CI sandboxes.
Caveats & Pitfalls
- ! Lacks a global
--dry-runflag on mutation commands likeglab mr merge. - ! Not every legacy subcommand supports
-F jsonuniformly, occasionally requiringglab api.