
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
GitLab MCP (Model Context Protocol) server for interacting with GitLab API through AI Clients
A MCP (Model Context Protocol) server for interacting with GitLab API. This server provides a set of tools that allow AI clients to perform operations on GitLab repositories, issues, merge requests, and more. All operations support both synchronous and asynchronous execution patterns.
# Clone the repository
git clone https://github.com/Adit-999/gitlab-mcp.git
cd gitlab-mcp
# Install dependencies using uv
uv sync
# Clone the repository
git clone https://github.com/Adit-999/gitlab-mcp.git
cd gitlab-mcp
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e .
The GitLab MCP server requires two environment variables to function properly:
GITLAB_PERSONAL_ACCESS_TOKEN
- For authentication with GitLab APIGITLAB_API_URL
- The base URL for the GitLab APICreate a .env
file in the project root directory with these variables:
GITLAB_PERSONAL_ACCESS_TOKEN=your_personal_access_token
GITLAB_API_URL=https://gitlab.com
You can also configure the MCP server in your MCP JSON configuration file:
{
"mcpServers": {
"gitlab-mcp": {
"command": "uv",
"args": ["run", "--with", "mcp[cli],python-gitlab", "mcp", "run", "/path/to/gitlab-mcp/server.py"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_personal_access_token",
"GITLAB_API_URL": "https://gitlab.com"
}
}
}
}
uv run mcp install server.py
The project follows a modular, domain-driven architecture:
gitlab-mcp/
āāā src/ # Source code
ā āāā api/ # API interaction layer
ā ā āāā client.py # GitLab client wrapper
ā ā āāā exceptions.py # API exception definitions
ā ā āāā async_utils.py # Async support utilities
ā āāā schemas/ # Data models and validation
ā ā āāā base.py # Base schema classes
ā ā āāā repositories.py # Repository data models
ā ā āāā branches.py # Branch data models
ā ā āāā issues.py # Issue data models
ā ā āāā merge_requests.py # Merge request data models
ā ā āāā pipelines.py # Pipeline data models
ā ā āāā groups.py # Group data models
ā ā āāā search.py # search data models
ā āāā services/ # Business logic layer
ā ā āāā repositories.py # Repository operations
ā ā āāā branches.py # Branch operations
ā ā āāā issues.py # Issue operations
ā ā āāā merge_requests.py # Merge request operations
ā ā āāā pipelines.py # Pipeline operations
ā ā āāā groups.py # Group operations
ā ā āāā search.py # search operations
ā āāā tools/ # MCP tool implementations
ā āāā repositories.py # Repository tools
ā āāā branches.py # Branch tools
ā āāā issues.py # Issue tools
ā āāā merge_requests.py # Merge request tools
ā āāā pipelines.py # Pipeline tools
ā āāā groups.py # Group tools
ā āāā search.py # search tools
āāā server.py # Main MCP server entry point
This architecture provides several benefits:
The server provides the following tools for interacting with GitLab:
create_repository
: Create a new GitLab repositorylist_repository_tree
: List the contents of a repository treecreate_branch
: Create a new branch in a GitLab repositorylist_branches
: List branches in a GitLab repositoryget_branch
: Get details for a specific GitLab branchdelete_branch
: Delete a branch from a GitLab repositorydelete_merged_branches
: Delete all merged branches from a GitLab repositoryprotect_branch
: Protect a branch in a GitLab repositoryunprotect_branch
: Remove protection from a branch in a GitLab repositoryget_default_branch_ref
: Get the default branch reference for a GitLab repositorycreate_file
: Create a new file in a GitLab repositoryget_file_contents
: Retrieve the contents of a file from a GitLab repositoryget_raw_file_contents
: Retrieve the raw contents of a file from a GitLab repositoryupdate_file
: Update an existing file in a GitLab repositorydelete_file
: Delete a file from a GitLab repositoryget_file_blame
: Retrieve blame information for a file in a GitLab repositorycreate_issue
: Create a new issue in a GitLab repositoryupdate_issue
: Update an existing issue in a GitLab repositorylist_issues
: List issues for a GitLab projectlist_all_issues
: List all issues the authenticated user has access tolist_group_issues
: List issues in a GitLab groupget_issue
: Get details for a specific GitLab issueclose_issue
: Close a GitLab issuedelete_issue
: Delete an issue from a GitLab repositorymove_issue
: Move an issue to a different projectcomment_on_issue
: Add a comment to a GitLab issuelist_issue_comments
: List comments for a GitLab issuecreate_issue_link
: Create a link between issueslist_issue_links
: List links to an issueget_issue_link
: Get details about an issue linkdelete_issue_link
: Delete a link between issuescreate_merge_request
: Create a new merge request in a GitLab repositorylist_merge_requests
: List merge requests for a GitLab projectget_merge_request
: Get details for a specific GitLab merge requestmerge_merge_request
: Merge a GitLab merge requestlist_project_pipelines
: List pipelines in a GitLab projectget_single_pipeline
: Get a single pipeline by ID for a GitLab projectget_latest_pipeline
: Get the latest pipeline for the most recent commit on a specific refget_job
: Get a specific job from a GitLab projectget_job_logs
: Get logs from a GitLab jobget_job_failure_info
: Get detailed information about why a GitLab job failed, including error messages from logslist_groups
: List GitLab groupsget_group
: Get a specific GitLab groupget_group_by_project_namespace
: Get a GitLab group based on a project namespacesearch_global
: Search across all GitLab resources (projects, issues, merge requests, milestones, users, etc.)search_project
: Search within a specific project (issues, merge requests, code content, wiki content, etc.)search_group
: Search within a specific group (projects, issues, merge requests, milestones, etc.)GITLAB_PERSONAL_ACCESS_TOKEN
has the necessary permissions and is correctly set in your environment variables.This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
GitLab MCP (Model Context Protocol) server for interacting with GitLab API through AI Clients
We found that gitlab-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.