Scrapbook: GitLab MCP Support
Date: 2026-02-16T18:20:00Z
Initial Questions
- Does an MCP server for GitLab already exist? There are MCP servers for GitHub (e.g., `github-mcp`, `mcp-server-github`). GitLab support is less common but might be present.
- Could we adapt an existing GitHub MCP server by changing the API client? That would save time.
- GitLab’s API is feature‑rich; we should design tools that are intuitive for AI agents: high‑level actions like “create MR from branch” rather than low‑level raw API calls.
Candidate Existing Projects
- Model Context Protocol’s official server list: https://github.com/modelcontextprotocol/servers – includes servers for GitHub, filesystem, SQL, etc. No official GitLab server yet.
- Community: search GitHub for “gitlab mcp” or “mcp gitlab”. Might find `gitlab-mcp-server` or similar.
- Alternatives: Some AI agents use direct REST calls via `curl` or custom scripts; but an MCP server would standardize the interface.
Design Principles
- Tools should be opinionated to reduce complexity: e.g., `gitlab.create_merge_request` takes source branch, target branch, title, description, and optional assignees/labels.
- File operations: support creating/updating files in a repo (like GitHub’s `create_or_update_file`). GitLab API has “Create a file” and “Update a file” endpoints; we can unify.
- CI/CD: `gitlab.trigger_pipeline(project, ref=branch)`; `gitlab.list_pipeline_jobs(pipeline_id)`.
- Idempotency: `create_issue` should be safe to call multiple times? Could be designed to find existing open issue by title and return it.
- Security: tokens should be scoped appropriately (api, read_repo, write_repo, etc.).
API Nuggets
- GitLab REST API base: `/api/v4/`
- Common endpoints:
- Projects: `GET /projects`, `POST /projects`, `GET /projects/:id`
- Issues: `GET /projects/:id/issues`, `POST /projects/:id/issues`
- Merge Requests: `GET /projects/:id/merge_requests`, `POST /projects/:id/merge_requests`
- Repository files: `GET /projects/:id/repository/files/:file_path`, `PUT /projects/:id/repository/files/:file_path`
- Pipelines: `POST /projects/:id/pipeline`, `GET /projects/:id/pipelines`
- Authentication: `PRIVATE-TOKEN: <token>` header or `Authorization: Bearer <token>` (OAuth).
- URL encoding: project ID can be `path` (e.g., `group%2Fproject`) or numeric ID.
- Webhooks: could be used to push events to an agent; but MCP is request/response, so we’d still poll or combine with separate webhook listener.
Next
- Quick search for existing MCP servers for GitLab.
- If none, plan to build one in Go or TypeScript.