Ir al contenido

Variables de CI/CD

Variables de CI/CD en los tres ámbitos en los que GitLab las guarda: un proyecto, un grupo y la instancia, cada uno con las mismas cinco operaciones. Una variable puede ser protegida, enmascarada o enmascarada y oculta, y las de proyecto y de grupo pueden limitarse a un entorno, así que una clave puede tener un valor distinto en cada entorno. Las variables de instancia necesitan un administrador, y borrar una variable no se puede deshacer.

  • “Lista las variables de CI/CD del proyecto 42”
  • “Añade una variable enmascarada DEPLOY_TOKEN limitada a production”
  • “¿Qué variables de grupo define el grupo platform?”
  • Dinámica, la superficie predeterminada: llama a gitlab_execute_action con action igual al ID de la acción, como ci_variable.create, y sus parámetros en params. gitlab_find_action encuentra un ID a partir de una descripción de la tarea.
  • Meta (GITLAB_MCP_TOOL_SURFACE=meta): llama a gitlab_ci_variable con action igual al nombre de la acción, como create, y sus parámetros en params.
  • Individual (GITLAB_MCP_TOOL_SURFACE=individual): llama a la herramienta propia de la acción, como gitlab_ci_variable_create, pasándole directamente sus parámetros.

Todos los niveles sirven el grupo completo, tanto en instancias autogestionadas como en GitLab.com.

Acciones de solo lectura: 6 de 15, las que conserva un despliegue en modo de solo lectura. A un token con read_api y sin api se le sirven 6 de las 15.

La descripción de cada acción, y la de cada uno de sus parámetros, es el texto que sirve el servidor para ella en la superficie predeterminada, citado tal cual; por eso está en inglés. Las líneas de token dicen lo que exige GitLab 19.4.1 a un token para las peticiones que envía cada acción; en una instancia con Admin Mode activado, una acción que solo puede ejecutar un administrador necesita además admin_mode. Una acción destructiva solo se ejecuta una vez confirmada, salvo que GITLAB_MCP_YOLO_MODE (o AUTOPILOT) se salte ese paso: la superficie dinámica necesita confirm: true en gitlab_execute_action, y las otras dos aceptan un parámetro confirm o la pregunta del cliente (Acciones destructivas).

AcciónIndividual
ci_variable.creategitlab_ci_variable_create
ci_variable.deletegitlab_ci_variable_delete
ci_variable.getgitlab_ci_variable_get
ci_variable.group_creategitlab_group_variable_create
ci_variable.group_deletegitlab_group_variable_delete
ci_variable.group_getgitlab_group_variable_get
ci_variable.group_listgitlab_group_variable_list
ci_variable.group_updategitlab_group_variable_update
ci_variable.instance_creategitlab_instance_variable_create
ci_variable.instance_deletegitlab_instance_variable_delete
ci_variable.instance_getgitlab_instance_variable_get
ci_variable.instance_listgitlab_instance_variable_list
ci_variable.instance_updategitlab_instance_variable_update
ci_variable.listgitlab_ci_variable_list
ci_variable.updategitlab_ci_variable_update

Create a CI/CD variable in a project with type, environment scope, and protected/masked/raw/masked_and_hidden flags. Returns: the created variable’s key, value (redacted when masked or hidden), type, flags, environment scope, and description. See also: ci_variable.list, ci_variable.get, ci_variable.update.

  • Meta-herramienta: gitlab_ci_variable, acción create
  • Herramienta individual: gitlab_ci_variable_create
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Create en proyecto (página de permisos)
  • Comportamiento: escribe, no idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
project_idstring/integersíProject ID or URL-encoded path
valuestringsíVariable value
descriptionstringnoVariable description
environment_scopestringnoEnvironment scope (default: *)
maskedbooleannoMask variable value in job logs
masked_and_hiddenbooleannoMask and hide variable value
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
variable_typestring (env_var, file)noVariable type: env_var or file

Delete a CI/CD variable by key, selecting an environment-scoped instance via the filter. Returns: a success confirmation message. See also: ci_variable.list, ci_variable.get.

  • Meta-herramienta: gitlab_ci_variable, acción delete
  • Herramienta individual: gitlab_ci_variable_delete
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Delete en proyecto (página de permisos)
  • Comportamiento: escribe, destructiva (necesita confirmación), idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
project_idstring/integersíProject ID or URL-encoded path
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object

