agent-storefront
Enables any AI agent to discover, query, and order from a restaurant's storefront via MCP tools. It handles menu lookup, modifier validation, and enforces a mandatory confirmation gate before payment, replacing the human-operated phone line.
README
agent-storefront
Thesis: Every restaurant already has an accidental agent API — it's called a phone line. This prototype replaces that with a proper machine-readable storefront that any AI agent can discover, query, and order from without a human operator.
A working demo of the human → consumer AI → merchant AI → human ordering loop, where the restaurant exposes an MCP (Model Context Protocol) server that a consumer AI agent negotiates with to place an order — complete with menu lookup, modifier validation, pricing, and a mandatory confirmation gate before payment.
Architecture
┌──────────────┐ natural language ┌──────────────────────┐ MCP tools ┌───────────────────────┐
│ Marmik │ ───────────────────▶ │ Siri │ ─────────────▶ │ DoorDash │
│ (human) │ │ (consumer AI agent) │ │ (merchant MCP server) │
│ │ ◀─────────────────── │ consumer/agent.py │ ◀───────────── │ merchant/main.py │
└──────────────┘ spoken/text reply └──────────────────────┘ struct. JSON └───────────────────────┘
│
▼
Mock POS (in-memory)
+ orders.json
Two independent services, one terminal UI:
| Service | Role | Tech |
|---|---|---|
merchant/ |
DoorDash — exposes menu, validates orders, acts as mock POS | FastAPI + MCP Python SDK (streamable HTTP) |
consumer/ |
Siri — LLM agent loop that takes NL input and negotiates the order | Python + Ollama (qwen3:14b) |
| Terminal | Marmik — types orders, sees the full negotiation stream, confirms payment | python -m consumer.agent |
Quickstart
# 1 — start the merchant (DoorDash / store AI)
make merchant
# 2 — in a second terminal, start ordering (Siri + Marmik in one terminal)
IGNORE_STORE_HOURS=1 python -m consumer.agent
# 3 — try an order
# Marmik ▶ Large veggie pizza, thin crust, mushroom and onion. My name is Marmik.
You'll see the full negotiation in real time:
Siri → DoorDash get_store_info() .............. ✓ Tony's Pizza
Siri → DoorDash get_menu() .................... ✓ 8 items
Siri reading your order with qwen3:14b...
Siri → DoorDash validate_order() .............. ✓ $17.27
Siri ▶ Marmik
Here's your order summary, Marmik:
• Veggie Pizza (Large, Thin Crust, Mushroom, Onion) × 1
Total: $17.27 | Pickup: ~20 min | Payment: saved card (mock)
Shall I place this order? Reply yes to confirm.
Marmik ▶ yes
Siri → DoorDash place_order() ................. ✓ TON-8D0X
Siri ▶ Marmik
Order TON-8D0X confirmed! Total $17.27, pickup at 11:01.
Makefile targets
| Command | Does |
|---|---|
make merchant |
Start merchant MCP server on port 8000 |
make consumer |
Start consumer REST API on port 8001 |
make demo |
Start both servers in background |
make test |
Run unit tests (21 validation tests) |
make smoke |
Run MCP smoke test (7 assertions) |
make scenarios |
Run all 5 §11.4 integration scenarios |
Demo scenarios (try these)
# Happy path
IGNORE_STORE_HOURS=1 python -m consumer.agent
Marmik ▶ Large veggie pizza, thin crust, mushroom and onion. Name: Marmik.
# Unavailable item — Siri escalates, offers alternatives
Marmik ▶ BBQ Chicken Pizza please, large with thin crust.
# Ambiguous order — Siri auto-fills required modifiers and states assumptions
Marmik ▶ I want a cheese pizza.
# Change of mind — say no at confirmation, re-order
Marmik ▶ [order something] → no → [new order] → yes
Why modifier validation is the hard part
Real POS menus have hundreds of modifier groups with min/max selection rules, mutual exclusions ("extra cheese" conflicts with "no cheese"), and per-item applicability constraints. A "large veggie pizza" in plain English maps to: an item ID, a required size modifier, an optional crust modifier, and 0–10 topping modifiers — each with an exact modifier_id the POS understands. If any ID is wrong or a required group is missing, the kitchen rejects the ticket. The validation layer in merchant/validation.py implements all 7 rules and returns machine-readable suggested_fix objects so the consumer AI can self-correct before the human ever sees an error.
Where the mocked seams are
Payments (AP2 Cart Mandate)
merchant/tools.py → place_order() marks every order payment_status: "mock_authorized" and has a comment: # AP2 Payment Mandate verification would happen here. In production this is where the AP2 mandate exchange happens: the merchant presents a Cart Mandate to the consumer agent's identity provider, which verifies the agent is authorized to spend on the human's behalf and returns a signed approval before place_order proceeds.
Per §11.2 of the spec, place_order is already gated behind explicit human confirmation (AWAITING_CONFIRMATION state) — the code enforces this, not just a prompt. This is the agentic analogue of 3-D Secure.
POS (Clover / Toast)
merchant/store.py loads merchant/data/menu.json (configurable via MENU_PATH env). Replace with a real Clover menu export (the schema is documented in merchant/models.py). The save_order() call writes to merchant/data/orders.json and an in-memory dict — swap in a real POS write-back here.
Menu schema (for real POS integration)
{
"store_id": "tonys-pizza-001",
"items": {
"pizza-veggie": {
"id": "pizza-veggie",
"name": "Veggie Pizza",
"base_price_cents": 1199,
"modifier_group_ids": ["grp-size", "grp-crust", "grp-toppings"],
"available": true,
"category": "pizzas"
}
},
"modifier_groups": {
"grp-size": {
"id": "grp-size",
"name": "Size",
"min_select": 1,
"max_select": 1,
"required": true,
"modifier_ids": ["mod-size-s", "mod-size-m", "mod-size-l"]
}
},
"modifiers": {
"mod-size-l": {
"id": "mod-size-l",
"name": "Large",
"price_delta_cents": 400,
"available": true,
"excludes": []
}
}
}
Tech stack
| Layer | Choice |
|---|---|
| Merchant MCP | Python 3.11+, mcp SDK v1.27+, FastMCP, stateless_http=True |
| LLM | Ollama qwen3:14b with think: false + format (JSON schema constrained decoding) |
| Validation | Pydantic v2, 7 rules, machine-readable error objects with suggested_fix |
| Tests | pytest (21 unit), integration scenarios (5 E2E with merchant + LLM) |
v2 directions (out of scope for v1)
- A2A protocol: replace the custom MCP client with an A2A agent-to-agent discovery layer so any AI assistant can find and order from Tony's without bespoke integration
- Real AP2 mandates: wire in actual Cart Mandate exchange for agentic payments
- Multi-restaurant discovery: a directory MCP server that routes the consumer agent to the right merchant
- Delivery logistics: extend
place_orderto include delivery address + ETA from a mock logistics API
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。