@zereight/mcp-gitlab

smithery badge

GitLab MCP(Model Context Protocol) Server. Includes bug fixes and improvements over the original GitLab MCP server.

gitlab mcp MCP server

Usage

Using with Claude App, Cline, Roo Code, Cursor

When using with the Claude App, you need to set up your API key and URLs directly.

{
  "mcpServers": {
    "GitLab communication server": {
      "command": "npx",
      "args": ["-y", "@zereight/mcp-gitlab"],
      "env": {
        "GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
        "GITLAB_API_URL": "your_gitlab_api_url",
        "GITLAB_READ_ONLY_MODE": "true"
      }
    }
  }
}

Environment Variables

  • GITLAB_PERSONAL_ACCESS_TOKEN: Your GitLab personal access token.
  • GITLAB_API_URL: Your GitLab API URL. (Default: https://gitlab.com/api/v4)
  • GITLAB_READ_ONLY_MODE: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit.

Tools ?️

  1. create_or_update_file

  2. Create or update a single file in a GitLab project. ?

  3. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • file_path (string): Path to create/update the file
    • content (string): File content
    • commit_message (string): Commit message
    • branch (string): Branch to create/update the file in
    • previous_path (optional string): Previous file path when renaming a file
  4. Returns: File content and commit details

  5. push_files

  6. Push multiple files in a single commit. ?

  7. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • branch (string): Branch to push to
    • files (array): Array of files to push, each with file_path and content properties
    • commit_message (string): Commit message
  8. Returns: Updated branch reference

  9. search_repositories

  10. Search for GitLab projects. ?

  11. Inputs:
    • search (string): Search query
    • page (optional number): Page number (default: 1)
    • per_page (optional number): Results per page (default: 20, max: 100)
  12. Returns: Project search results

  13. create_repository

  14. Create a new GitLab project. ➕

  15. Inputs:
    • name (string): Project name
    • description (optional string): Project description
    • visibility (optional string): Project visibility level (public, private, internal)
    • initialize_with_readme (optional boolean): Initialize with README
  16. Returns: Details of the created project

  17. get_file_contents

  18. Get the contents of a file or directory. ?

  19. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • file_path (string): Path to the file/directory
    • ref (optional string): Branch, tag, or commit SHA (default: default branch)
  20. Returns: File/directory content

  21. create_issue

  22. Create a new issue. ?

  23. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • title (string): Issue title
    • description (string): Issue description
    • assignee_ids (optional number[]): Array of assignee IDs
    • milestone_id (optional number): Milestone ID
    • labels (optional string[]): Array of labels
  24. Returns: Details of the created issue

  25. create_merge_request

  26. Create a new merge request. ?

  27. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • title (string): Merge request title
    • description (string): Merge request description
    • source_branch (string): Branch with changes
    • target_branch (string): Branch to merge into
    • allow_collaboration (optional boolean): Allow collaborators to push commits to the source branch
    • draft (optional boolean): Create as a draft merge request
  28. Returns: Details of the created merge request

  29. fork_repository

  30. Fork a project. ?

  31. Inputs:
    • project_id (string): Project ID or namespace/project_path to fork
    • namespace (optional string): Namespace to fork into (default: user namespace)
  32. Returns: Details of the forked project

  33. create_branch

  34. Create a new branch. ?

  35. Inputs:
    • project_id (string): Project ID or namespace/project_path
    • name (string): New branch name
    • ref (optional string): Ref to create the branch from (branch, tag, commit SHA, default: default branch)
  36. Returns: Created branch reference

  37. get_merge_request

    • Get details of a merge request. ℹ️
    • Inputs:
    • project_id (string): Project ID or namespace/project_path
    • merge_request_iid (number): Merge request IID
    • Returns: Merge request details
  38. get_merge_request_diffs

    • Get changes (diffs) of a merge request. diff
    • Inputs:
    • project_id (string): Project ID or namespace/project_path
    • merge_request_iid (number): Merge request IID
    • view (optional string): Diff view type ('inline' or 'parallel')
    • Returns: Array of merge request diff information
  39. update_merge_request

    • Update a merge request. ?
    • Inputs:
    • project_id (string): Project ID or namespace/project_path
    • merge_request_iid (number): Merge request IID
    • title (optional string): New title
    • description (string): New description
    • target_branch (optional string): New target branch
    • state_event (optional string): Merge request state change event ('close', 'reopen')
    • remove_source_branch (optional boolean): Remove source branch after merge
    • allow_collaboration (optional boolean): Allow collaborators to push commits to the source branch
    • Returns: Updated merge request details
  40. create_note

    • Create a new note (comment) to an issue or merge request. ?
    • Inputs:
    • project_id (string): Project ID or namespace/project_path
    • noteable_type (string): Type of noteable ("issue" or "merge_request")
    • noteable_iid (number): IID of the issue or merge request
    • body (string): Note content
    • Returns: Details of the created note
  41. list_projects

    • List accessible projects with rich filtering options ?
    • Inputs:
    • Search/filtering:
      • search
      • owned
      • membership
      • archived
      • visibility
    • Features filtering:
      • with_issues_enabled
      • with_merge_requests_enabled
    • Sorting:
      • order_by
      • sort
    • Access control:
      • min_access_level
    • Pagination:
      • page
      • per_page
      • simple
    • Returns: Array of projects
  42. list_labels
    • List all labels for a project with filtering options ?️
    • Inputs:
    • project_id (string): Project ID or path
    • with_counts (optional): Include issue and merge request counts
    • include_ancestor_groups (optional): Include ancestor groups
    • search (optional): Filter labels by keyword
    • Returns: Array of labels
  43. get_label
    • Get a single label from a project
    • Inputs:
    • project_id (string): Project ID or path
    • label_id (number/string): Label ID or name
    • include_ancestor_groups (optional): Include ancestor groups
    • Returns: label details
  44. create_label
    • Create a new label in an object ?️➕
    • Inputs:
    • project_id (string): Project ID or path
    • name (string): Label name
    • color (string): Color in hex format (e.g., "#FF0000")
    • description (optional): Label description
    • priority (optional): Label priority
    • Returns: Created label details
  45. update_label
    • Update an existing label in a project ?️✏️
    • Inputs:
    • project_id (string): Project ID or path
    • label_id (number/string): Label ID or name
    • new_name (optional): New label name
    • color (optional): New color in hex format
    • description (optional): New description
    • priority (optional): New priority
    • Returns: Updated label details
  46. delete_label

    • Delete a label from a project ?️❌
    • Inputs:
    • project_id (string): Project ID or path
    • label_id (number/string): Label ID or name
    • Returns: Success message
  47. list_group_projects

    • List all projects in a GitLab group. ?
    • Inputs:
    • group_id (string): Project ID or namespace/project_path
    • Filtering options:
      • include_subgroups (optional boolean): Include projects from subgroups
      • search (optional string): Search term to filter projects
      • archived (optional boolean): Filter for archived projects
      • visibility (optional string): Filter by project visibility (public/internal/private)
      • with_programming_language (optional string): Filter by programming language
      • starred (optional boolean): Filter by starred projects
    • Feature filtering:
      • with_issues_enabled (optional boolean): Filter projects with issues feature enabled
      • with_merge_requests_enabled (optional boolean): Filter projects with merge requests feature enabled
      • min_access_level (optional number): Filter by minimum access level
    • Pagination:
      • page (optional number): Page number
      • per_page (optional number): Results per page
    • Sorting:
      • order_by (optional string): Field to sort by
      • sort (optional string): Sort direction (asc/desc)
    • Additional data:
      • statistics (optional boolean): Include project statistics
      • with_custom_attributes (optional boolean): Include custom attributes
      • with_security_reports (optional boolean): Include security reports
    • Returns: List of projects

Environment Variable Configuration

Before running the server, you need to set the following environment variables:

GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
GITLAB_API_URL=your_gitlab_api_url  # Default: https://gitlab.com/api/v4
GITLAB_READ_ONLY_MODE=true          # Optional: Enable read-only mode

License

MIT License

[
  {
    "description": "Create or update a single file in a GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "branch": {
          "description": "Branch to create/update the file in",
          "type": "string"
        },
        "commit_message": {
          "description": "Commit message",
          "type": "string"
        },
        "content": {
          "description": "Content of the file",
          "type": "string"
        },
        "file_path": {
          "description": "Path where to create/update the file",
          "type": "string"
        },
        "previous_path": {
          "description": "Path of the file to move/rename",
          "type": "string"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "file_path",
        "content",
        "commit_message",
        "branch"
      ],
      "type": "object"
    },
    "name": "create_or_update_file"
  },
  {
    "description": "Search for GitLab projects",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "page": {
          "description": "Page number for pagination (default: 1)",
          "type": "number"
        },
        "per_page": {
          "description": "Number of results per page (default: 20)",
          "type": "number"
        },
        "search": {
          "description": "Search query",
          "type": "string"
        }
      },
      "required": [
        "search"
      ],
      "type": "object"
    },
    "name": "search_repositories"
  },
  {
    "description": "Create a new GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "description": {
          "description": "Repository description",
          "type": "string"
        },
        "initialize_with_readme": {
          "description": "Initialize with README.md",
          "type": "boolean"
        },
        "name": {
          "description": "Repository name",
          "type": "string"
        },
        "visibility": {
          "description": "Repository visibility level",
          "enum": [
            "private",
            "internal",
            "public"
          ],
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "name": "create_repository"
  },
  {
    "description": "Get the contents of a file or directory from a GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "file_path": {
          "description": "Path to the file or directory",
          "type": "string"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "ref": {
          "description": "Branch/tag/commit to get contents from",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "file_path"
      ],
      "type": "object"
    },
    "name": "get_file_contents"
  },
  {
    "description": "Push multiple files to a GitLab project in a single commit",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "branch": {
          "description": "Branch to push to",
          "type": "string"
        },
        "commit_message": {
          "description": "Commit message",
          "type": "string"
        },
        "files": {
          "description": "Array of files to push",
          "items": {
            "additionalProperties": false,
            "properties": {
              "content": {
                "description": "Content of the file",
                "type": "string"
              },
              "file_path": {
                "description": "Path where to create the file",
                "type": "string"
              }
            },
            "required": [
              "file_path",
              "content"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "branch",
        "files",
        "commit_message"
      ],
      "type": "object"
    },
    "name": "push_files"
  },
  {
    "description": "Create a new issue in a GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "assignee_ids": {
          "description": "Array of user IDs to assign",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        "description": {
          "description": "Issue description",
          "type": "string"
        },
        "labels": {
          "description": "Array of label names",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "milestone_id": {
          "description": "Milestone ID to assign",
          "type": "number"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "title": {
          "description": "Issue title",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "title"
      ],
      "type": "object"
    },
    "name": "create_issue"
  },
  {
    "description": "Create a new merge request in a GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "allow_collaboration": {
          "description": "Allow commits from upstream members",
          "type": "boolean"
        },
        "description": {
          "description": "Merge request description",
          "type": "string"
        },
        "draft": {
          "description": "Create as draft merge request",
          "type": "boolean"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "source_branch": {
          "description": "Branch containing changes",
          "type": "string"
        },
        "target_branch": {
          "description": "Branch to merge into",
          "type": "string"
        },
        "title": {
          "description": "Merge request title",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "title",
        "source_branch",
        "target_branch"
      ],
      "type": "object"
    },
    "name": "create_merge_request"
  },
  {
    "description": "Fork a GitLab project to your account or specified namespace",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "namespace": {
          "description": "Namespace to fork to (full path)",
          "type": "string"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        }
      },
      "required": [
        "project_id"
      ],
      "type": "object"
    },
    "name": "fork_repository"
  },
  {
    "description": "Create a new branch in a GitLab project",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "branch": {
          "description": "Name for the new branch",
          "type": "string"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "ref": {
          "description": "Source branch/commit for new branch",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "branch"
      ],
      "type": "object"
    },
    "name": "create_branch"
  },
  {
    "description": "Get details of a merge request",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "merge_request_iid": {
          "description": "The internal ID of the merge request",
          "type": "number"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "merge_request_iid"
      ],
      "type": "object"
    },
    "name": "get_merge_request"
  },
  {
    "description": "Get the changes/diffs of a merge request",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "merge_request_iid": {
          "description": "The internal ID of the merge request",
          "type": "number"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "view": {
          "description": "Diff view type",
          "enum": [
            "inline",
            "parallel"
          ],
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "merge_request_iid"
      ],
      "type": "object"
    },
    "name": "get_merge_request_diffs"
  },
  {
    "description": "Update a merge request",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "assignee_ids": {
          "description": "The ID of the users to assign the MR to",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        "description": {
          "description": "The description of the merge request",
          "type": "string"
        },
        "draft": {
          "description": "Work in progress merge request",
          "type": "boolean"
        },
        "labels": {
          "description": "Labels for the MR",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "merge_request_iid": {
          "description": "The internal ID of the merge request",
          "type": "number"
        },
        "project_id": {
          "description": "Project ID or URL-encoded path",
          "type": "string"
        },
        "remove_source_branch": {
          "description": "Flag indicating if the source branch should be removed",
          "type": "boolean"
        },
        "squash": {
          "description": "Squash commits into a single commit when merging",
          "type": "boolean"
        },
        "state_event": {
          "description": "New state (close/reopen) for the MR",
          "enum": [
            "close",
            "reopen"
          ],
          "type": "string"
        },
        "target_branch": {
          "description": "The target branch",
          "type": "string"
        },
        "title": {
          "description": "The title of the merge request",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "merge_request_iid"
      ],
      "type": "object"
    },
    "name": "update_merge_request"
  },
  {
    "description": "Create a new note (comment) to an issue or merge request",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "body": {
          "description": "Note content",
          "type": "string"
        },
        "noteable_iid": {
          "description": "IID of the issue or merge request",
          "type": "number"
        },
        "noteable_type": {
          "description": "Type of noteable (issue or merge_request)",
          "enum": [
            "issue",
            "merge_request"
          ],
          "type": "string"
        },
        "project_id": {
          "description": "Project ID or namespace/project_path",
          "type": "string"
        }
      },
      "required": [
        "project_id",
        "noteable_type",
        "noteable_iid",
        "body"
      ],
      "type": "object"
    },
    "name": "create_note"
  }
]