Furniture Sourcing MCP
by avakode
README.md
# Furniture Sourcing MCP
A remote MCP server that lets an AI assistant help someone furnish a room from start to finish: turn a
client brief into a shortlist, search a catalog by exact dimensions, compare, save and swap pieces in
projects, and total up a room.
It is a working demo on a **mock catalog**: about 500 pieces from 60 sellers and 110 makers, all
fictional. Nothing here is for sale.
| | |
|---|---|
| MCP server | `https://furniture-mcp.avakode-dev.workers.dev/mcp` |
| Landing page | <https://furniture-mcp.avakode-dev.workers.dev/> |
| Mock platform API | <https://furniture-catalog-api.avakode-dev.workers.dev/> ([OpenAPI](https://furniture-catalog-api.avakode-dev.workers.dev/openapi.json)) |
## Try it
**Claude** (web or desktop): Settings → Connectors → Add custom connector, paste the MCP server URL,
then sign in on the page that opens. **ChatGPT**: turn on developer mode and create a connector with the
same URL. **MCP Inspector**: `npx @modelcontextprotocol/inspector`, add the URL as a Streamable HTTP
server; its Apps tab renders the widgets.
Sign-in asks for a role and a display name, no password. Every sign-in gets its own private sandbox
account, seeded for the role: an interior designer with two client projects, a gallery salesperson who
owns one gallery's listings, or a homeowner with one room started.
Things to ask:
- Find me a walnut sideboard under 180 cm wide for under $4,000.
- Same, but it has to be in stock and no wider than 160 cm. What do I gain if the client stretches the budget?
- Furnish a 5.2 × 3.8 m living room for a young couple: warm, minimal, lots of wood, $12,000.
- Compare the first three and save the best one to the Hale residence, dining room.
- Swap the coffee table in the Hale living room for something in travertine under $1,500.
- What does the Hale residence come to in GBP, and what is left of the budget?
## What it looks like
Screenshots from the MCP Inspector (2.17) connected to the live server after the OAuth sign-in.
The walnut sideboard request, answered by `search_pieces` and rendered as the shortlist widget:

Two pieces ticked and compared inside the widget, one saved to a project:

A room brief turned into options per slot by `shortlist_for_brief`:

The project board on `get_project`, with rooms, subtotals and the budget:

The sign-in page:

## How it is put together
```
AI assistant ──MCP (Streamable HTTP, OAuth 2.1)──▶ mcp-server ──service binding──▶ catalog-api
tools, widgets, sign-in mock platform: REST, data, projects
```
Two Cloudflare Workers in TypeScript.
- [`services/catalog-api`](services/catalog-api) stands in for the real platform and is deployed as its
own service with a plain REST API: search with filters and cursors, pieces, sellers, accounts,
projects with idempotent writes, `problem+json` errors, an OpenAPI document. Accounts and projects live
in a SQLite-backed Durable Object per user. The catalog comes from a seeded generator, so it is
reproducible; product images are SVG drawings made from each piece's real proportions and materials.
- [`services/mcp-server`](services/mcp-server) is the MCP server. It holds no catalog data. One module,
[`catalog-client.ts`](services/mcp-server/src/catalog-client.ts), knows the REST API; replacing the
mock with a real backend means replacing that module.
- [`packages/contract`](packages/contract/src/index.ts) holds the REST types both services import.
The full design, including every tool's inputs and outputs, is in [`docs/design.md`](docs/design.md).
## Tools
Nine tools, shaped around what a designer is trying to get done rather than one tool per endpoint.
| Tool | What it is for |
|---|---|
| `search_pieces` | One kind of piece with exact limits: category, materials, size per axis, price, period, maker, place, availability |
| `shortlist_for_brief` | A room brief (style, size, budget) turned into options per slot that fit the room and the money |
| `get_piece_details` | Full specs and all images for 1–5 pieces |
| `compare_pieces` | 2–4 pieces side by side, with the differences spelled out and an optional fit check |
| `list_projects` | The account and its projects with counts and totals |
| `get_project` | One project by room, with subtotals, budget and availability warnings |
| `save_to_project` | Save pieces to a project or wishlist; safe to retry |
| `edit_project` | Swap, remove, move, re-quantify, rename, set budget; all or nothing |
| `get_cost_summary` | Cost of a room, a project or any list, in a chosen currency, against a budget |
Decisions behind them:
- **One call for one intent.** "A walnut sideboard under 180 cm for under $4,000" is a single
`search_pieces` call with nested size limits and a unit, not a chain of small lookups.
- **Near misses.** When fewer than three pieces match, the answer says what relaxing one limit would
add ("width up to 180 cm (+20): +3", "budget up to $4,050 (+15%): +2", "also oak or teak: +1"), each
with an example. The assistant can offer the trade-off in the same turn.
- **Answers sized for a context window.** Eight compact cards by default, twenty at most, a total and a
cursor. Long descriptions only in `get_piece_details`. Every tool returns a short readable text and
structured content that matches its output schema.
- **Errors that say what to do.** Unknown values come back with the closest valid ones and the next call
to make; an unknown project name lists the projects that exist.
- **Units and money are explicit.** Inputs take a unit; answers always carry centimetres and inches.
Totals show the listing price and USD. Price-on-request pieces are listed apart, never dropped.
- **Writes are safe to repeat.** Saving the same piece to the same room updates the item. `edit_project`
validates every operation before applying any.
- **The tool layer is portable.** Tools are plain definition objects (name, schemas, annotations,
handler) under [`src/tools`](services/mcp-server/src/tools); one thin adapter registers them with the
MCP SDK. Moving to another MCP framework means rewriting the adapter.
## Sign-in
OAuth 2.1 authorization code flow with PKCE (S256 only), dynamic client registration and client ID
metadata documents, protected-resource and authorization-server metadata on the well-known paths,
refresh tokens. Scopes: `catalog:read`, `projects:read`, `projects:write`; each tool checks what it
needs. The consent page shows who is asking and where the user returns, and is protected against
cross-site requests and framing. In the demo it creates a sandbox account; with a real platform this
page hands over to the platform's own login.
## Widgets
Two MCP Apps views render in hosts that support them:
- **Shortlist carousel** on `search_pieces` and `shortlist_for_brief`: cards with image, maker,
dimensions, price and availability, with "Save to project" and "Compare".
- **Project board** on `get_project`: rooms as columns, subtotals, a budget bar, quantity and remove
controls.
Hosts without MCP Apps get the same information as text and structured content.
Both widgets call tools through the host: saving, comparing and changing quantities go through
`save_to_project`, `compare_pieces` and `edit_project`, so the assistant and the widget see the same
state.
## Limits on the public demo
Sign-in and client registration are rate limited per address and in total, and the demo creates at most
400 sandbox accounts a day. A sandbox that is not used for 30 days is deleted.
## Run it locally
Node 22 or newer.
```bash
npm run setup # installs both services
cp services/catalog-api/.dev.vars.example services/catalog-api/.dev.vars
cp services/mcp-server/.dev.vars.example services/mcp-server/.dev.vars # same INTERNAL_KEY in both
npm run dev:catalog # http://localhost:8787
npm run dev:mcp # http://localhost:8788 (MCP at /mcp)
npm test # unit and integration tests of both services
npm --prefix services/mcp-server run e2e # scripted client: discovery, registration, consent, tokens, every tool
```
`npm run generate` rebuilds the catalog from its seed.
## What is real and what is mocked
Real: the MCP server, the OAuth flow, tool contracts, pagination, error handling, idempotent writes, the
widgets. Mocked: the catalog content, the images, the user directory (sign-in without passwords),
currency rates (static).
## Licence
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues