# RevCent MCP Guide: `AddTrackingDomainToSite`

Brief MCP-focused guide for RevCent MCP clients and agents using the `AddTrackingDomainToSite` operation.

---

## Operation Summary

Operation:

```text
AddTrackingDomainToSite
```

Purpose:

```text
Attach a Tracking Domain to a RevCent Site so the custom domain can route to the main/live Site deployment.
```

Use this operation only after the user has confirmed both the Site and the Tracking Domain.

---

## Live Transaction Go-Live Gate

Attaching a Tracking Domain routes a public custom domain to the Site's main/live deployment. Do not call this operation while the Site is still being developed or tested, or before the user confirms that the Site is approved for customer traffic and the business is ready to officially process live transactions.

For first-time Site onboarding, follow the complete guide before reaching this go-live step:

```text
https://revcent.com/documentation/markdown/mcp/guide/BusinessOnboardingRevCentSite.md
```

After attachment, `GetSite` returns the live main-routing A record IP. The user must update the applicable hostname's A record at their domain registrar or authoritative DNS provider to that exact value. Do not substitute an A record used earlier for Tracking Domain validation, infer a value, or claim the domain is live before the user confirms the live record was applied and routing becomes active.

---

## When to Use

Good uses:

- attach a custom domain to a Site,
- route a Tracking Domain to the Site's live/main branch,
- prepare the user to point DNS at the returned A record IP,
- replace a "not configured" live routing state with a configured custom domain flow.

Do not use this operation to create a Tracking Domain, configure Tracking Domain SSL/DNS, retrieve Site status, or route the dev branch.

---

## Required Preparation

Before calling `AddTrackingDomainToSite`:

1. Identify the exact Site ID.
2. Identify the exact Tracking Domain ID.
3. Verify the Tracking Domain is ready to be used.
4. Confirm the Tracking Domain is not already in use by another Site.
5. Confirm with the user that this domain should route to the Site's live/main deployment.
6. Confirm the user is ready to direct customer traffic to the Site and officially process live transactions.
7. Explain that the user must update DNS at their domain registrar or authoritative DNS provider after attachment using the exact live A record returned by `GetSite`.

Use `GetTrackingDomains` or `GetTrackingDomain` when the Tracking Domain ID is not known.

---

## Input Schema

`AddTrackingDomainToSite` requires a path parameter and a JSON request body.

```json
{
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "tracking_domain": "YYYYYYYYYYYYYYYYYYYY"
}
```

### Required Fields

| Field | Location | Type | Required | Description |
|---|---|---:|---:|---|
| `site_id` | Path | `string` | Yes | A 20-character Site ID. |
| `tracking_domain` | Body | `string` | Yes | A 20-character Tracking Domain ID. |

### Important Schema Rules

- Do not include unknown body properties.
- The Tracking Domain must have SSL and DNS successfully configured before it can be added to a Site.
- The Tracking Domain cannot be in use by another Site.
- The Tracking Domain ID can be retrieved with `GetTrackingDomains`.

---

## Output Schema

A successful response returns the Site ID.

```json
{
  "api_call_id": "XXXXXXXXXXXXXXXXXXXX",
  "api_call_unix": 1710000000,
  "code": 1,
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "result": "string"
}
```

---

## Example Request

```json
{
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "tracking_domain": "YYYYYYYYYYYYYYYYYYYY"
}
```

---

## Recommended Follow-Up

After a successful call:

1. Call `GetSite`.
2. Inspect `tracking_domain`.
3. Inspect `deployment.branches.main.routing.status`.
4. Inspect `deployment.branches.main.routing.a_record_ip`.
5. Display the exact live A record IP without altering it.
6. Tell the user to update the applicable hostname's A record at their domain registrar or authoritative DNS provider.
7. Wait for the user to confirm the record was applied.
8. Poll `GetSite` until main routing is active.
9. Avoid saying the domain is live until the user confirms the DNS change and routing is active.

---

## Best Practices

1. Confirm the Site and domain before calling this operation.
2. Use exact IDs from prior MCP results.
3. Explain that the Tracking Domain affects the main/live Site, not the dev branch.
4. Treat attachment as a go-live action and require confirmation that the business is ready to process live transactions.
5. Keep the user informed that DNS must be updated at their domain registrar or authoritative DNS provider using the final Site routing A record.
6. Use `GetSiteEvents` if the user wants to see routing-related activity.

---

## Final MCP Instruction

Use `AddTrackingDomainToSite` only after the user confirms the Site is ready for live transactions and the exact custom domain should route to the main/live deployment. Always follow up with `GetSite`, display the exact live A record, require the registrar or authoritative-DNS update, and verify active routing.


---
Document Parent Directory
* [Operations](https://revcent.com/documentation/markdown/mcp/operation/index.md) - AI/MCP details and overviews for operations available within the RevCent MCP.

---
Document Parent Directory
* [Operations](https://revcent.com/documentation/markdown/mcp/operation/index.md) - AI/MCP details and overviews for operations available within the RevCent MCP.