GitLab MCP server core tools

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

To provide feedback on this feature, leave a comment on issue 630189.

These tools are part of the core toolset. Use them to get and create projects, get users and groups, and list projects, groups, project members, to-do items, contribution events, and milestones. You can also add comments, search GitLab, search labels, search code semantically, and read GitLab Pages content.

For a list of all tools, see GitLab MCP server tools.

get_project

Returns metadata for a single GitLab project: numeric ID, full path, default branch, visibility, and web URL.

ParameterTypeRequiredDescription
urlstringNoURL of the project. Provide exactly one of url or project_id.
project_idstringNoID or full path of the project. Provide exactly one of url or project_id.
includearrayNoFacet to include alongside the project, one per call: work_item_types.

default_branch is null when the project has no repository yet. To find a project you cannot name yet, use search with the projects scope.

The work_item_types facet lists the work item types available in the project. Each type includes its global ID, name, icon, and the widget types enabled on it, so you can avoid setting fields the type does not support when calling save_work_item.

Example:

What is the default branch of gitlab-org/gitlab?

save_project

Creates a new GitLab project in the specified namespace (group or user). If no namespace is provided, the project is created in the authenticated user’s personal namespace.

ParameterTypeRequiredDescription
namestringYesName of the project.
pathstringNoURL slug for the project. Defaults to a slugified name.
namespace_idintegerNoID of the namespace (group or user) to create the project in.
namespace_pathstringNoFull path of the namespace. Alternative to namespace_id; provide one or the other.
descriptionstringNoDescription of the project.
visibilitystringNoVisibility level: private, internal, or public. Defaults to the instance’s default project visibility.
initialize_with_readmebooleanNoCreate an initial README.md file.
default_branchstringNoDefault branch name. Defaults to the instance default.
topicsarray of stringsNoList of topics (tags) for the project.
template_namestringNoName of a project template. For built-in templates (like rails, spring, express), use alone. For custom templates, use with use_custom_template.
template_project_idintegerNoProject ID of a custom template. Alternative to template_name. Use with use_custom_template. Premium and Ultimate only.
use_custom_templatebooleanNoUse a custom project template. Requires template_name or template_project_id. Premium and Ultimate only.
group_with_project_templates_idintegerNoGroup ID that serves as the template source for group-level templates. Optional for instance-level templates. Premium and Ultimate only.

Example:

Create a new private project called "my-app" in the gitlab-org group

get_user

Gets a single GitLab user. Use this tool to resolve a username, or your own account, to a numeric user ID. For example, use it before you set assignees or reviewers with other tools.

Provide exactly one of username, id, or me.

ParameterTypeRequiredDescription
usernamestringNoUsername of the user to look up.
idintegerNoNumeric ID of the user to look up.
mebooleanNoSet to true to look up the authenticated user. Omit username and id when set. Set to false to not use this parameter.

The response returns the user’s numeric id, username, name, state, and web_url.

Example:

What is my GitLab user ID?

get_group

Returns the following metadata for a single GitLab group:

  • Numeric ID
  • Full path
  • Name
  • Visibility
  • Parent
  • Web URL

Provide either the url or group_id.

ParameterTypeRequiredDescription
urlstringNoURL of the group.
group_idstringNoID or full path of the group, for example gitlab-org/quality.

The response includes id, fullPath, name, visibility, webUrl, and parent. The parent field contains the numeric ID of the parent group. It is null for a top-level group or when you do not have access to the parent group. To discover groups, use list_groups.

Example:

What is the ID and visibility of gitlab-org/quality?

list_groups

Lists groups, for navigating the group hierarchy and discovering group IDs and full paths to use with other tools. Without group_id, this tool lists top-level groups where you are a member. With group_id, it lists the direct subgroups of that group, regardless of membership. Set include_subgroups to true to recurse into all descendant subgroups. With no group_id, that lists your groups at any depth. Archived groups and groups pending deletion are excluded.

