---
title: "corestack_deployments_secret_set"
url: https://docs.corefinity.com/mcp/tools/corestack_deployments_secret_set
type: tool
last_updated: 2026-11-13
feature: deployment-variables
related:
  - https://docs.corefinity.com/api/reference/deployments/create-site-deployment-secret.md
  - https://docs.corefinity.com/guides/sites/code-and-deployments/variables-and-secrets.md
---
# corestack_deployments_secret_set

**Set a registry secret.** Add or change an npm or Composer registry secret the environment's builds install with (secret_id updates one), and optionally verify it with the registry. The token is write-only. Scope: write.

- Scope: `write`
- Runs as a task: no

## When to use it

Add or change an npm or Composer registry secret the environment's builds install with, and optionally verify it with the registry. Without `secret_id` it creates one (`kind`, `registry`, `token`); with it, it changes what you send; `secret_id` with `verify: true` alone verifies a stored one. The token and username are write-only.

The same action in the public REST API, with the same checks, refusals and scope: `POST /api/corestack/sites/{site}/deployments/secrets` (a new secret) and `PUT /api/corestack/sites/{site}/deployments/secrets/{secret}` (`secret_id`).

## Inputs

- `site_id` (integer, ≥ 1, required)
- `secret_id` (integer, ≥ 1): Update this secret.
- `kind` (string, one of `npm`, `composer`): On create.
- `label` (string)
- `registry` (string): npm: an https:// URL; Composer: the host.
- `scope` (string, at most 214 characters): npm: @scope.
- `auth_type` (string, one of `http-basic`, `bearer`, `github-oauth`, `gitlab-token`): Composer.
- `username` (string): Composer http-basic.
- `token` (string)
- `verify` (boolean): Ask the registry once.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "auth_type": {
      "description": "Composer.",
      "enum": [
        "http-basic",
        "bearer",
        "github-oauth",
        "gitlab-token"
      ],
      "type": "string"
    },
    "kind": {
      "description": "On create.",
      "enum": [
        "npm",
        "composer"
      ],
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "registry": {
      "description": "npm: an https:// URL; Composer: the host.",
      "type": "string"
    },
    "scope": {
      "description": "npm: @scope.",
      "maxLength": 214,
      "type": "string"
    },
    "secret_id": {
      "description": "Update this secret.",
      "minimum": 1,
      "type": "integer"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "token": {
      "type": "string"
    },
    "username": {
      "description": "Composer http-basic.",
      "type": "string"
    },
    "verify": {
      "description": "Ask the registry once.",
      "type": "boolean"
    }
  },
  "required": [
    "site_id"
  ],
  "type": "object"
}
```

## Refusals

- `exists`: a secret for that registry and scope is already saved; update it with its `secret_id` (in `details.id`).
- `secret_invalid`: the registry is not an HTTPS address on the public internet, or a field is not valid.
- `upstream_unavailable`: the registry could not be asked; try again later.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_deployments_secret_set",
  "arguments": {
    "site_id": 4211,
    "kind": "npm",
    "label": "GitHub Packages",
    "registry": "https://npm.pkg.github.com",
    "scope": "@acme",
    "token": "<the registry token>",
    "verify": true
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_deployments_secret_set with site_id 4211, kind npm, label GitHub Packages, registry https://npm.pkg.github.com, scope @acme, token <the registry token>, verify true. (Set a registry secret.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/deployments/secrets](https://docs.corefinity.com/api/reference/deployments/create-site-deployment-secret.md)
- Guide: [Variables](https://docs.corefinity.com/guides/sites/code-and-deployments/variables-and-secrets.md)
