---
docId: doc_608185f3053148a5810a3cc768084641
title: Bind a secret to an MCP server
description: "Authorize an existing secret for an MCP server slot."
api:
  group: herramientas/servidores-mcp
  auth: bearer
  operations:
    - operationId: bindMcpServerSecret
      method: POST
      path: '/v1/tools/mcp/{mcpId}/secrets'
      postmanName: Bind a secret to an MCP server
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# Bind a secret to an MCP server

Bind an existing secret to a server slot. Use this when a slot in `secrets[]` is `missing` or `needs_authorization`. Send only the secret's `id`, not its value.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/tools/mcp/$MCP_ID/secrets \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "slot": "auth.token", "secretId": "'"$SECRET_ID"'" }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.tools.mcp.bindSecret("mcp_123", { slot: "auth.token", secretId: "secret_123" });
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `mcpId` | string | Id of the MCP server | ✓ |

## Request body

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `slot` | string | The slot, as it appears in `secrets[].slot`: `auth.token`, `header:<name>` (for example `header:x-api-key`), or `auth.clientSecret` | ✓ |
| `secretId` | string | Id of the secret, from [list secrets](/api-reference/secrets/list) or [create a secret](/api-reference/secrets/create) | ✓ |

```json
{
  "slot": "auth.token",
  "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
}
```

## Response

`data` has the full server, with the fields in [get an MCP server](/api-reference/mcp-servers/get#response-fields). The slot ends up `authorized`.

```json
{
  "status": "success",
  "message": "Secret bound successfully",
  "data": {
    "id": "QZPHpckDPC58JIVLQA3Z",
    "name": "Linear",
    "description": "Support team issues",
    "url": "https://mcp.linear.app/mcp",
    "transport": "streamable-http",
    "slug": "a1b2c3",
    "authType": "bearer",
    "auth": { "type": "bearer" },
    "status": "pending_config",
    "lastError": null,
    "serverInfo": null,
    "customHeaderNames": [],
    "discoveredToolsCount": 0,
    "installedToolsCount": 0,
    "lastSyncAt": null,
    "createdAt": "2026-10-28T12:02:11.410Z",
    "updatedAt": "2026-10-28T12:04:30.000Z",
    "version": 1,
    "verified": false,
    "secrets": [
      {
        "slot": "auth.token",
        "state": "authorized",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "discoveredTools": [],
    "installedTools": [],
    "nextStep": "Test the connection with POST /v1/tools/mcp/QZPHpckDPC58JIVLQA3Z/test: that is when the server lists the tools it offers."
  }
}
```

## Errors

<Collapsible summary="Show error codes and fixes">

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | `slot` or `secretId` is missing. `details.issues` has the list of problems |
| `400` | `SECRET_SLOT_INVALID` | That slot does not exist in the server's current connection |
| `400` | `SECRET_DESTINATION_INVALID` | The server URL is not `https` or is not valid |
| `403` | `FORBIDDEN` | The person behind the token cannot use secrets or does not have access to Integrations |
| `404` | `SECRET_NOT_FOUND` | The secret does not exist in this workspace |
| `404` | `NOT_FOUND` | The server does not exist in this workspace |
| `409` | `SECRET_USE_REVOKED` | The secret is revoked or expired |
| `409` | `SECRET_CHANGED` | The secret changed while it was being bound. Repeat the call |
| `409` | `RESOURCE_CHANGED` | The server changed while it was being bound. Repeat the call |
| `409` | `SECRET_BINDING_LIMIT` | The server already has the maximum number of bound secrets |

</Collapsible>

## Notes

- After binding, use [test an MCP server](/api-reference/mcp-servers/test).
- The secret is authorized for that slot and for the server's current destination. If you later [update](/api-reference/mcp-servers/update) the connection, the slot goes to `needs_authorization` and you have to repeat this call.
- Binding another secret to a slot that already had one replaces it, and the previous test stops counting.
- An OAuth server is not authorized with a bound token: use [start OAuth](/api-reference/mcp-servers/start-oauth).
- To bind at the same time as you save, send `"secrets": { "<slot>": "<secretId>" }` in [connect an MCP server](/api-reference/mcp-servers/connect) or in [update an MCP server](/api-reference/mcp-servers/update).