Get a single CI/CD variable by key, optionally selecting an environment-scoped instance via the filter. Returns: the variable’s key, value (redacted when masked or hidden), type, protected/masked/hidden/raw flags, environment scope, and description. See also: ci_variable.list, ci_variable.update, ci_variable.delete.

  • Meta-herramienta: gitlab_ci_variable, acción get
  • Herramienta individual: gitlab_ci_variable_get
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en proyecto (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
project_idstring/integersíProject ID or URL-encoded path
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object

Create a CI/CD variable in a group with type, environment scope, and protected/masked/raw/masked_and_hidden flags. Returns: the created variable’s key, value, type, flags, environment scope, and description. See also: ci_variable.group_list, ci_variable.group_get, ci_variable.group_update.

  • Meta-herramienta: gitlab_ci_variable, acción group_create
  • Herramienta individual: gitlab_group_variable_create
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Create en grupo (página de permisos)
  • Comportamiento: escribe, no idempotente
ParámetroTipoRequeridoDescripción
group_idstring/integersíGroup ID or URL-encoded path
keystringsíVariable key name
valuestringsíVariable value
descriptionstringnoVariable description
environment_scopestringnoEnvironment scope (default: *)
maskedbooleannoMask variable value in job logs
masked_and_hiddenbooleannoMask and hide variable value
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
variable_typestring (env_var, file)noVariable type: env_var or file

Delete a group CI/CD variable by key, selecting an environment-scoped instance via the filter. Returns: a success confirmation message. See also: ci_variable.group_list, ci_variable.group_get.

  • Meta-herramienta: gitlab_ci_variable, acción group_delete
  • Herramienta individual: gitlab_group_variable_delete
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Delete en grupo (página de permisos)
  • Comportamiento: escribe, destructiva (necesita confirmación), idempotente
ParámetroTipoRequeridoDescripción
group_idstring/integersíGroup ID or URL-encoded path
keystringsíVariable key name
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object

Get a single group CI/CD variable by key, optionally selecting an environment-scoped instance via the filter. Returns: the variable’s key, value, type, protected/masked/hidden/raw flags, environment scope, and description. See also: ci_variable.group_list, ci_variable.group_update, ci_variable.group_delete.

  • Meta-herramienta: gitlab_ci_variable, acción group_get
  • Herramienta individual: gitlab_group_variable_get
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en grupo (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
group_idstring/integersíGroup ID or URL-encoded path
keystringsíVariable key name
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object

List a group’s CI/CD variables with order_by, sort, and offset or keyset pagination. Returns: each variable’s key, value, type, protected/masked/hidden/raw flags, environment scope, description, and pagination metadata. See also: ci_variable.group_get, ci_variable.group_create, ci_variable.group_update.

  • Meta-herramienta: gitlab_ci_variable, acción group_list
  • Herramienta individual: gitlab_group_variable_list
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en grupo (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
group_idstring/integersíGroup ID or URL-encoded path
order_bystringnoColumn by which to order keyset-paginated results
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoNext page of a keyset listing: the next_page_token of the previous response of this action, passed back unchanged. It carries the position and every filter of the listing as GitLab read them, and those are what the next page is asked with, whatever filters are sent beside it. Leave it empty for the first page.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost, and a keyset page names the next one in next_page_token rather than next_page.
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 for keyset-paginated results (asc, desc)

Update a group CI/CD variable, selecting an environment-scoped instance via the filter. Returns: the updated variable’s key, value, type, protected/masked/hidden/raw flags, environment scope, and description. See also: ci_variable.group_get, ci_variable.group_list, ci_variable.group_delete.

  • Meta-herramienta: gitlab_ci_variable, acción group_update
  • Herramienta individual: gitlab_group_variable_update
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Update en grupo (página de permisos)
  • Comportamiento: escribe, idempotente
ParámetroTipoRequeridoDescripción
group_idstring/integersíGroup ID or URL-encoded path
keystringsíVariable key name
descriptionstringnoUpdated variable description. Pass an empty string to remove it. Omit the field to leave it untouched
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object
maskedbooleannoMask variable value in job logs
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
valuestringnoUpdated variable value. Pass an empty string to empty it. Omit the field to leave it untouched
variable_typestring (env_var, file)noVariable type: env_var or file

Create an instance-level CI/CD variable with type and protected/masked/raw flags (admin-only). Returns: the created variable’s key, value (raw even when masked, because masking redacts CI job logs, not this API), type, flags, and description. See also: ci_variable.instance_list, ci_variable.instance_get, ci_variable.instance_update.

  • Meta-herramienta: gitlab_ci_variable, acción instance_create
  • Herramienta individual: gitlab_instance_variable_create
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Create en instancia (página de permisos)
  • Comportamiento: escribe, no idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
valuestringsíVariable value
descriptionstringnoVariable description
maskedbooleannoMask variable value in job logs
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
variable_typestring (env_var, file)noVariable type: env_var or file

Delete an instance-level CI/CD variable by key (admin-only). Returns: a success confirmation message. See also: ci_variable.instance_list, ci_variable.instance_get.

  • Meta-herramienta: gitlab_ci_variable, acción instance_delete
  • Herramienta individual: gitlab_instance_variable_delete
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Delete en instancia (página de permisos)
  • Comportamiento: escribe, destructiva (necesita confirmación), idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name

Get a single instance-level CI/CD variable by key (admin-only). Returns: the variable’s key, value (raw even when masked, because masking redacts CI job logs, not this API), type, protected/masked/raw flags, and description. See also: ci_variable.instance_list, ci_variable.instance_update, ci_variable.instance_delete.

  • Meta-herramienta: gitlab_ci_variable, acción instance_get
  • Herramienta individual: gitlab_instance_variable_get
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en instancia (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name

List instance-level CI/CD variables with order_by, sort, and offset or keyset pagination (admin-only). Returns: each variable’s key, value (raw even when masked, because masking redacts CI job logs, not this API), type, protected/masked/raw flags, description, and pagination metadata. See also: ci_variable.instance_get, ci_variable.instance_create, ci_variable.instance_update, ci_variable.instance_delete.

  • Meta-herramienta: gitlab_ci_variable, acción instance_list
  • Herramienta individual: gitlab_instance_variable_list
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en instancia (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
order_bystringnoColumn by which to order keyset-paginated results
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoNext page of a keyset listing: the next_page_token of the previous response of this action, passed back unchanged. It carries the position and every filter of the listing as GitLab read them, and those are what the next page is asked with, whatever filters are sent beside it. Leave it empty for the first page.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost, and a keyset page names the next one in next_page_token rather than next_page.
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 for keyset-paginated results (asc, desc)

Update an instance-level CI/CD variable by key, with type and protected/masked/raw flags (admin-only). Returns: the updated variable’s key, value (raw even when masked, because masking redacts CI job logs, not this API), type, protected/masked/raw flags, and description. See also: ci_variable.instance_get, ci_variable.instance_list, ci_variable.instance_delete.

  • Meta-herramienta: gitlab_ci_variable, acción instance_update
  • Herramienta individual: gitlab_instance_variable_update
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Update en instancia (página de permisos)
  • Comportamiento: escribe, idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
descriptionstringnoUpdated variable description. Pass an empty string to remove it. Omit the field to leave it untouched
maskedbooleannoMask variable value in job logs
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
valuestringnoUpdated variable value. Pass an empty string to empty it. Omit the field to leave it untouched
variable_typestring (env_var, file)noVariable type: env_var or file

List a project’s CI/CD variables with order_by, sort, and offset or keyset pagination. Returns: each variable’s key, type, protected/masked/hidden/raw flags, environment scope, description, and pagination metadata. See also: ci_variable.get, ci_variable.create, ci_variable.update.

  • Meta-herramienta: gitlab_ci_variable, acción list
  • Herramienta individual: gitlab_ci_variable_list
  • Nivel: Free
  • Token clásico u OAuth: read_api (o api)
  • Token de grano fino: Variable: Read en proyecto (página de permisos)
  • Comportamiento: solo lectura, idempotente
ParámetroTipoRequeridoDescripción
project_idstring/integersíProject ID or URL-encoded path
order_bystringnoColumn by which to order keyset-paginated results
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoNext page of a keyset listing: the next_page_token of the previous response of this action, passed back unchanged. It carries the position and every filter of the listing as GitLab read them, and those are what the next page is asked with, whatever filters are sent beside it. Leave it empty for the first page.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost, and a keyset page names the next one in next_page_token rather than next_page.
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 for keyset-paginated results (asc, desc)

Update a CI/CD variable, selecting an environment-scoped instance via the filter. Returns: the updated variable’s key, value (redacted when masked or hidden), type, protected/masked/hidden/raw flags, environment scope, and description. See also: ci_variable.get, ci_variable.list, ci_variable.delete.

  • Meta-herramienta: gitlab_ci_variable, acción update
  • Herramienta individual: gitlab_ci_variable_update
  • Nivel: Free
  • Token clásico u OAuth: api
  • Token de grano fino: Variable: Update en proyecto (página de permisos)
  • Comportamiento: escribe, idempotente
ParámetroTipoRequeridoDescripción
keystringsíVariable key name
project_idstring/integersíProject ID or URL-encoded path
descriptionstringnoUpdated variable description. Pass an empty string to remove it. Omit the field to leave it untouched
environment_scopestringnoFilter by environment scope (shorthand for filter.environment_scope)
filterobjectnoFilter selecting the variable by environment scope. Mirrors the GitLab variable filter object
maskedbooleannoMask variable value in job logs
protectedbooleannoOnly expose in protected branches/tags
rawbooleannoTreat variable value as raw string
valuestringnoUpdated variable value. Pass an empty string to empty it. Omit the field to leave it untouched
variable_typestring (env_var, file)noVariable type: env_var or file