ParameterTypeRequiredDescription
group_idstringNoID or full path of a parent group to list subgroups of. Omit to list top-level groups where you are a member.
searchstringNoSearch groups by name or full path.
visibilitystringNoFilter by visibility level: public, internal, or private.
include_subgroupsbooleanNoInclude all descendant subgroups recursively instead of direct children only.
afterstringNoCursor for forward pagination.
firstintegerNoNumber of groups to return for forward pagination. Default is 20, maximum is 100.

Example:

List the subgroups of gitlab-org

list_projects

Without group_id, lists projects where you have at least the Guest role by default; pass min_access_level to raise the threshold. With group_id, lists every project in that group and its subgroups regardless of access level; adding min_access_level or visibility narrows the listing to that group only, not its subgroups, because GitLab does not support combining subgroup traversal with those filters when listing a group’s projects.

ParameterTypeRequiredDescription
group_idstringNoID or full path of a group. Omit to list across the whole instance, defaulting to projects where you have at least the Guest role.
min_access_levelstringNoMinimum access level a project must grant you to be included. One of guest, planner, reporter, developer, maintainer, or owner.
searchstringNoSearch projects by name, path, or description.
visibilitystringNoFilter by visibility level: public, internal, or private.
archivedstringNoFilter by archived state: only, include, or exclude (default).
afterstringNoCursor for forward pagination.
firstintegerNoNumber of projects to return for forward pagination. Default is 20, maximum is 100.

When you provide group_id, the response includes subgroupsIncluded: true when the listing covers the group’s subgroups, false when min_access_level or visibility narrowed the listing to that group only.

Example:

List my projects

list_project_members

Lists the members of a GitLab project with their role and access level.

ParameterTypeRequiredDescription
project_idstringYesFull path or numeric ID of the project (for example, gitlab-org/gitlab or 278964).
include_inheritedbooleanNoAlso return members who inherit their role from a parent group or a subgroup of the project. Defaults to false.
querystringNoReturn only members whose name or username contains this text.
firstintegerNoNumber of members to return for forward pagination (default 20, maximum 100).
afterstringNoCursor for forward pagination.

For each member, the response returns the user ID, username, name, numeric access_level, the matching access_level_name (for example, Maintainer), and the membership expires_at date. Members who were invited by email but have not accepted their invitation yet are not returned.

Each call returns a single page of results. If more pages exist, the response metadata includes an end_cursor you can pass as after to fetch the next page.

Example:

Who are the maintainers of gitlab-org/gitlab?

list_todos

Lists your to-do items, such as review requests, assignments, and mentions. Returns pending to-do items unless you set state to done.

ParameterTypeRequiredDescription
statestringNoFilter by state: pending or done. Default is pending.
actionstringNoFilter by the action that created the to-do item, for example review_requested, assigned, or mentioned.
typestringNoFilter by the type of the to-do item target, for example MERGEREQUEST, ISSUE, or WORKITEM.
author_idintegerNoFilter by the numeric ID of the user who created the to-do item. To look up a user ID, use get_user.
project_idstringNoFilter by project. ID or full path of the project.
group_idstringNoFilter by group. ID or full path of the group.
firstintegerNoNumber of to-do items to return for forward pagination. Default is 20, maximum is 100.
afterstringNoCursor for forward pagination. Use pageInfo.endCursor from a previous response.

Each to-do item includes the following information:

  • Numeric id, action, state, body, targetType, targetUrl, and createdAt
  • name and iid of its target in targetEntity
  • Author
  • Project or group it belongs to

To-do item, author, project, and group IDs are returned as numbers (unwrapped from GraphQL global IDs) so they can be passed back into other tools.

Example:

Which merge requests am I asked to review?

list_user_events

Retrieves contribution events for a specified user. Does not return events associated with epics or merge requests. Returns bulk push events with limited commit details.

