GitLab MCP Server
An MCP server for the GitLab API that enables comprehensive project management, file operations, and issue tracking. It supports automated branch creation, batch file pushes, and interaction with merge requests and CI/CD logs.
README
š¦ GitLab MCP Server
š MCP Server for the GitLab API, enabling project management, file operations, and more.
⨠Features
- šæ Automatic Branch Creation: When creating/updating files or pushing changes, branches are automatically created if they don't exist
- š”ļø Comprehensive Error Handling: Clear error messages for common issues
- š Git History Preservation: Operations maintain proper Git history without force pushing
- š¦ Batch Operations: Support for both single-file and multi-file operations
š§ Tools
-
create_or_update_file- Create or update a single file in a project
- Inputs:
project_id(string): Project ID or URL-encoded pathfile_path(string): Path where to create/update the filecontent(string): Content of the filecommit_message(string): Commit messagebranch(string): Branch to create/update the file inprevious_path(optional string): Path of the file to move/rename
- Returns: File content and commit details
-
push_files- Push multiple files in a single commit
- Inputs:
project_id(string): Project ID or URL-encoded pathbranch(string): Branch to push tofiles(array): Files to push, each withfile_pathandcontentcommit_message(string): Commit message
- Returns: Updated branch reference
-
search_repositories- Search for GitLab projects
- Inputs:
search(string): Search querypage(optional number): Page number for paginationper_page(optional number): Results per page (default 20)
- Returns: Project search results
-
create_repository- Create a new GitLab project
- Inputs:
name(string): Project namedescription(optional string): Project descriptionvisibility(optional string): 'private', 'internal', or 'public'initialize_with_readme(optional boolean): Initialize with README
- Returns: Created project details
-
get_file_contents- Get contents of a file or directory
- Inputs:
project_id(string): Project ID or URL-encoded pathfile_path(string): Path to file/directoryref(optional string): Branch/tag/commit to get contents from
- Returns: File/directory contents
-
create_issue- Create a new issue
- Inputs:
project_id(string): Project ID or URL-encoded pathtitle(string): Issue titledescription(optional string): Issue descriptionassignee_ids(optional number[]): User IDs to assignlabels(optional string[]): Labels to addmilestone_id(optional number): Milestone ID
- Returns: Created issue details
-
create_merge_request- Create a new merge request
- Inputs:
project_id(string): Project ID or URL-encoded pathtitle(string): MR titledescription(optional string): MR descriptionsource_branch(string): Branch containing changestarget_branch(string): Branch to merge intodraft(optional boolean): Create as draft MRallow_collaboration(optional boolean): Allow commits from upstream members
- Returns: Created merge request details
-
get_merge_request_raw_diff- Get a merge request information of the difference in a raw format
- Inputs:
project_id(string): Project ID or URL-encoded pathmerge_request_id(string): ID of the merge request
- Returns: The difference of the merge request in a raw format
-
fork_repository- Fork a project
- Inputs:
project_id(string): Project ID or URL-encoded pathnamespace(optional string): Namespace to fork to
- Returns: Forked project details
-
create_branch
- Create a new branch
- Inputs:
project_id(string): Project ID or URL-encoded pathbranch(string): Name for new branchref(optional string): Source branch/commit for new branch
- Returns: Created branch reference
get_job_logs
- Retrieve the logs from a job
- Inputs:
project_id(string): Project ID or URL-encoded pathjob_id(string): ID of the job
- Returns: The logs of the job
āļø Setup
š Personal Access Token
Create a GitLab Personal Access Token with appropriate permissions:
- Go to User Settings > Access Tokens in GitLab
- Select the required scopes:
apifor full API accessread_apifor read-only accessread_repositoryandwrite_repositoryfor repository operations
- Create the token and save it securely
š» Usage with Claude Desktop
Add the following to your claude_desktop_config.json:
š³ Docker
{
"mcpServers": {
"gitlab": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GITLAB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITLAB_API_URL",
"mcp/gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances
}
}
}
}
š¦ NPX
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances
}
}
}
}
šļø Build
Docker build:
docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .
š Environment Variables
GITLAB_PERSONAL_ACCESS_TOKEN: Your GitLab personal access token (required)GITLAB_API_URL: Base URL for GitLab API (optional, defaults tohttps://gitlab.com/api/v4)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.