Skip to content

Environments and deployments

A project’s environments (create, read, update, stop and delete), the deployment records made to them (list, read, create, update, delete, the merge requests a deployment shipped, and approving or rejecting a deployment waiting at a manual gate), and the deploy freeze periods that block deployments on a schedule. Protected environments, which restrict who may deploy to an environment, are the actions served from Premium.

Stopping an environment runs its on-stop jobs, and force skips them; stopping and deleting are destructive.

  • “List the environments of project 42”
  • “What is deployed to production right now?”
  • “Add a deploy freeze over the end-of-year holidays”
  • “Approve the deployment waiting on production”
  • Dynamic, the default surface: call gitlab_execute_action with action set to the action’s ID, such as environment.create, and its parameters in params. gitlab_find_action finds an ID from a description of the task.
  • Meta (GITLAB_MCP_TOOL_SURFACE=meta): call gitlab_environment with action set to the action’s name, such as create, and its parameters in params.
  • Individual (GITLAB_MCP_TOOL_SURFACE=individual): call the action’s own tool, such as gitlab_environment_create, with its parameters as the arguments.

How many of these actions an instance serves at each tier, out of a total of 23:

  • Free: 18
  • Premium: 23
  • Ultimate: 23

Read-only actions: 9 of 23, the ones a deployment in read-only mode keeps.

The description of each action, and of each of its parameters, is the text the server serves for it on the default surface, quoted as served. A destructive action runs only once confirmed, unless GITLAB_MCP_YOLO_MODE (or AUTOPILOT) skips that step: the dynamic surface needs confirm: true on gitlab_execute_action, and the other two take a confirm parameter or the client’s prompt (Destructive actions).

ActionTierIndividual
environment.createFreegitlab_environment_create
environment.deleteFreegitlab_environment_delete
environment.deployment_approve_or_rejectFreegitlab_deployment_approve_or_reject
environment.deployment_createFreegitlab_deployment_create
environment.deployment_deleteFreegitlab_deployment_delete
environment.deployment_getFreegitlab_deployment_get
environment.deployment_listFreegitlab_deployment_list
environment.deployment_merge_requestsFreegitlab_list_deployment_merge_requests
environment.deployment_updateFreegitlab_deployment_update
environment.freeze_createFreegitlab_create_freeze_period
environment.freeze_deleteFreegitlab_delete_freeze_period
environment.freeze_getFreegitlab_get_freeze_period
environment.freeze_listFreegitlab_list_freeze_periods
environment.freeze_updateFreegitlab_update_freeze_period
environment.getFreegitlab_environment_get
environment.listFreegitlab_environment_list
environment.protected_getPremiumgitlab_protected_environment_get
environment.protected_listPremiumgitlab_protected_environment_list
environment.protected_protectPremiumgitlab_protected_environment_protect
environment.protected_unprotectPremiumgitlab_protected_environment_unprotect
environment.protected_updatePremiumgitlab_protected_environment_update
environment.stopFreegitlab_environment_stop
environment.updateFreegitlab_environment_update

Create an environment in a project. Use when introducing new runtime targets such as review, staging, or production environments.

  • Meta-tool: gitlab_environment, action create
  • Individual tool: gitlab_environment_create
  • Tier: Free
  • Behavior: writes, not idempotent
ParameterTypeMandatoryDescription
namestringyesEnvironment name (e.g. production, staging)
project_idstring/integeryesProject ID or URL-encoded path
auto_stop_settingstring (always, with_action)noAuto-stop behavior: always or with_action
cluster_agent_idintegernoID of the cluster agent to associate with this environment
descriptionstringnoDescription of the environment
external_urlstringnoURL of the environment’s external deployment
flux_resource_pathstringnoFlux resource path used to track the environment’s deployment status
kubernetes_namespacestringnoKubernetes namespace for the cluster agent
tierstring (production, staging, testing, development, other)noDeployment tier: production, staging, testing, development, other

Delete a stopped environment from a project. Returns: a success confirmation naming the deleted environment. See also: environment.stop, environment.list, environment.get.

  • Meta-tool: gitlab_environment, action delete
  • Individual tool: gitlab_environment_delete
  • Tier: Free
  • Behavior: writes, destructive (needs confirmation), idempotent
ParameterTypeMandatoryDescription
environment_idintegeryesEnvironment ID
project_idstring/integeryesProject ID or URL-encoded path

Approve or reject a blocked deployment awaiting protected-environment approval, optionally with a comment and an approval rule to represent. Returns: a confirmation message naming the deployment and the applied status. See also: environment.deployment_get, environment.deployment_update.

  • Meta-tool: gitlab_environment, action deployment_approve_or_reject
  • Individual tool: gitlab_deployment_approve_or_reject
  • Tier: Free
  • Behavior: writes, idempotent