ParameterTypeRequiredDescription
idstringYesID or username of the user.
actionstringNoFilter events by action type.
target_typestringNoFilter events by target type.
beforestringNoReturn events created before the specified date (YYYY-MM-DD).
afterstringNoReturn events created after the specified date (YYYY-MM-DD).
sortstringNoSort results in ascending (asc) or descending (desc) order by creation date.
pageintegerNoPage number for pagination.
per_pageintegerNoNumber of events to return per page.

Example:

List recent events for user john_doe

list_milestones

Lists milestones in a GitLab project or group.

ParameterTypeRequiredDescription
urlstringNoGitLab URL of the project or group. Provide exactly one of url, project_id, or group_id.
project_idstringNoID or full path of the project. Provide exactly one of url, project_id, or group_id.
group_idstringNoID or full path of the group. Provide exactly one of url, project_id, or group_id.
statestringNoFilter milestones by state (active or closed). If omitted, returns milestones of all states.
searchstringNoSearch string to filter milestones by title.
include_ancestorsbooleanNoInclude milestones from parent groups. For a project, includes milestones from the project’s parent group and its ancestors.
include_descendantsbooleanNoInclude milestones from subgroups and their projects. Applies only to a group.
firstintegerNoNumber of milestones to return after the cursor (forward pagination). Maximum 100.
afterstringNoCursor for forward pagination of milestones. Use pageInfo.endCursor from a previous response.

Example:

List the open milestones in project gitlab-org/gitlab

save_note

Adds a comment to a GitLab merge request or work item, replies to an existing discussion thread, or resolves or unresolves a discussion thread, as the authenticated user.

