MCP Hub
Back to servers

FoodDash

An MCP server and app that enables users to browse restaurants, view menus, manage shopping carts, and place food orders with live status tracking. It serves as a reference implementation for MCP Apps SDK patterns like tool visibility, lifecycle hooks, and structured content.

glama
Updated
Mar 10, 2026

FoodDash

A food ordering MCP App that demonstrates key MCP Apps SDK patterns. Browse restaurants, view menus, add items to cart, and place orders — all within an MCP host.

Getting Started

bun install
bun run dev

The server starts at http://localhost:3001/mcp.

Scripts

CommandDescription
bun run devStart dev server with hot reload (web + server watch)
bun run buildProduction build (typecheck → web → server bundle)
bun run startRun the built server in production mode
bun run typecheckType-check only
bun run build:webBuild web assets only
bun run build:serverBundle server entry only
bun run dev:serverWatch and restart server

MCP Apps Concepts Demonstrated

This app is designed as a learning reference. Each concept is documented with inline comments in the source code.

Tool Visibility

Two kinds of tools share one UI:

ToolVisibilityPurpose
order-foodModel + AppModel calls this when user says "order food". Opens the UI.
get-order-summaryModel + AppModel calls this when user asks "where's my food?". Same UI.
get-menuApp onlyUI calls this when user taps a restaurant. Model never sees it.
place-orderApp onlyUI calls this when user clicks "Place Order".
get-order-statusApp onlyUI polls this every 10s for live order tracking.
apply-promoApp onlyUI calls this when user applies a promo code.

Why it matters: Model-visible tools give the LLM a clean, high-level interface ("order food", "check order status"). App-only tools handle granular CRUD that shouldn't clutter the model's tool list.

Lifecycle Hooks (mcp-app.tsx)

HookWhen it firesWhat FoodDash does
ontoolinputTool invoked, BEFORE server respondsPre-sets cuisine filter from model's cuisine argument
ontoolresultAFTER server returnsLoads restaurant list or order data into state
ontoolcancelledHost cancels a tool callResets loading spinners
onteardownHost is closing the appReturns order summary or abandoned cart info to the model
onhostcontextchangedHost theme/viewport changesUpdates safe area insets

Structured Content

Every tool result carries two payloads:

  • content[] — text the model reads in its conversation
  • structuredContent — JSON the app UI parses to render

They can carry different levels of detail. See server.ts for examples.

Shared Resource URI

Both order-food and get-order-summary point to the same resourceUri. The host renders one UI instance and routes different tool results to it. The app distinguishes them by the shape of structuredContent.

App → Server Communication

The app calls server tools via app.callServerTool(). This is the reverse of the model calling tools — the app initiates calls for app-only operations like fetching menus and placing orders.

Features

  • Browse 5 restaurants with ratings, hours, delivery info, and feature tags
  • Search, filter by cuisine, and sort by rating/delivery time/fee
  • Menu items with dietary labels, calorie counts, and popularity badges
  • Dietary filter pills on the menu view
  • Cart with quantity controls, special instructions, and promo codes
  • Promo codes: WELCOME10 (10% off), FREEDEL (free delivery), SAVE5 ($5 off)
  • Live order tracking with auto-advancing status (confirmed → preparing → on the way → delivered)
  • Light and dark mode support

Project Structure

server.ts                  MCP server, tools, and mock data
main.ts                    Express entry point (HTTP + stdio)
src/
  mcp-app.tsx              React entry point + lifecycle hooks
  types.ts                 Shared TypeScript interfaces
  constants.ts             Dietary labels, order steps, sort options
  global.css               Design tokens and animations
  hooks/
    useAppState.ts         Central state management + server tool calls
  components/
    Header.tsx             Sticky header with back button and cart badge
    DeliveryAddressBar.tsx Address input
    RestaurantsView.tsx    Restaurant list with search/filter/sort
    RestaurantCard.tsx     Restaurant card
    SortDropdown.tsx       Sort selector
    RestaurantBanner.tsx   Restaurant detail header in menu view
    MenuView.tsx           Menu with dietary filters and categorized items
    MenuItemCard.tsx       Menu item with dietary badges and calories
    DietaryBadge.tsx       Dietary label pill
    CartView.tsx           Cart, promo code, special instructions, summary
    QuantityControl.tsx    +/- quantity buttons
    OrderTrackingView.tsx  Live order tracking with progress stepper
    ProgressStepper.tsx    4-step horizontal progress indicator
    EmptyState.tsx         Empty state placeholder

Reviews

No reviews yet

Sign in to write a review