ParameterTypeMandatoryDescription
deployment_idintegeryesDeployment ID
project_idstring/integeryesProject ID or URL-encoded path
statusstring (approved, rejected)yesApproval status: approved or rejected
commentstringnoOptional comment for the approval or rejection
represented_asstringnoName of the approval rule to act as, when the user belongs to multiple approval rules

Create a deployment record for an environment at a given ref and sha with an initial status. Returns: the created deployment with id, iid, ref, sha, status, and nested user, environment, and deployable objects. See also: environment.get, environment.deployment_list, environment.deployment_update.

  • Meta-tool: gitlab_environment, action deployment_create
  • Individual tool: gitlab_deployment_create
  • Tier: Free
  • Behavior: writes, not idempotent
ParameterTypeMandatoryDescription
environmentstringyesName of the environment to deploy to
project_idstring/integeryesProject ID or URL-encoded path
refstringyesGit branch or tag to deploy
shastringyesGit SHA to deploy
statusstring (running, success, failed, canceled)noInitial deployment status: running or success or failed or canceled. GitLab 19 rejects created when creating a deployment
tagbooleannoWhether the ref is a tag. GitLab 19 requires this explicitly: pass false for branch refs and true for tag refs (default: false)

Delete a deployment record by deployment_id within a project. Returns: a confirmation that the deployment was deleted. See also: environment.deployment_get, environment.deployment_list.

  • Meta-tool: gitlab_environment, action deployment_delete
  • Individual tool: gitlab_deployment_delete
  • Tier: Free
  • Behavior: writes, destructive (needs confirmation), idempotent
ParameterTypeMandatoryDescription
deployment_idintegeryesDeployment ID
project_idstring/integeryesProject ID or URL-encoded path

Get one deployment by deployment_id for a project. Use when investigating a specific deployment state, environment, or actor metadata.

  • Meta-tool: gitlab_environment, action deployment_get
  • Individual tool: gitlab_deployment_get
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
deployment_idintegeryesDeployment ID
project_idstring/integeryesProject ID or URL-encoded path

List deployments in a project with environment, status, and date filters plus offset or keyset pagination. Returns: matching deployments with ref, sha, status, user, environment, and deployable (CI job) objects, and pagination metadata. See also: environment.deployment_get, environment.list, pipeline.get.

  • Meta-tool: gitlab_environment, action deployment_list
  • Individual tool: gitlab_deployment_list
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
environmentstringnoFilter by environment name
finished_afterstringnoReturn deployments finished after this RFC3339 timestamp (GitLab 14+ only)
finished_beforestringnoReturn deployments finished before this RFC3339 timestamp (GitLab 14+ only)
order_bystring (id, iid, created_at, updated_at, finished_at, ref)noOrder by id or iid or created_at or updated_at or finished_at or ref (default: id)
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
sortstring (asc, desc)noSort order: asc or desc (default: asc)
statusstring (created, running, success, failed, canceled, blocked)noFilter by status: created or running or success or failed or canceled
updated_afterstringnoReturn deployments updated after this RFC3339 timestamp (GitLab < 14 only)
updated_beforestringnoReturn deployments updated before this RFC3339 timestamp (GitLab < 14 only)

List the merge requests associated with a deployment, with merge-request filtering (state, approval, author, assignee, draft, created date) and offset or keyset pagination. Returns: matching merge requests with full metadata (author, assignees, reviewers, labels, milestone, pipelines, time stats, timestamps) and pagination metadata. See also: merge_request.get, merge_request.list, environment.deployment_list.

  • Meta-tool: gitlab_environment, action deployment_merge_requests
  • Individual tool: gitlab_list_deployment_merge_requests
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
deployment_idintegeryesDeployment ID
project_idstring/integeryesProject ID or URL-encoded path
approved_by_idsinteger/string[]noFilter by MRs approved by all listed user IDs. Accepts user IDs, or exactly one of “Any” (approved by someone) or “None” (unapproved)
approved_by_usernamesstring[]noFilter by MRs approved by all listed usernames
approver_idsinteger/string[]noFilter by MRs with all listed users as eligible approvers. Accepts user IDs, or exactly one of “Any” (has approvers) or “None” (has none)
assignee_idintegernoFilter by assignee user ID
author_idintegernoFilter by author user ID
author_usernamestringnoFilter by author username
created_afterstringnoReturn MRs created after date (ISO 8601, e.g. 2025-01-01T00:00:00Z)
created_beforestringnoReturn MRs created before date (ISO 8601, e.g. 2025-12-31T23:59:59Z)
draftbooleannoFilter by draft status (true=only drafts, false=only non-drafts)
instringnoFields the search parameter matches. Accepts title, description, or both joined with a comma. Default is title,description
labelsstring[]noLabel names to filter by
milestonestringnoMilestone title to filter by
my_reaction_emojistringnoFilter by MRs the caller reacted to with this emoji (e.g. thumbsup)
non_archivedbooleannoReturn merge requests from non-archived projects only. Default is true
not_author_usernamestringnoExclude MRs authored by this username
not_labelsstring[]noLabel names to exclude
order_bystring (created_at, updated_at, merged_at, label_priority, priority, milestone_due, popularity, title)noOrder by: created_at, updated_at, merged_at, label_priority, priority, milestone_due, popularity, or title (default created_at)
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
reviewer_idintegernoFilter by reviewer user ID
reviewer_usernamestringnoFilter by reviewer username
scopestring (created_by_me, assigned_to_me, reviews_for_me, all)noFilter by scope: created_by_me, assigned_to_me, reviews_for_me, or all
searchstringnoSearch in title and description
sortstring (asc, desc)noSort order: asc or desc
source_branchstringnoFilter by source branch name
statestring (opened, closed, locked, merged, all)noFilter by state: opened, closed, locked, merged, or all (default all)
target_branchstringnoFilter by target branch name
updated_afterstringnoReturn MRs updated after date (ISO 8601, e.g. 2025-01-01T00:00:00Z)
updated_beforestringnoReturn MRs updated before date (ISO 8601, e.g. 2025-12-31T23:59:59Z)
wipstringnoFilter by draft/WIP status: ‘yes’ for draft MRs, ‘no’ for non-draft