ParameterTypeRequiredDescription
urlstringNoURL of the merge request or work item. The URL determines the target type.
project_idstringNoID or path of the project. Required with merge_request_iid, and with work_item_iid for project-level work items.
group_idstringNoID or path of the group. Required with work_item_iid for group-level work items.
merge_request_iidintegerNoInternal ID of the merge request. Provide with project_id. Mutually exclusive with work_item_iid.
work_item_iidintegerNoInternal ID of the work item. Provide with project_id or group_id. Mutually exclusive with merge_request_iid.
methodstringNoThe write operation to perform: create_note, reply_discussion, or resolve_discussion1. Defaults to create_note, or to reply_discussion when discussion_id is given. Fill only the parameters listed for the chosen method; other parameters are rejected.
bodystringNoContent of the note. Required for create_note and reply_discussion. Lines cannot start with / to avoid triggering quick actions (for example, /merge).
internalbooleanNoMarks the note as internal (visible only to members with at least the Reporter role). Default is false.
discussion_idstringNoDiscussion to reply to (reply_discussion) or to resolve or unresolve (resolve_discussion). Accepts the global ID (in the format gid://gitlab/Discussion/<id>) or the bare <id>. If missing, creates a new top-level note.
resolvedbooleanNotrue resolves the discussion, false unresolves it. Required for resolve_discussion.

Examples:

  • Comment on a merge request:

    Reply "Thanks, fixed in the latest push" to merge request 42 in project gitlab-org/gitlab
  • Comment on a work item:

    Add a comment "This looks good to me" to work item 42 in project gitlab-org/gitlab
  • Resolve a discussion on a work item:

    Resolve the open discussion about the acceptance criteria on work item 42 in project gitlab-org/gitlab

Searches for a term across the entire GitLab instance with the search API. This tool is available for global, group, and project search. Available scopes depend on the search type.

ParameterTypeRequiredDescription
scopestringYesSearch scope (for example, work_items, merge_requests, or projects).
searchstringYesSearch term.
group_idstringNoID or full path of the group you want to search.
project_idstringNoID or full path of the project you want to search.
statestringNoState of search results (for work_items and merge_requests).
confidentialbooleanNoFilters results by confidentiality (for work_items). Default is false.
fieldsarray of stringsNoArray of fields you want to search (for work_items and merge_requests).
order_bystringNoAttribute to order results by. Default is created_at for basic search and relevance for advanced search.
sortstringNoSort direction for results. Default is desc.
per_pageintegerNoNumber of results per page. Default is 20.
pageintegerNoCurrent page number. Default is 1.

Example:

Search issues for "flaky test" across GitLab

search_labels

Searches for labels in a GitLab project or group.

ParameterTypeRequiredDescription
project_idstringNoID or path of the project. Alternative to group_id or full_path.
group_idstringNoID or path of the group. Alternative to project_id or full_path.
full_pathstringNoFull path of the project or group (for example, group/project). Alternative to project_id or group_id. Requires is_project.
is_projectbooleanNoWhether full_path is a project (true) or group (false). Required with full_path.
searchstring or array of stringsNoOne term or an array of up to 10 terms to filter labels by title. If omitted, lists labels instead. An empty array is invalid.

Provide exactly one of project_id, group_id, or full_path.

When you search group labels, the results include labels from ancestor and descendant groups. Results from multiple terms form one list without duplicate labels.

Example:

Show me all labels in project gitlab-org/gitlab
  • Add-on: GitLab Duo Core, Pro, or Enterprise
  • Offering: GitLab.com, GitLab Self-Managed

The availability of this feature is controlled by a feature flag. For more information, see the history.

Searches relevant content in a GitLab project by meaning rather than by keyword. Use this tool when you do not know the exact symbol or file name, or to discover how a behavior is implemented across a codebase. For more information, including setup and enablement, see semantic code search.

ParameterTypeRequiredDescription
scopestringNoType of content to search. Only code is supported. If omitted, code is used.
querystringNoNatural language search query. Required if q is not set.
qstringNoSame as query. Required if query is not set. If both are set, query is used.
project_idstringYesID or full path of the project.
directory_pathstringNoRestricts the search to files under this directory path (for example, app/services/). Must be a relative path, without a leading slash or .. segments. Applies only when scope is code.
knnintegerNoNumber of nearest neighbors retrieved internally. Default is 64, maximum is 100. Higher values improve recall at the cost of latency. Applies only when scope is code.
limitintegerNoMaximum number of results to return. Default is 20, maximum is 100. Applies only when scope is code.

Results are grouped by file. Each file includes merged line ranges with content and a relevance score. For best results, describe the functionality or behavior you’re interested in rather than using generic keywords or specific function or variable names.

Example:

How are authorizations managed in this project?

get_pages_content

Reads the content published at a GitLab Pages URL as text. The tool resolves the URL against the Pages sites of your GitLab instance and reads the file from the current deployment, so you get what visitors see rather than the repository source. You can read private Pages sites that you have permission to view.

ParameterTypeRequiredDescription
urlstringYesGitLab Pages URL to read, for example https://mygroup.gitlab.io/myproject/docs/.
byte_offsetintegerNoByte offset to start reading the file from. Default is 0. Maximum is 20971520 (20 MB).
byte_limitintegerNoMaximum number of bytes to return. Default and maximum is 1048576 (1 MB).

The URL must point to a site served by GitLab Pages on your instance: a namespace domain, a unique domain, or a verified custom domain. Other hosts are not fetched.

A URL that ends in / reads the index.html file of that directory. When no directory has that name, it reads the .html file of the same name.

A URL without a file extension reads the index.html file of the directory with that name if the directory exists, and otherwise falls back to the .html file of the same name, matching how GitLab Pages serves the site.

The response carries the path of the file inside the deployment, its content_type, and the project_id of the project that publishes the site, only when you can view the project. When the file is longer than byte_limit, the response reports the total size and tells you the byte_offset to use for the next window. Binary files, such as images, are not returned.

Example:

Read https://mygroup.gitlab.io/myproject/docs/api/ and summarize the authentication section

  1. For resolve_discussion, the tool returns the method, the discussion_id as a global ID, the new resolved state, and the web_url of the first note in the thread. ↩︎