MCP server for GitLab, written in Go. It uses gitlab.com/gitlab-org/api/client-go for authenticated GitLab API access and github.com/mark3labs/mcp-go for MCP stdio transport.
Create config.yaml:
server:
# stdio is the default for local MCP clients. Use http to bind to host:port.
transport: "stdio"
host: "127.0.0.1"
port: 8080
endpoint: "/mcp"
gitlab:
url: "https://gitlab.com"
token: "glpat-your-token"Environment variables override the file:
GITLAB_URLGITLAB_TOKEN
go run ./cmd/mcp-gitlab-api --config config.yamlFor env-only configuration:
GITLAB_TOKEN=glpat-your-token go run ./cmd/mcp-gitlab-api --allow-missing-configTo run the MCP server over streamable HTTP instead of stdio, set:
server:
transport: "http"
host: "127.0.0.1"
port: 8080
endpoint: "/mcp"The MCP endpoint will be http://127.0.0.1:8080/mcp.
{
"mcpServers": {
"gitlab": {
"command": "/path/to/mcp-gitlab-api",
"args": ["--config", "/path/to/config.yaml"]
}
}
}{
"mcp": {
"gitlab": {
"enabled": true,
"type": "remote",
"url": "http://127.0.0.1:8082/mcp"
}
}
}Repository and code access:
gitlab_list_projectsgitlab_get_projectgitlab_list_repository_treegitlab_get_filegitlab_search_codegitlab_list_commitsgitlab_list_branchesgitlab_list_tagsgitlab_compare_refsgitlab_get_commit_diffgitlab_blame_filegitlab_get_merge_request_changes
Merge request operations:
gitlab_list_merge_requestsgitlab_get_merge_requestgitlab_list_merge_request_discussionsgitlab_create_merge_requestgitlab_create_merge_request_commentgitlab_approve_merge_requestgitlab_unapprove_merge_requestgitlab_update_merge_request_reviewersgitlab_get_merge_request_pipelinegitlab_merge_merge_request
Issues and project management:
gitlab_list_issuesgitlab_get_issuegitlab_create_issuegitlab_update_issuegitlab_create_issue_commentgitlab_update_issue_labelsgitlab_update_issue_milestonegitlab_assign_issuegitlab_link_issue_to_merge_requestgitlab_list_epics
CI/CD and pipelines:
gitlab_list_pipelinesgitlab_get_pipelinegitlab_get_job_loggitlab_retry_jobgitlab_cancel_jobgitlab_trigger_pipelinegitlab_get_job_artifactgitlab_get_pipeline_test_reportgitlab_list_deploymentsgitlab_list_environments
User and team information:
gitlab_list_project_membersgitlab_get_usergitlab_get_code_ownersgitlab_resolve_usergitlab_find_project_maintainersgitlab_find_reviewers
Use the least privilege token that supports your intended operations. Read-only tools generally need read_api or api; write tools such as creating MRs, commenting, approvals, merges, retries, cancellations, and pipeline triggers need api.
Premium-only APIs such as epics return the GitLab API error from your instance if the feature is unavailable or the token lacks access.