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.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | URL of the project. Provide exactly one of url or project_id. |
project_id | string | No | ID or full path of the project. Provide exactly one of url or project_id. |
include | array | No | Facet 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the project. |
path | string | No | URL slug for the project. Defaults to a slugified name. |
namespace_id | integer | No | ID of the namespace (group or user) to create the project in. |
namespace_path | string | No | Full path of the namespace. Alternative to namespace_id; provide one or the other. |
description | string | No | Description of the project. |
visibility | string | No | Visibility level: private, internal, or public. Defaults to the instance’s default project visibility. |
initialize_with_readme | boolean | No | Create an initial README.md file. |
default_branch | string | No | Default branch name. Defaults to the instance default. |
topics | array of strings | No | List of topics (tags) for the project. |
template_name | string | No | Name of a project template. For built-in templates (like rails, spring, express), use alone. For custom templates, use with use_custom_template. |
template_project_id | integer | No | Project ID of a custom template. Alternative to template_name. Use with use_custom_template. Premium and Ultimate only. |
use_custom_template | boolean | No | Use a custom project template. Requires template_name or template_project_id. Premium and Ultimate only. |
group_with_project_templates_id | integer | No | Group 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 groupget_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.
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | No | Username of the user to look up. |
id | integer | No | Numeric ID of the user to look up. |
me | boolean | No | Set 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | URL of the group. |
group_id | string | No | ID 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
group_id | string | No | ID or full path of a parent group to list subgroups of. Omit to list top-level groups where you are a member. |
search | string | No | Search groups by name or full path. |
visibility | string | No | Filter by visibility level: public, internal, or private. |
include_subgroups | boolean | No | Include all descendant subgroups recursively instead of direct children only. |
after | string | No | Cursor for forward pagination. |
first | integer | No | Number of groups to return for forward pagination. Default is 20, maximum is 100. |
Example:
List the subgroups of gitlab-orglist_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.
| Parameter | Type | Required | Description |
|---|---|---|---|
group_id | string | No | ID 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_level | string | No | Minimum access level a project must grant you to be included. One of guest, planner, reporter, developer, maintainer, or owner. |
search | string | No | Search projects by name, path, or description. |
visibility | string | No | Filter by visibility level: public, internal, or private. |
archived | string | No | Filter by archived state: only, include, or exclude (default). |
after | string | No | Cursor for forward pagination. |
first | integer | No | Number 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 projectslist_project_members
Lists the members of a GitLab project with their role and access level.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | Full path or numeric ID of the project (for example, gitlab-org/gitlab or 278964). |
include_inherited | boolean | No | Also return members who inherit their role from a parent group or a subgroup of the project. Defaults to false. |
query | string | No | Return only members whose name or username contains this text. |
first | integer | No | Number of members to return for forward pagination (default 20, maximum 100). |
after | string | No | Cursor 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
state | string | No | Filter by state: pending or done. Default is pending. |
action | string | No | Filter by the action that created the to-do item, for example review_requested, assigned, or mentioned. |
type | string | No | Filter by the type of the to-do item target, for example MERGEREQUEST, ISSUE, or WORKITEM. |
author_id | integer | No | Filter by the numeric ID of the user who created the to-do item. To look up a user ID, use get_user. |
project_id | string | No | Filter by project. ID or full path of the project. |
group_id | string | No | Filter by group. ID or full path of the group. |
first | integer | No | Number of to-do items to return for forward pagination. Default is 20, maximum is 100. |
after | string | No | Cursor 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, andcreatedAt nameandiidof its target intargetEntity- 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | ID or username of the user. |
action | string | No | Filter events by action type. |
target_type | string | No | Filter events by target type. |
before | string | No | Return events created before the specified date (YYYY-MM-DD). |
after | string | No | Return events created after the specified date (YYYY-MM-DD). |
sort | string | No | Sort results in ascending (asc) or descending (desc) order by creation date. |
page | integer | No | Page number for pagination. |
per_page | integer | No | Number of events to return per page. |
Example:
List recent events for user john_doelist_milestones
Lists milestones in a GitLab project or group.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | GitLab URL of the project or group. Provide exactly one of url, project_id, or group_id. |
project_id | string | No | ID or full path of the project. Provide exactly one of url, project_id, or group_id. |
group_id | string | No | ID or full path of the group. Provide exactly one of url, project_id, or group_id. |
state | string | No | Filter milestones by state (active or closed). If omitted, returns milestones of all states. |
search | string | No | Search string to filter milestones by title. |
include_ancestors | boolean | No | Include milestones from parent groups. For a project, includes milestones from the project’s parent group and its ancestors. |
include_descendants | boolean | No | Include milestones from subgroups and their projects. Applies only to a group. |
first | integer | No | Number of milestones to return after the cursor (forward pagination). Maximum 100. |
after | string | No | Cursor for forward pagination of milestones. Use pageInfo.endCursor from a previous response. |
Example:
List the open milestones in project gitlab-org/gitlabsave_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.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | URL of the merge request or work item. The URL determines the target type. |
project_id | string | No | ID or path of the project. Required with merge_request_iid, and with work_item_iid for project-level work items. |
group_id | string | No | ID or path of the group. Required with work_item_iid for group-level work items. |
merge_request_iid | integer | No | Internal ID of the merge request. Provide with project_id. Mutually exclusive with work_item_iid. |
work_item_iid | integer | No | Internal ID of the work item. Provide with project_id or group_id. Mutually exclusive with merge_request_iid. |
method | string | No | The 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. |
body | string | No | Content of the note. Required for create_note and reply_discussion. Lines cannot start with / to avoid triggering quick actions (for example, /merge). |
internal | boolean | No | Marks the note as internal (visible only to members with at least the Reporter role). Default is false. |
discussion_id | string | No | Discussion 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. |
resolved | boolean | No | true 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/gitlabComment on a work item:
Add a comment "This looks good to me" to work item 42 in project gitlab-org/gitlabResolve a discussion on a work item:
Resolve the open discussion about the acceptance criteria on work item 42 in project gitlab-org/gitlab
search
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | Yes | Search scope (for example, work_items, merge_requests, or projects). |
search | string | Yes | Search term. |
group_id | string | No | ID or full path of the group you want to search. |
project_id | string | No | ID or full path of the project you want to search. |
state | string | No | State of search results (for work_items and merge_requests). |
confidential | boolean | No | Filters results by confidentiality (for work_items). Default is false. |
fields | array of strings | No | Array of fields you want to search (for work_items and merge_requests). |
order_by | string | No | Attribute to order results by. Default is created_at for basic search and relevance for advanced search. |
sort | string | No | Sort direction for results. Default is desc. |
per_page | integer | No | Number of results per page. Default is 20. |
page | integer | No | Current page number. Default is 1. |
Example:
Search issues for "flaky test" across GitLabsearch_labels
Searches for labels in a GitLab project or group.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | No | ID or path of the project. Alternative to group_id or full_path. |
group_id | string | No | ID or path of the group. Alternative to project_id or full_path. |
full_path | string | No | Full path of the project or group (for example, group/project). Alternative to project_id or group_id. Requires is_project. |
is_project | boolean | No | Whether full_path is a project (true) or group (false). Required with full_path. |
search | string or array of strings | No | One 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/gitlabsemantic_search
- 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
scope | string | No | Type of content to search. Only code is supported. If omitted, code is used. |
query | string | No | Natural language search query. Required if q is not set. |
q | string | No | Same as query. Required if query is not set. If both are set, query is used. |
project_id | string | Yes | ID or full path of the project. |
directory_path | string | No | Restricts 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. |
knn | integer | No | Number 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. |
limit | integer | No | Maximum 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | GitLab Pages URL to read, for example https://mygroup.gitlab.io/myproject/docs/. |
byte_offset | integer | No | Byte offset to start reading the file from. Default is 0. Maximum is 20971520 (20 MB). |
byte_limit | integer | No | Maximum 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 sectionFor
resolve_discussion, the tool returns themethod, thediscussion_idas a global ID, the newresolvedstate, and theweb_urlof the first note in the thread. ↩︎