Update a deployment’s status by deployment_id within a project. Returns: the updated deployment with id, iid, ref, sha, status, and nested user, environment, and deployable objects. See also: environment.deployment_get, environment.deployment_list, environment.deployment_approve_or_reject.

  • Meta-tool: gitlab_environment, action deployment_update
  • Individual tool: gitlab_deployment_update
  • Tier: Free
  • Behavior: writes, idempotent
ParameterTypeMandatoryDescription
deployment_idintegeryesDeployment ID
project_idstring/integeryesProject ID or URL-encoded path
statusstring (running, success, failed, canceled)yesNew deployment status: running or success or failed or canceled

Create a deploy freeze period for a project. Returns: the created freeze period with id, freeze_start/freeze_end cron expressions, and cron_timezone.

  • Meta-tool: gitlab_environment, action freeze_create
  • Individual tool: gitlab_create_freeze_period
  • Tier: Free
  • Behavior: writes, not idempotent
ParameterTypeMandatoryDescription
freeze_endstringyesCron expression for freeze end (e.g. 0 7 * * 1)
freeze_startstringyesCron expression for freeze start (e.g. 0 23 * * 5)
project_idstring/integeryesProject ID or URL-encoded path
cron_timezonestringnoTimezone for cron expressions (e.g. America/New_York)

Delete a deploy freeze period. Returns: no content on success (HTTP 204).

  • Meta-tool: gitlab_environment, action freeze_delete
  • Individual tool: gitlab_delete_freeze_period
  • Tier: Free
  • Behavior: writes, destructive (needs confirmation), idempotent
ParameterTypeMandatoryDescription
freeze_period_idintegeryesFreeze period ID
project_idstring/integeryesProject ID or URL-encoded path

Get a specific deploy freeze period. Returns: the freeze period’s id, freeze_start/freeze_end cron expressions, cron_timezone, and created/updated timestamps.

  • Meta-tool: gitlab_environment, action freeze_get
  • Individual tool: gitlab_get_freeze_period
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
freeze_period_idintegeryesFreeze period ID
project_idstring/integeryesProject ID or URL-encoded path

List deploy freeze periods for a project. Returns: each freeze period’s id, freeze_start/freeze_end cron expressions, cron_timezone, and created/updated timestamps.

  • Meta-tool: gitlab_environment, action freeze_list
  • Individual tool: gitlab_list_freeze_periods
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
order_bystringnoColumn to order results by
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
sortstring (asc, desc)noSort direction (asc, desc)

Update an existing deploy freeze period. Returns: the updated freeze period with id, freeze_start/freeze_end cron expressions, and cron_timezone.

  • Meta-tool: gitlab_environment, action freeze_update
  • Individual tool: gitlab_update_freeze_period
  • Tier: Free
  • Behavior: writes, idempotent
ParameterTypeMandatoryDescription
freeze_period_idintegeryesFreeze period ID
project_idstring/integeryesProject ID or URL-encoded path
cron_timezonestringnoTimezone for cron expressions
freeze_endstringnoCron expression for freeze end
freeze_startstringnoCron expression for freeze start

Get one environment by environment_id. Use when inspecting state, tier, external URL, and stop behavior of a specific environment.

  • Meta-tool: gitlab_environment, action get
  • Individual tool: gitlab_environment_get
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
environment_idintegeryesEnvironment ID
project_idstring/integeryesProject ID or URL-encoded path

