> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DNS

A target on an Agent Gateway instance can be a hostname from the user's own DNS, such as `orders.corp.internal`, instead of an IP address. The instance's [*Network*](https://developers.telnyx.com/docs/network/overview.md) needs two things for the hostname to resolve.

* The *Network*'s [DNS resolver](https://developers.telnyx.com/docs/network/dns.md) forwards the user's zone, here `corp.internal`, to the user's DNS. [Forward a Zone](https://developers.telnyx.com/docs/network/dns/users-names.md#forward-a-zone) sets this up.
* The user's DNS is routable on the *Network*, as a [WireGuard peer](https://developers.telnyx.com/docs/agent-gateway/vpc/wireguard-peers/target-as-peer.md) or behind a [subnet router](https://developers.telnyx.com/docs/agent-gateway/vpc/wireguard-peers/subnet-router.md) or a [Tunnel](https://developers.telnyx.com/docs/agent-gateway/vpc/tunnel.md).

## Add the Target

[`POST /v2/agent_gateways/{id}/mcp_servers`](https://developers.telnyx.com/api-reference/agent-gateway-mcp-servers/add-an-mcp-server) adds the target by its hostname, open to [every key](https://developers.telnyx.com/docs/agent-gateway/authorization/tool-permissions.md) on the instance:

```json theme={null}
{
  "name": "orders",
  "url": "http://orders.corp.internal:9000/mcp",
  "auth": { "type": "api_key", "value": "example-orders-key" },
  "open_to_every_key": true
}
```

The instance resolves the hostname through the *Network*'s [DNS resolver](https://developers.telnyx.com/docs/network/dns.md) and sends the request to the address the user's DNS answered. The same works for an [API](https://developers.telnyx.com/docs/agent-gateway/targets/tools.md#apis) with a hostname in its `base_url`, and for a target that is a [private function](https://developers.telnyx.com/docs/edge-compute/private-ingress.md), by its private name.

A target added later in the same zone needs no change on Telnyx. A DNS resolver added after the instance takes effect with no recreate.

## Reach the Target over HTTPS

`POST /v2/agent_gateways/{id}/ca_certificates` adds the user's CA to the instance:

```json theme={null}
{
  "name": "corp-ca",
  "certificate": "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----\n"
}
```

The response carries the certificate's fingerprint and expiry:

```json Output theme={null}
{
  "data": {
    "id": "57be77cf-dd91-4fe6-8465-7f9d92bfec59",
    "name": "corp-ca",
    "certificate": "-----BEGIN CERTIFICATE-----\nMIID...\n-----END CERTIFICATE-----\n",
    "fingerprint_sha256": "5c3c0c7191c913a6bce4e51d80719f4efb5f2e21b82851d5342e888231a59a15",
    "expires_at": "2026-12-27T05:53:58Z",
    "created_at": "2026-11-27T05:54:39.871738Z"
  }
}
```

The target is then added with an `https` URL:

```json theme={null}
{
  "name": "orders",
  "url": "https://orders.corp.internal:9443/mcp",
  "auth": { "type": "api_key", "value": "example-orders-key" },
  "open_to_every_key": true
}
```

The instance validates the target's certificate against the CAs on the instance and refuses a target whose certificate chains to none of them. A certificate from a public CA needs no entry.
