Skip to content

PolyglotAndrea/dineagent

Repository files navigation

DineAgent

AI-powered restaurant website platform. Restaurant websites aren't brochures — they're AI employees that understand menus, manage reservations, and handle reviews.

What is DineAgent?

DineAgent is a full-stack platform that turns a restaurant website into an intelligent, manageable system. Every business operation (menu, reservations, orders, events, reviews, loyalty, SEO) is exposed through three interfaces:

Interface Use Case
MCP Server AI agents (Claude, Cognix) call tools directly
CLI Humans, scripts, and Cognix skill handlers
Payload CMS Admin Visual web dashboard for non-technical staff

All three interfaces share the same data layer — changes from any source are immediately visible everywhere.

Architecture

dineagent/
├── apps/
│   ├── web/           # Astro frontend (restaurant website)
│   ├── cms/           # Payload CMS (admin + API)
│   ├── mcp/           # MCP Server (AI agent interface)
│   └── cli/           # CLI (human + script interface)
├── packages/
│   ├── shared/        # Common types and utilities
│   └── components/    # Business logic (core architecture)
│       ├── menu/           # Menu management
│       ├── reservation/    # Reservation management
│       ├── review/         # Review management
│       ├── order/          # Online ordering
│       ├── event/          # Events & banquets
│       ├── loyalty/        # Loyalty program
│       └── seo/            # SEO management
├── skills/            # Auto-generated Cognix skill packages
└── tooling/           # Build scripts & generators

Component Architecture

Each business component follows a strict 6-file contract:

menu/
├── component.yaml     # Metadata, MCP tools, CLI commands, Cognix bridge config
├── schema.ts          # Payload CMS CollectionConfig
├── mcp-tools.ts       # Zod schemas + MCP tool handlers
├── cli-commands.ts    # Commander.js command definitions
├── types.ts           # TypeScript domain types
└── index.ts           # Barrel exports

Key principle: MCP tools and CLI commands are thin adapters over the same Payload CMS operations. No business logic lives in the interface layer.

HITL (Human-in-the-Loop) Workflow

AI/CLI creates → status: draft → Admin reviews → status: published → Website renders
                                     ↓
                              status: archived (rejected)

Every collection has status (draft/published/archived) and createdBy (mcp-agent/cli/human) fields.

Quick Start

Prerequisites

  • Node.js >= 18
  • pnpm >= 9

Install

git clone https://github.com/codeducker/dineagent.git
cd dineagent
cp .env.example .env
pnpm install

Configure

Edit .env:

PAYLOAD_SECRET=your-random-secret-here
DATABASE_URL=./dineagent.db
PORT=3000
PAYLOAD_API_URL=http://localhost:3000/api

Build

pnpm build

Run

# Start CMS (admin panel + API)
cd apps/cms && pnpm dev
# Admin: http://localhost:3000/admin

# Start Astro frontend (in another terminal)
cd apps/web && pnpm dev
# Website: http://localhost:4321

Usage

CLI Commands

# Menu
dineagent menu create-dish --name "Spring Lamb" --price 28 --description "Herb-crusted"
dineagent menu list-dishes --format table
dineagent menu update-dish --id <id> --price 32

# Reservations
dineagent reservation create --guest-name "John" --party-size 4 --date 2026-05-15 --time 19:00
dineagent reservation list --date 2026-05-15
dineagent reservation cancel --id <id>

# Orders
dineagent order create --customer-name "Jane" --items '[{"dishName":"Pasta","quantity":2,"unitPrice":18}]' --order-type takeout
dineagent order list --status pending

# Events
dineagent event create --name "Wine Tasting" --date 2026-06-01 --start-time 18:00 --event-type private_dining
dineagent event list --format table

# Reviews
dineagent customer-review create --guest-name "Alice" --rating 5 --content "Amazing food!"
dineagent customer-review list --min-rating 4

# Loyalty
dineagent loyalty create-member --name "Bob" --email "bob@example.com"
dineagent loyalty add-points --id <id> --points 500 --description "Dinner visit"
dineagent loyalty list-members --format table

# SEO
dineagent seo get-meta --path /menu
dineagent seo update-meta --path /menu --title "Our Menu" --description "Fresh seasonal dishes"
dineagent seo update-structured-data --name "DineAgent Restaurant" --cuisine "Contemporary"

# HITL Review
dineagent review list
dineagent review approve <id> --collection dishes
dineagent review reject <id> --collection dishes

# Site Context
dineagent site context
dineagent site update-context --brand-voice "Warm, welcoming, seasonal"

MCP Server (AI Agents)

Configure in Claude Desktop or any MCP client:

{
  "mcpServers": {
    "dineagent": {
      "command": "node",
      "args": ["apps/mcp/dist/index.js"]
    }
  }
}

Available MCP tools:

Tool Description
menu.create_dish Create a new dish (as draft)
menu.list_dishes List dishes with filters
menu.update_dish Update a dish
menu.delete_dish Delete a dish
menu.list_categories List menu categories
reservation.create Create a reservation
reservation.list List reservations
reservation.update Update a reservation
reservation.cancel Cancel a reservation
reservation.availability Check table availability
review.create Create a review
review.list List reviews
review.respond Respond to a review
review.moderate Approve/reject a review
order.create Create a food order
order.list List orders
order.updateStatus Update order status
order.get Get order details
event.create Create an event
event.list List events
event.update Update an event
event.cancel Cancel an event
loyalty.createMember Register loyalty member
loyalty.listMembers List members
loyalty.addPoints Add points
loyalty.redeemPoints Redeem points
loyalty.getMember Get member + history
seo.getPageMeta Get page SEO metadata
seo.updatePageMeta Update page SEO metadata
seo.getStructuredData Get restaurant structured data
seo.updateStructuredData Update structured data
review.pending List all draft items (HITL)
review.approve Publish a draft item
review.reject Archive a draft item
site.get_context Get site context
site.update_context Update site context

Cognix Skills

Generated skill packages are in skills/. Install into Cognix:

cd skills/dineagent-menu && cognix skill install .

Skills delegate to the CLI via child_process, making DineAgent components available as Cognix agent tools.

Development

Commands

pnpm build          # Build all packages
pnpm dev            # Start all dev servers
pnpm lint           # Run ESLint
pnpm format         # Format with Prettier
pnpm test           # Run tests
pnpm generate-skills # Regenerate Cognix skill packages

Adding a New Component

  1. Create packages/components/<name>/ with the 6-file contract
  2. Add package.json and tsconfig.json
  3. Register in apps/cms/src/payload.config.ts
  4. Register in apps/mcp/src/registry.ts
  5. Register in apps/cli/src/index.ts
  6. Add workspace deps to apps' package.json
  7. Run pnpm generate-skills

Tech Stack

Layer Technology
Frontend Astro (static site generation)
CMS Payload CMS 3.x (self-hosted)
Database SQLite (dev) / PostgreSQL (prod)
AI Interface MCP SDK (Model Context Protocol)
CLI Commander.js
Validation Zod
Monorepo Turborepo + pnpm workspaces
Skills Bridge component.yaml → skill.yaml + handler.mjs

License

MIT

About

AI-powered restaurant website platform - Astro + Payload CMS + MCP + CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors