AI assistant
Use natural language inside the dashboard to read and change restaurant data.
The AI assistant is a chat panel in the dashboard sidebar. It works on top of the same Keystone GraphQL API the rest of the app uses. It finds the schema through MCP tools before it makes changes, so its changes are real changes to your data.
What it can do
- list models and look up their fields and input types
- query records, such as orders, menu items, reservations, or waitlist entries
- search a model the same way the dashboard list search does
- create, update, and delete records through Keystone's generated CRUD mutations
The MCP server exposes these tools: listModels, searchModels, getFieldsForType, lookupInputType, queryData, modelSpecificSearch, createData, updateData, and deleteData.
It does not call the custom restaurant operations, such as createPOSOrder, fireCourse, processPayment, or refundPayment. Workflows that depend on those must be done in their screens.
How it works
The chat posts to the completion route
The dashboard sends messages to /api/completion. Only the last 20 messages are kept.
It connects to the MCP endpoint
The route opens an MCP client to /api/mcp-transport/http on the same app. Only the session cookie is forwarded, and only to that one endpoint.
The MCP server reads your schema
The MCP route fetches the GraphQL schema with your cookie and builds its tools from it.
Calls run as you
Every query and mutation runs against /api/graphql with your session. Keystone access rules apply as for any other request.
Key files
app/api/completion/route.tsapp/api/completion/scopedMcpFetch.tsapp/api/mcp-transport/[transport]/route.tsfeatures/dashboard/actions/ai-chat.tsfeatures/dashboard/components/dual-sidebar/ai-chat-sidebar.tsx
Configuration
Shared keys
Set these environment variables:
OPENROUTER_API_KEY="your-openrouter-key"
OPENROUTER_MODEL="provider/model-name"
OPENROUTER_MAX_TOKENS="4000"With shared keys, the route requires a signed-in user whose role can access the dashboard. If OPENROUTER_API_KEY or OPENROUTER_MODEL is missing, shared mode is unavailable.
Local keys
A user can instead enter their own OpenRouter key and model in the chat settings. The browser sends them with each request.
The route checks the key against OpenRouter before each chat.
Be careful
- The assistant can delete records if your role allows it. Review what it plans before confirming bulk changes.
- Generic CRUD skips the checks built into custom restaurant operations. Orders, order items, payments, kitchen tickets, and gift cards block direct create and update, so the assistant cannot change them. Lists such as menu items, tables, and store settings do allow direct writes for permitted roles.
- Give assistant access only to managers and admins.
Example prompts
- "Mark The Big Stack as unavailable."
- "Show waiting parties with a quoted wait over 20 minutes."
- "List menu items tagged for dinner, sorted by name."
- "Add a modifier called Extra Pickles to the Classic Burger."
It is not a customer-facing chat. It runs only inside the dashboard.