Caveist
← Back to Home
Under the Hood

Built for the
frontier of AI

Caveist is an MCP-native server that turns any AI assistant into your personal sommelier. This is the stack.

Architecture

Full system diagram

AI Client Claude / ChatGPT
Web App Vue Dashboard
Static Astro Landing
mcp.*
app.*
caveist.com
Cloudflare Workers Reverse Proxy

Subdomain routing · Auth header injection · TLS termination

mcp.* → /v1/mcp
api.* → /v1/api
bus.* → /v1/inngest
Edge Function MCP Server

OAuth 2.1 · 10 tools

Edge Function REST API

Auth · Public cave

Edge Function Inngest

Async events · Workers

Repository Pattern · Service Role
Supabase PostgreSQL 17

RLS · pgcrypto · pg_trgm

Cloudflare R2 Storage

Wine label images

query-cellaradd-to-cellarlog-tastingcellar-insightsidentify-wineupdate-wineupdate-bottleupdate-tastingquery-tastingsflag-for-review

10 MCP tools exposed via OAuth 2.1

Dashboard

See your cellar,
not just query it

The Vue dashboard shows your collection. Bottles, tasting history, drinking windows, your public cellar page. Manage through AI, browse here.

Cellar overview Tasting history Drinking windows Public cave Analytics
app.caveist.com
Your Cellar 47 bottles
12 At Peak
28 Aging
7 Past Peak
Château Margaux 2018 Margaux AOC
6 btl
Pichon Baron 2010 Pauillac AOC
At peak
Roulot Meursault 2016 Meursault AOC
At peak
Deep Dive

Request lifecycle

What happens when you say "add 6 bottles of Margaux 2018"

01

AI parses your intent

Claude/ChatGPT understands you want to add wine and calls add-to-cellar

02

MCP JSON-RPC → Cloudflare Proxy

Request hits mcp.caveist.com → Worker routes to /v1/mcp, injects auth headers

03

OAuth token → User ID

Edge function validates OAuth token, extracts user_id, scopes all queries to your cellar via RLS

04

Wine deduplication

upsertWine() → exact match? reuse. Fuzzy match >0.85? auto-merge. Ambiguous? create new entry.

05

Bottles created · Events fired

6 bottle rows inserted (your scope). Inngest event wine/added fires → async worker fetches label image to R2

06

Response to AI

MCP returns structured result. AI formats it naturally: "✓ 6 bottles added. Château Margaux 2018, peak 2030–2055."

Protocol

MCP — the open standard

What is MCP?

The Model Context Protocol is an open standard by Anthropic that lets AI assistants use external tools. USB-C for AI. One protocol, any model.

When you ask Claude "what wine goes with lamb?", Claude calls Caveist's query-cellar tool, gets your actual bottles, and recommends from your stock.

OAuth 2.1 Authentication

Every MCP connection authenticates via OAuth 2.1 with PKCE. Your AI gets a scoped token. It can access your cellar and nothing else.

POST /oauth/authorize
POST /oauth/token
# Scoped to user_id via RLS
MCP tools/call → query-cellar
Stack

Technologies we trust

Platform

Supabase

Auth, database, storage, edge functions. The backend.

Database

PostgreSQL 17

Row-Level Security, trigram indexes, full-text search.

Runtime

Deno 2

Edge runtime for MCP server and API functions.

Infrastructure

Cloudflare

Workers proxy, Pages hosting, R2 image storage.

Protocol

MCP SDK

Model Context Protocol server implementation.

Language

TypeScript

End-to-end type safety, from DB to AI tools.

Validation

Zod

Runtime schema validation for every MCP tool input.

Events

Inngest

Async event processing: onboarding, image fetch, drip.

Security

Your data, your rules

Row-Level Security

Every table has RLS policies. Your bottles and tastings are invisible to other users, even at the database level.

OAuth 2.1 + PKCE

MCP connections authenticate with modern OAuth. Tokens are scoped, rotatable, and never stored in plaintext.

Your Database

Your cellar data lives in Supabase with AES-256 encryption at rest and TLS 1.2+ in transit. We never sell or train on your data.

Intelligence

Smarter than a spreadsheet

Wine Deduplication

Say "Margaux 2018", "Ch. Margaux '18", or "Chateau Margaux 2018" . Caveist knows it's the same wine. Normalized producer matching + pg_trgm fuzzy search ensures one canonical entry per wine.

# Exact match → reuse
findExactWine("Margaux", 2018)
# Fuzzy match → merge candidates
findSimilarWines("Ch Margaux")
# → similarity: 0.89 → auto-merge

Drinking Windows

Peak drinking periods, predicted per bottle. Based on region, appellation, vintage, and grape variety. Caveist tells you what's ready now and what to keep aging.

2020 2030 — 2045 Peak 2060

Château Margaux 2018 · Margaux AOC

"Built by wine lovers who write code."

Get Started