---
title: "corestack_external_db_sources_set"
url: https://docs.corefinity.com/mcp/tools/corestack_external_db_sources_set
type: tool
last_updated: 2026-11-13
feature: database
related:
  - https://docs.corefinity.com/api/reference/database/replace-site-external-database-sources.md
  - https://docs.corefinity.com/guides/sites/database/database-users.md
---
# corestack_external_db_sources_set

**Set the allowed addresses.** Replace the addresses allowed to reach an environment's external database access (the whole list: send every address to keep). Public IPv4 addresses or blocks from /32 to /28, at most 10. Scope: write. Long-running: answers with a task.

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

## When to use it

Replace the list of addresses allowed to reach an environment's external database access: add an outside system's new address, or remove one that is no longer used. Send the whole list each time, every address to keep included (read it with corestack_external_db_get). The change applies within about a minute, and the firewall, the database proxy and the network policy all take the same list.

The list is never empty while access is on: there is no database open to the whole internet. To stop all outside access, turn it off with corestack_external_db_disable.

## Inputs

- `site_id` (integer, ≥ 1, required)
- `sources` (array of 0–10 objects, required): each `{"cidr": "203.0.113.10/32", "label": "Order system"}`: a public IPv4 address or block from /32 to /28, written from its first address.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "sources": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "cidr": {
            "description": "A public IPv4 address or block from /32 to /28, e.g. 203.0.113.10/32.",
            "type": "string"
          },
          "label": {
            "description": "What the address is, e.g. \"Order system\".",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "cidr"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "site_id",
    "sources"
  ],
  "type": "object"
}
```

## Refusals

- `invalid_arguments`: an address breaks the rules, a duplicate, more than 10, or an empty list while access is on; `fields` names each.
- `external_db_unchanged`: the list is already exactly this.
- `external_db_not_on`: external access is not on; send the addresses with corestack_external_db_enable.
- `external_db_failed`: the last change to external access failed; Corefinity support retries or releases it.
- `busy`: another change to this environment is applying.
- `deleted`: the site is deleted (in its grace period).
- `provisioning`: the site is still being created.
- `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_external_db_sources_set",
  "arguments": {
    "site_id": 4211,
    "sources": [
      {
        "cidr": "203.0.113.10/32",
        "label": "Order system"
      },
      {
        "cidr": "198.51.100.64/29",
        "label": "Reporting"
      }
    ]
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_external_db_sources_set with site_id 4211, sources [{"cidr":"203.0.113.10/32","label":"Order system"},{"cidr":"198.51.100.64/29","label":"Reporting"}]. (Set the allowed addresses.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [PUT /api/corestack/sites/{site}/external-db/sources](https://docs.corefinity.com/api/reference/database/replace-site-external-database-sources.md)
- Guide: [Database users](https://docs.corefinity.com/guides/sites/database/database-users.md)
