Skip to content

tgw013/cuddle-toy-insurance

Repository files navigation

Cuddle Toy Insurance 🧸

Because every stuffed animal deserves peace of mind.

This is a demo project, not a real insurance product. It exists to explore how financial products can be marketed and administered through conversational AI interfaces (LLMs + MCP). No real policies are issued, no real money changes hands (Stripe runs in test mode only), and nothing here constitutes actual insurance coverage.

Cuddle Toy Insurance is an end-to-end demo of an "AI-native" product: a user describes a stuffed animal in natural language, an LLM plays the role of a meticulous Lloyd's-of-London-style adjuster, and the conversation drives a real API flow — assessment → quote → Stripe test-mode checkout → policy certificate. The same backend serves three channels: a Claude MCP server, a ChatGPT Custom GPT, and a Next.js web wizard.


What's in the repo

.
├── backend/   FastAPI service (quotes, pricing, Stripe, Supabase, PDF cert)
├── mcp/       Remote MCP HTTP server that proxies to the backend
├── web/       Next.js 14 web wizard (deployed on Vercel)
├── docs/      Integration guides (e.g. Custom GPT setup)
├── src/       Legacy v1.2 local-stdio MCP server (kept for reference)
└── tests/     Pytest suite for the v1.2 local-stdio server
  • v2 (current) is a cloud deployment: FastAPI on Railway, Postgres on Supabase (Frankfurt, with RLS enabled), MCP server on Railway, web on Vercel. See Cuddle_Toy_Insurance_v2_PRD.md.
  • v1.2 (legacy, in src/) is the original local-stdio MCP server with on-disk JSON storage. Still runnable; see the v1 PRD.

How it works

Three core tools / API endpoints drive every conversation:

  1. Assess — takes a toy profile (name, type, estimated value, condition, owner age, ownership years, household hazards) and returns risk multipliers plus a one-sentence adjuster narration.
  2. Quote — runs the actuarial model, persists a pending quote (Q-XXXXXXXX), and opens a Stripe test-mode Checkout session.
  3. Finalize — verifies the Stripe session was actually paid for that specific quote (anti-replay via session.metadata.quote_id), issues a CTI-XXXXXXXXXX policy, and returns both a Markdown certificate and a link to the rendered PDF.

The adjuster persona ("warm, meticulous, deadpan about plush toys") is defined once and reused across the Claude MCP docstrings, the Custom GPT system prompt, and the web wizard microcopy.


Tech stack

Layer Tech
Backend FastAPI, Pydantic v2, psycopg3, ReportLab
MCP server FastMCP 2.x, streamable HTTP
Database Supabase Postgres (RLS enabled, backend uses a BYPASSRLS role)
Payments Stripe Checkout (test mode only)
Web Next.js 14 (App Router), Tailwind, deployed on Vercel
Hosting Railway (backend + MCP), Vercel (web), Supabase (DB)

Try it

Three ways to use the demo, depending on which LLM you prefer:

Claude (Desktop, via remote MCP)

The MCP server is deployed publicly. Add it to your Claude Desktop config:

{
  "mcpServers": {
    "cuddle-toy-insurance": {
      "url": "https://<your-mcp-deployment>/mcp"
    }
  }
}

Then in a fresh conversation: "I'd like to insure my teddy bear."

ChatGPT (Custom GPT with Actions)

Requires a ChatGPT Plus/Team/Enterprise plan. The Custom GPT imports the backend's OpenAPI spec directly — no adapter. Full setup walkthrough in docs/chatgpt_setup.md.

Web wizard

Deployed at the Vercel URL from web/vercel.json. A guided form that calls the same FastAPI backend as the MCP server.


Run locally

Backend

cd backend
pip install -e ".[dev]"
cp .env.example .env   # fill in SUPABASE_DB_URL and (optionally) STRIPE_SECRET_KEY
uvicorn app.main:app --reload

Without a STRIPE_SECRET_KEY the backend runs in demo mode: /v1/quotes returns payment_mode: "demo" and finalize accepts any non-empty session id so the flow stays usable end-to-end.

MCP server

cd mcp
pip install -e ".[dev]"
cp .env.example .env   # point BACKEND_URL at your running backend
uvicorn app.main:app --reload --port 8001

Web

cd web
npm install
npm run dev

Legacy v1.2 local-stdio server

Still runnable from src/cuddle_toy_insurance/:

pip install -e .
cuddle-toy-insurance   # stdio MCP server, ships its own on-disk JSON store

Admin surface (optional)

A separate admin MCP server (cuddle-toy-insurance-admin from v1.2, or equivalent v2 admin endpoints) lets an operator tune pricing multipliers and suspend the service. API-key gated via env var — example:

{
  "env": { "CUDDLE_TOY_ADMIN_API_KEY": "cti-admin-CHANGE_ME" }
}

Never commit the key. Rotate it if it ever leaks.


Limitations

Intentionally out of scope (see PRDs and DECISIONS.md):

  • Real-money payments. Only Stripe test mode is supported.
  • Claims handling, refunds, policy modification — new business only.
  • Identity verification, KYC, regulatory compliance — this is a demo.
  • PDF templating beyond a single ReportLab layout.

License

MIT — see LICENSE.


Disclaimer

Cuddle Toy Insurance is a demonstration of conversational-AI product UX. It is not a licensed insurance carrier, not affiliated with any insurer, and does not provide insurance coverage of any kind. All monetary values are hypothetical; all Stripe charges are test-mode only.

About

Demo project: conversational AI (LLM + MCP) marketing and administering a whimsical insurance product. Not real insurance; Stripe in test mode only.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors