# Build MCP endpoint

```
POST https://www.bookwithhaven.com/api/public/mcp/build
```

The Model Context Protocol server for the AI coding tool that is building a host's own website. It gives the agent what it needs to connect that site to Haven and to check its own work: the account's listing codes, working code, step-by-step skills, and a go-live check.

It is the third Haven MCP server, and each is for a different job.

| Server                                                          | For                                                                |
| --------------------------------------------------------------- | ------------------------------------------------------------------ |
| **Build** at `/api/public/mcp/build` (this page)                | An agent **building a site** that books through Haven              |
| [Haven](04-mcp.md) at `/api/public/mcp`                         | An agent **running an account**: the whole API as tools            |
| [Assistant](06-assistant-mcp.md) at `/api/public/mcp/assistant` | The host assistant's own tools, with a proposal before every write |

The Build server is read-only. No tool on it changes the account, messages a guest, moves money or creates a credential.

It serves a host's own tools: an AI coding tool the host added themselves, or the host's own API key. A reviewed third-party application is refused with `403`, because several tools here answer things about the account that no scope names. Such an application uses the REST API and the [Haven MCP server](04-mcp.md).

## Connecting

Add the URL to your tool as a remote MCP server. It signs you in to Haven, shows a consent screen, and you approve it. There is no key to paste and nothing to apply for.

**Claude Code**

```bash
claude mcp add --transport http haven-build https://www.bookwithhaven.com/api/public/mcp/build
```

Then run `/mcp` inside Claude Code to sign in.

**Cursor.** Add to `.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "haven-build": {
      "url": "https://www.bookwithhaven.com/api/public/mcp/build"
    }
  }
}
```

Then open Cursor Settings, MCP, and click Connect.

**Codex CLI.** In `~/.codex/config.toml`:

```toml
[mcp_servers.haven-build]
url = "https://www.bookwithhaven.com/api/public/mcp/build"
```

**Lovable, Bolt, v0, Replit, Windsurf, VS Code and others.** Look for MCP servers, Connectors or Integrations in the tool's settings, choose to add a custom or remote server, and paste the URL. If it asks how to authenticate, choose OAuth.

**A tool that cannot sign in.** If your tool lets you set a request header but does not run OAuth, create an [API key](../00-start-here/05-api-keys.md) and send `Authorization: Bearer <your key>`. Store it in the tool's secret or header setting, never in the conversation.

Once connected, say: **"Use Haven Build to connect this site to Haven."**

## What the agent can ask

Thirteen tools.

| Tool                         | What it answers                                                                                                      |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `get_started`                | Which account this is, how many listings, whether guests can book yet, the ways to connect, what to do next          |
| `list_listings`              | Every listing and group site with its code, public URL, quote and night-prices URLs, and widget snippet              |
| `get_listing`                | One listing's content, in the exact shape the account API returns it                                                 |
| `get_quote`                  | The price of one stay, as the site's own call to the quote endpoint would return it                                  |
| `find_open_dates`            | The next stays that can really be booked, for testing                                                                |
| `list_skills`, `get_skill`   | The procedures: the whole integration, the widget, a custom booking flow, pages from Haven, go-live, troubleshooting |
| `list_recipes`, `get_recipe` | Working code files with the real endpoints and field names                                                           |
| `get_project_rules`          | The rules and endpoints as a file to write into the project                                                          |
| `list_api_keys`              | Whether the account has API keys, and how the host creates one. Never a key                                          |
| `get_recent_api_requests`    | The site's latest calls to the account API: route, status, error, request id                                         |
| `check_go_live`              | Whether guests can book, item by item, with a link for anything the host must finish                                 |

A connection whose host did not grant listing access is not offered the listing tools or the go-live check; `tools/list` is already filtered.

## Skills

A skill is a procedure: which tool to call, which file to write, what to check before moving on, and what to ask the host. Six of them.

| Skill                    | Use it to                                                           |
| ------------------------ | ------------------------------------------------------------------- |
| `connect-site`           | Start. Reads the account, picks the way to connect, runs to go-live |
| `add-booking-widget`     | Add the widget to an existing page                                  |
| `build-booking-flow`     | Build a custom calendar and booking card on Haven's prices          |
| `build-pages-from-haven` | Build listing pages from the host's Haven content                   |
| `go-live`                | Run the checks before the site is done                              |
| `troubleshoot`           | Read an error and fix it                                            |

They are also MCP prompts, so a client that supports prompts shows each as a command (`connect_site`, `go_live` and so on). `get_skill` returns the same text for clients that do not.

`get_project_rules` returns the standing rules as a file, in three formats: a section for `AGENTS.md`, a Claude Code skill at `.claude/skills/haven/SKILL.md`, or a Cursor rule at `.cursor/rules/haven.mdc`. Writing it into the project means the rules are still there in the next session.

## Recipes

A recipe is a file of working code. The agent writes it to the path the recipe names, then restyles or ports it.

| Recipe                        | What it is                                                      | Runs in | API key |
| ----------------------------- | --------------------------------------------------------------- | ------- | ------- |
| `storefront-client`           | Quote, night prices, group search and the checkout handoff      | Browser | No      |
| `server-client`               | The account API: listings, photos, reservations, writes         | Server  | Yes     |
| `booking-card-react`          | Dates and guests in, live price out, Book hands off to checkout | Browser | No      |
| `availability-calendar-react` | A month of open days with nightly prices                        | Browser | No      |
| `booking-widget`              | The one-tag booking widget                                      | Browser | No      |
| `search-widget`               | The one-tag search across a group site                          | Browser | No      |
| `listing-seo`                 | `Accommodation` structured data from a listing                  | Server  | No      |
| `env-setup`                   | Where `HAVEN_API_KEY` goes on each platform                     | Either  | Yes     |

The split between browser and server files is deliberate. The only file that reads the key is the server client, and nothing marked browser-safe calls the account API.

## The rules the agent is given

Every skill opens with them and `get_project_rules` writes them down.

- Never calculate a price, a fee, a tax or a total. Show Haven's quote exactly.
- Never build a checkout or take card details. Hand the guest to Haven's checkout.
- Never store availability. Read it live.
- The API key is read in server code only, is never given a browser-exposed prefix, is never written into a file, and is never asked for in chat.
- A site that only shows prices and takes bookings needs no key.
- Address listings by the codes Haven returns.
- Booking endpoints use major units; the account API uses integer minor units.

## Why it cannot create a key

An agent can learn whether a key exists and where the host makes one. It is never handed one, and there is no tool that mints one. A long-lived credential in a model's transcript can be logged, summarized or written into a file that is then committed, so the host creates the key in Haven and adds it to their platform's secrets themselves. It is one click.

## What the server supports

`initialize`, `ping`, `tools/list`, `tools/call`, `prompts/list` and `prompts/get`.

It is stateless, like the other two: no sessions, no SSE stream, one JSON-RPC message per POST. `GET` and `DELETE` answer `405`. Notifications are answered `202` with no body, and batches are refused.

A tool that fails still answers as a result, with `isError: true`, so the model can read why. A JSON-RPC error means the message was never processed: a malformed envelope, an unknown method, or a tool that is not on this connection.

Authorization is discovered from the URL, as on the [MCP endpoint](04-mcp.md). The server is its own protected resource, described at `/.well-known/oauth-protected-resource/api/public/mcp/build`, and clients [register themselves](../01-oauth/07-dynamic-client-registration.md).

Calls are charged against the same read budget as the rest of the API and written to the same request log. See [Rate limits](../03-conventions/07-rate-limits.md).
