Give your AI agent direct GitLab access with glab CLI
Apr 27, 2026Kai Armstrong

Summary
This post introduces the use of the GitLab CLI (`glab`) with the Model Context Protocol (MCP) to provide AI agents with direct, structured access to GitLab projects. It details how agents can use `glab` to fetch issues, merge requests (including unresolved discussions), check pipeline status, and programmatically resolve MR notes. It also highlights the benefits of using `glab`'s JSON output for structured data consumption by AI and the ability to leverage `glab api` for full access to GitLab's REST and GraphQL APIs, enabling agents to perform actions beyond built-in commands. Future work includes agent-aware help text and machine-readable errors.