Skip to main content
Glama
Jadelaawar42027

Yachts Analytics MCP Server

README.md
# Yachts Analytics MCP Server

Wraps `yachts-dashboard`'s business metrics as MCP tools for leadership: broker
performance, setter funnel, company overview, partner (LinkedIn) funnel, and Meta ad
spend, each for an arbitrary date range. Built so leadership can ask the WhatsApp/Slack
bot open-ended questions like "look at broker numbers for the last 3 months and factor
in ad spend" instead of only getting pre-built dashboard views.

Leadership-only: `requireAuth` in `server-http.js` rejects any token whose role isn't
`leadership` before any tool is even registered.

Two entrypoints, same tool logic (shared via `tools.js`), same pattern as
`ghl-coaching-mcp`:

| File | Transport | Use case |
|---|---|---|
| `server.js` | stdio | Local use — Claude Desktop, direct CLI testing |
| `server-http.js` | Streamable HTTP | Remote use — the 365 Yachts WhatsApp bot calls this over the internet |

## Setup

```bash
npm install
cp .env.example .env
```

Fill in `.env`:
- `YACHTS_DASHBOARD_API_URL` — the `yachts-dashboard` Vercel deployment's base URL.
- `DASHBOARD_INTERNAL_API_KEY` — shared secret the new `/api/analytics/*` routes on
  that deployment check for. Must match `DASHBOARD_INTERNAL_API_KEY` set on the
  `yachts-dashboard` Vercel project exactly.
- `JWT_SECRET` — must match the WhatsApp bot's (and `ghl-coaching-mcp`'s) `JWT_SECRET`
  exactly. This server reuses the same identity token already minted for
  `ghl-coaching-mcp` — no separate token-minting needed on the bot side.

## Running locally

**Stdio (Claude Desktop / CLI):**
```bash
npm run start:stdio
```

**HTTP (what the WhatsApp bot actually talks to):**
```bash
npm run start:http
```