reservation-mcp
# reservation-mcp
A clean, auditable, local-first **Restaurant Reservations MCP Server** in TypeScript supporting **Resy** and **OpenTable**.
## Safety & Design Principles
- **Normalized multi-platform interface:** Unified IDs (`resy:<id>`, `opentable:<id>`) and normalized outputs across search, availability, booking, listing, and cancellation.
- **Mandatory two-step booking:** Never exposes a single-call auto-book tool.
1. `preview_booking` fetches slot details, cancellation/deposit fees, and card requirements, returning a single-use `preview_id` with a **3-minute TTL** (plus a pre-filled `booking_url` for OpenTable).
2. `confirm_booking(preview_id, confirm: true)` consumes the `preview_id` once and executes the booking (or returns the verified handoff URL in OpenTable `"handoff"` mode).
- **Dry-run cancel default:** `cancel_reservation` returns a dry-run preview unless `confirm: true` is explicitly passed.
- **No sniping, no bot evasion, no password storage:**
- Strictly user-initiated actions only; conservative per-platform token bucket rate limiter (`RATE_LIMIT_MAX_PER_MIN=10` default).
- Resy auth comes from `RESY_AUTH_TOKEN` or macOS Keychain (`security` CLI).
- OpenTable uses connect-only CDP (`playwright-core` `connectOverCDP`, zero bundled browsers) attached to your own signed-in Chrome session.
- Whenever OpenTable triggers Akamai, CAPTCHA, or card verification, the server stops immediately (zero retries) and returns `CHALLENGE_REQUIRED` or `CARD_REQUIRED` with a pre-filled `booking_url`.
- **Clean transport & log hygiene:** `stdio` is the default (`stdout` is strictly JSON-RPC; all diagnostic logs go to `stderr` with automatic secret/PII redaction).
---
## Setup
### 1. Install & Build
Requires **Node.js >= 20** (tested on Node 22).
```bash
git clone https://github.com/bdatdo0601/reservation-mcp.git
cd reservation-mcp
npm install
npm run build
```
### 2. Configure Resy (Live Multi-Source Auth & Easy Refresh)
Resy auth is resolved live (with a 5-minute in-memory cache and **automatic one-shot refresh on `401`/`419`**) in this order:
1. **1Password (`RESY_AUTH_TOKEN_OP_REF`)** — e.g. `op://Fleet-Agent/Resy/auth_token` (uses `OP_SERVICE_ACCOUNT_TOKEN` or `~/.fleet/op-service-account.token` automatically). Updating 1Password takes effect without restarting the MCP server.
2. **Environment variable (`RESY_AUTH_TOKEN`)**.
3. **macOS Keychain** (`npm run auth:resy` or `npm run auth:resy:chrome`).
4. **Signed-in Chrome CDP session (`RESY_AUTH_FROM_CDP=true`, default)** — if you are logged into `https://resy.com` in the Chrome CDP browser, the server extracts the token automatically without manual header copying.
One-command CLI helpers:
```bash
# Extract token from your signed-in Chrome CDP session, verify it, and save to Keychain:
npm run auth:resy:chrome
# Extract from Chrome CDP and save directly to 1Password (great for Mac mini + Fleet):
npm run auth:resy -- --from-chrome --op-ref "op://Fleet-Agent/Resy/auth_token"
# Check current Resy token status without printing the secret:
npm run auth:resy -- --status
```
When a token expires later, you **do not need to restart the MCP server**: either re-sign into `resy.com` in Chrome, update 1Password, or run `npm run auth:resy:chrome`, and call `restaurant_health(refresh_auth: true)` (or let the next `401`/`419` auto-refresh once).
`RESY_API_KEY` defaults to Resy's public web client key and can be overridden via env if needed. Optionally set `RESY_PAYMENT_METHOD_ID` if you have multiple saved cards.
### 3. Configure OpenTable (Signed-In Chrome over CDP)
Start Chrome with remote debugging enabled using a dedicated user profile or your signed-in profile, and log into `https://www.opentable.com`:
```bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/.chrome-reservation-mcp"
```
OpenTable runs in **`OPENTABLE_BOOKING_MODE=handoff`** by default:
- Search, availability, `list_reservations`, and `preview_booking` read through your signed-in Chrome session.
- `confirm_booking` returns a verified, pre-filled `booking_url` so you complete checkout in your browser.
- Set `OPENTABLE_BOOKING_MODE=cdp` only if you want `confirm_booking` / `cancel_reservation` to submit via your signed-in Chrome tab (still falling back immediately to `booking_url` on any challenge or card prompt).
### 4. Read-Only Live Smoke Check
```bash
npm run smoke:read -- "Carbone" "New York"
```
---
## Mac mini + Fleet Always-On Assistant Setup
Run the turnkey Mac mini setup script to install dependencies, build `dist/`, register a persistent GUI-session Chrome CDP LaunchAgent (`127.0.0.1:9222` using `~/.chrome-reservation-mcp`), optionally install the Fleet Assistant skill (`deploy/fleet/SKILL.md`), and print the exact `~/.fleet/assistant.json` config block:
```bash
git clone https://github.com/bdatdo0601/reservation-mcp.git
cd reservation-mcp
npm run setup:mac-mini -- --install-skill
```
Useful maintenance commands on the Mac mini:
```bash
npm run setup:mac-mini -- --status # Verify build, LaunchAgent, Chrome CDP, and `op` CLI
npm run setup:mac-mini -- --uninstall # Remove Chrome CDP LaunchAgent
```
See [deploy/fleet/assistant-mcp.example.json](deploy/fleet/assistant-mcp.example.json) and [deploy/fleet/SKILL.md](deploy/fleet/SKILL.md) for the Fleet Always-On Assistant integration template.
---
## MCP Client Configuration
### Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`)
```json
{
"mcpServers": {
"restaurant-reservations": {
"command": "node",
"args": ["/absolute/path/to/reservation-mcp/dist/index.js"],
"env": {
"CHROME_CDP_URL": "http://127.0.0.1:9222",
"OPENTABLE_BOOKING_MODE": "handoff"
}
}
}
}
```
### Claude Code (`~/.claude.json` or project `.mcp.json`)
```json
{
"mcpServers": {
"restaurant-reservations": {
"command": "node",
"args": ["/absolute/path/to/reservation-mcp/dist/index.js"],
"env": {
"CHROME_CDP_URL": "http://127.0.0.1:9222",
"OPENTABLE_BOOKING_MODE": "handoff"
}
}
}
}
```
### Antigravity (`mcp_config.json`)
```json
{
"mcpServers": {
"restaurant-reservations": {
"command": "node",
"args": ["/absolute/path/to/reservation-mcp/dist/index.js"],
"env": {
"CHROME_CDP_URL": "http://127.0.0.1:9222",
"OPENTABLE_BOOKING_MODE": "handoff"
}
}
}
}
```
### Optional Localhost Streamable HTTP Transport
HTTP mode binds strictly to `127.0.0.1` and requires `MCP_API_KEY` (Bearer auth, >= 12 chars):
```bash
MCP_API_KEY="replace-with-strong-random-key" node dist/index.js --http
```
---
## MCP Tools
| Tool | Description | Safety |
| :--- | :--- | :--- |
| `restaurant_health` | Checks Resy auth & OpenTable CDP session readiness | Read-only |
| `search_restaurants` | Searches Resy & OpenTable; returns normalized `resy:<id>` / `opentable:<id>` | Read-only |
| `check_availability` | Lists time slots, seating types, fees, and `requires_card` | Read-only |
| `list_reservations` | Lists upcoming (and optional past) reservations | Read-only |
| `preview_booking` | Step 1: Fetches fees/terms & returns single-use `preview_id` (3-min TTL) | Non-mutating |
| `confirm_booking` | Step 2: Consumes `preview_id` with `confirm: true` to book or hand off | Requires `confirm: true` |
| `cancel_reservation` | Cancels a reservation (returns dry-run preview unless `confirm: true`) | Dry-run default |
### Typed Error Codes
`AUTH_EXPIRED`, `NOT_CONFIGURED`, `CDP_UNAVAILABLE`, `CHALLENGE_REQUIRED`, `PERSISTED_QUERY_NOT_FOUND`, `CARD_REQUIRED`, `SLOT_GONE`, `RATE_LIMITED`, `PREVIEW_EXPIRED`, `CONFIRMATION_REQUIRED`, `VALIDATION_ERROR`, `PLATFORM_ERROR`.
---
## Disclaimer
For personal, interactive use only. Resy and OpenTable do not offer public consumer booking APIs; endpoints and GraphQL persisted-query hashes (`src/platforms/opentable/persisted-queries.ts`) may change at any time. Use responsibly and in accordance with each platform's Terms of Service.
TDQS
Scored across 7 tools
Each tool targets a distinct step or resource: discovery (search_restaurants), slot lookup (check_availability), the explicitly numbered preview_booking/confirm_booking pair, read-only listing, cancellation, and a diagnostics tool. The two-step booking flow is spelled out with 'Step 1 of 2' / 'Step 2 of 2', eliminating any chance of confusing the preview with the actual reservation. restaurant_health is clearly separated as a non-mutating readiness check.
Six of seven names follow a clean verb_noun snake_case pattern (preview_booking, confirm_booking, search_restaurants, check_availability, list_reservations, cancel_reservation). restaurant_health deviates as a noun_phrase, but it is readable and idiomatic for a status endpoint. The deviation is minor and does not impede inference.
Seven tools is tightly scoped for a cross-platform reservation domain, and each one earns its place in the search → availability → preview → confirm → list → cancel lifecycle. Nothing is redundant, and diagnostics are folded into a single tool rather than spread across several.
The full booking lifecycle is covered end to end, including a safety-oriented dry-run for cancellation and multi-platform ID normalization. The notable gap is the absence of a modify/reschedule operation, which agents must work around via cancel-then-rebook, and there is no way to inspect an existing reservation's details beyond the list view.