List environments in one project with filters and pagination. Use this to discover environment IDs before get/update/stop/delete operations.

  • Meta-tool: gitlab_environment, action list
  • Individual tool: gitlab_environment_list
  • Tier: Free
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
namestringnoFilter by exact environment name
order_bystringnoColumn to order results by (e.g. id, name)
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
searchstringnoSearch environments by name (fuzzy)
sortstring (asc, desc)noSort order: asc or desc
statesstring (available, stopping, stopped)noFilter by state: available, stopping, stopped

Get a single protected (or wildcard) environment by name. Returns: the environment with its deploy access levels (id, access level, user/group, group inheritance) and approval rules. See also: environment.protected_list, environment.protected_update, environment.protected_unprotect.

  • Meta-tool: gitlab_environment, action protected_get
  • Individual tool: gitlab_protected_environment_get
  • Tier: Premium
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
environmentstringyesEnvironment name
project_idstring/integeryesProject ID or URL-encoded path

List protected environments in a project with order_by/sort and offset or keyset pagination. Returns: protected environments with their deploy access levels, required approval count, approval rules, and pagination metadata. See also: environment.protected_get, environment.protected_protect, environment.list.

  • Meta-tool: gitlab_environment, action protected_list
  • Individual tool: gitlab_protected_environment_list
  • Tier: Premium
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
order_bystringnoColumn to order keyset-paginated results by
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
sortstring (asc, desc)noSort direction (asc, desc)

Protect a single environment or wildcard with deploy access levels and approval rules. Returns: the newly protected environment with its deploy access levels, required approval count, and approval rules. See also: environment.protected_get, environment.protected_update, environment.protected_unprotect.

  • Meta-tool: gitlab_environment, action protected_protect
  • Individual tool: gitlab_protected_environment_protect
  • Tier: Premium
  • Behavior: writes, not idempotent
ParameterTypeMandatoryDescription
deploy_access_levelsobject[]yesDeploy access levels
namestringyesEnvironment name to protect
project_idstring/integeryesProject ID or URL-encoded path
approval_rulesobject[]noApproval rules
required_approval_countintegernoRequired number of approvals

Unprotect a single environment or wildcard, removing its deployment gates. Returns: a success confirmation naming the unprotected environment. See also: environment.protected_list, environment.protected_protect.

  • Meta-tool: gitlab_environment, action protected_unprotect
  • Individual tool: gitlab_protected_environment_unprotect
  • Tier: Premium
  • Behavior: writes, destructive (needs confirmation), idempotent
ParameterTypeMandatoryDescription
environmentstringyesEnvironment name to unprotect
project_idstring/integeryesProject ID or URL-encoded path

Update a protected environment’s deploy access levels and approval rules (use _destroy to remove an entry). Returns: the updated environment with its deploy access levels, required approval count, and approval rules. See also: environment.protected_get, environment.protected_protect, environment.protected_unprotect.

  • Meta-tool: gitlab_environment, action protected_update
  • Individual tool: gitlab_protected_environment_update
  • Tier: Premium
  • Behavior: writes, idempotent
ParameterTypeMandatoryDescription
environmentstringyesEnvironment name
project_idstring/integeryesProject ID or URL-encoded path
approval_rulesobject[]noUpdated approval rules
deploy_access_levelsobject[]noUpdated deploy access levels
namestringnoNew environment name
required_approval_countintegernoRequired number of approvals

Stop an active environment. This is modeled as a delete-style action but intentionally marked non-destructive because it changes runtime state without deleting the environment resource.

  • Meta-tool: gitlab_environment, action stop
  • Individual tool: gitlab_environment_stop
  • Tier: Free
  • Behavior: writes, destructive (needs confirmation), idempotent
ParameterTypeMandatoryDescription
environment_idintegeryesEnvironment ID
project_idstring/integeryesProject ID or URL-encoded path
forcebooleannoForce stop even if environment has active deployments

Update an existing environment in a project. Returns: the updated environment with state, tier, external URL, cluster agent, Kubernetes namespace, Flux resource path, and auto-stop settings. See also: environment.get, environment.list, environment.stop.

  • Meta-tool: gitlab_environment, action update
  • Individual tool: gitlab_environment_update
  • Tier: Free
  • Behavior: writes, idempotent
ParameterTypeMandatoryDescription
environment_idintegeryesEnvironment ID
project_idstring/integeryesProject ID or URL-encoded path
auto_stop_settingstring (always, with_action)noAuto-stop behavior: always or with_action
cluster_agent_idintegernoID of the cluster agent to associate with this environment
descriptionstringnoUpdated description
external_urlstringnoUpdated external URL
flux_resource_pathstringnoFlux resource path used to track the environment’s deployment status
kubernetes_namespacestringnoKubernetes namespace for the cluster agent
namestringnoNew environment name
tierstring (production, staging, testing, development, other)noUpdated tier: production, staging, testing, development, other