Skip to main content
Glama
rick001

restaurant-mcp

by rick001
README.md
# restaurant-mcp

MCP server for **Spice Garden**, a demo restaurant, with an optional OpenRouter-powered chat client. The assistant queries a live SQLite database for orders, inventory, tables, and sales data.

## Prerequisites

- [Node.js](https://nodejs.org/) **20.6+** (required for `--env-file`)
- An [OpenRouter](https://openrouter.ai/) API key (for the chat client only)

## Quick start

```bash
npm install
cp .env.example .env   # Windows: copy .env.example .env
# Edit .env — add your OPENROUTER_API_KEY and pick a tool-capable model
npm run seed
npm run chat
```

Example questions:

- `How many orders today?`
- `Which is our most popular dish?`
- `What's running low in inventory?`
- `How many tables are occupied?`

Type `exit` to quit.

## Scripts

| Command | Description |
|---------|-------------|
| `npm run seed` | Create and populate `db/restaurant.db` |
| `npm run chat` | Start the interactive OpenRouter assistant |
| `npm start` | Run the MCP server directly (stdio) |

## Environment variables

Copy `.env.example` to `.env`:

| Variable | Required | Description |
|----------|----------|-------------|
| `OPENROUTER_API_KEY` | For chat | Your OpenRouter API key |
| `OPENROUTER_MODEL` | For chat | Model ID — **must support tool calling** |
| `SKIP_MODEL_CHECK` | No | Set to `true` to skip the startup model validation |

### Choosing a model

The chat client sends tools with every request, so the model must support function/tool calling. Browse compatible models at:

**https://openrouter.ai/models?supported_parameters=tools**

Free-tier examples that work:

- `meta-llama/llama-3.3-70b-instruct:free`
- `qwen/qwen3-coder:free`
- `openai/gpt-oss-20b:free`

## MCP server tools

| Tool | Description |
|------|-------------|
| `get_orders_summary` | Order count, revenue, and pending orders for a date |
| `get_inventory_status` | Current stock levels for all items |
| `check_low_stock` | Items below their reorder threshold |
| `get_popular_items` | Best-selling menu items by quantity |
| `get_table_status` | Table occupancy and capacity |

## Use with Cursor (or any MCP client)

Add to your MCP config:

```json
{
  "mcpServers": {
    "restaurant": {
      "command": "node",
      "args": ["/absolute/path/to/restaurant-mcp/server.js"]
    }
  }
}
```

Run `npm run seed` first. The server exits with a clear message if the database is missing or empty.

## Project structure

```
restaurant-mcp/
├── server.js       # MCP server (stdio)
├── client.js       # OpenRouter chat client
├── db/
│   ├── seed.js     # Database schema + sample data
│   └── restaurant.db  # Generated (gitignored)
├── lib/
│   ├── db.js       # Database bootstrap check
│   └── paths.js    # Shared paths and version
└── .env            # Your secrets (gitignored)
```

## License

ISC