Furniture Sourcing MCP
README.md
# Furniture Sourcing MCP
A remote MCP server, written in TypeScript, that lets Claude or ChatGPT help an interior designer furnish a room. It searches a furniture catalog with real constraints (size in cm, price in USD, material, style, period, stock), builds a shortlist from a room brief, compares finalists and keeps a running project budget.
- Live page: https://furniture-sourcing-mcp-demo.vercel.app
- MCP endpoint (Streamable HTTP, no auth): `https://furniture-sourcing-mcp-demo.vercel.app/mcp`
This is a public demo. The catalog is mock data (76 pieces), images are placeholders and projects are stored in memory. See [Limits of the demo](#limits-of-the-demo).

## Try it
Ask your assistant things like:
- "Find me a walnut sideboard under 180 cm wide for under $4,000."
- "Shortlist a Japandi bedroom for $7,000. The bed wall is 210 cm wide."
- "Start a project called Hudson Loft with a $25,000 budget, put the cheapest of those sideboards in the dining room, and show me the cost summary."
- "Compare sb-101, sb-102 and sb-113."
### Claude
Open Settings, then Connectors, choose "Add custom connector", and paste the endpoint URL above. No OAuth settings are needed. Enable the connector in a chat.
### ChatGPT
Turn on developer mode in ChatGPT settings, create a connector with the endpoint URL and choose no authentication.
### MCP Inspector
The Inspector needs Node.js 22 or newer.
```bash
npx @modelcontextprotocol/inspector
# choose Transport: Streamable HTTP and paste the endpoint URL
# or from the command line
npx @modelcontextprotocol/inspector --cli https://furniture-sourcing-mcp-demo.vercel.app/mcp \
--transport http --method tools/call --tool-name search_pieces \
--tool-arg category=sideboard --tool-arg 'materials=["walnut"]' \
--tool-arg max_width_cm=180 --tool-arg max_price=4000
```
### curl
```bash
curl -s https://furniture-sourcing-mcp-demo.vercel.app/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_pieces",
"arguments":{"category":"sideboard","materials":["walnut"],"max_width_cm":180,"max_price":4000}}}'
```
## Tools
Required fields are marked with `*`. Everything else has a default.
| Tool | What it does | Inputs |
| --- | --- | --- |
| `search_pieces` | Filtered search with sorting and cursor pagination. Compact results. | `query`, `category`, `materials`, `style`, `period`, `maker`, `location`, `stock_status`, `min_width_cm`, `max_width_cm`, `min_depth_cm`, `max_depth_cm`, `min_height_cm`, `max_height_cm`, `min_price`, `max_price`, `sort`, `limit`, `cursor` |
| `get_piece_details` | Full specs, description, gallery and all image URLs. | `piece_ids*` (1 to 10) |
| `shortlist_for_brief` | Turns a room brief into one pick per category that fits the budget, plus alternatives with the cost of swapping each in. | `room_type*`, `budget_usd*`, `style`, `period`, `materials`, `must_have` (category, quantity, max sizes), `in_stock_only`, `options_per_category` |
| `create_project` | Starts a client project. Returns `project_id`. | `name*`, `budget_usd`, `rooms`, `client_name` |
| `add_to_project` | Adds a piece to a room. Returns the running total. | `project_id*`, `piece_id*`, `room`, `quantity`, `note` |
| `remove_from_project` | Removes a piece or part of its quantity. | `project_id*`, `piece_id*`, `room`, `quantity` |
| `swap_in_project` | Replaces one piece with another, keeping room, quantity and note. Returns the price change. | `project_id*`, `current_piece_id*`, `new_piece_id*`, `room` |
| `compare_pieces` | Side-by-side table of 2 to 5 pieces with highlights. | `piece_ids*` |
| `project_cost_summary` | Subtotals per room and category, total, and over or under budget. | `project_id*` |
### Example: the walnut sideboard request
`search_pieces` with `category: "sideboard"`, `materials: ["walnut"]`, `max_width_cm: 180`, `max_price: 4000` returns 5 matches (trimmed):
```json
{
"total_matches": 5,
"showing": "1-5 of 5",
"applied_filters": {
"category": "sideboard", "materials": ["walnut"], "max_width_cm": 180, "max_price": 4000,
"stock_status": "in_stock, made_to_order (default, sold pieces hidden)",
"sort": "relevance (default)"
},
"results": [
{
"id": "sb-101", "title": "Walnut sideboard with tambour doors", "maker": "Linden & Pike",
"price_usd": 3200, "dims_cm": "160 W x 45 D x 76 H", "materials": "walnut, brass",
"style": "Minimalist", "period": "Contemporary", "stock": "in_stock",
"location": "New York, US", "image_url": "https://picsum.photos/seed/sb-101/1200/900"
}
],
"next_cursor": null
}
```
The other four are `sb-113` ($3,950, 168 cm), `sb-102` ($3,850, 175 cm), `sb-104` ($1,850, 152 cm) and `sb-103` ($2,900, 178 cm, made to order). The catalog also has walnut sideboards that are too wide (200 and 214 cm), too expensive ($4,200 and $5,400) or sold, so the filters have something to do.
## Design choices
- **Tools follow the designer's task, not the database.** Search, shortlist for a brief, compare, and a project with a budget. There is no generic "get table rows" tool.
- **Small responses.** Lists return about 60 tokens per piece, 8 per page by default (max 25), with `total_matches`, `applied_filters` and an opaque `next_cursor`. Full specs and all images come from `get_piece_details` only when needed.
- **Sensible defaults.** Sold pieces are hidden unless asked for. Units are always cm and USD. Size and price limits are inclusive. Dining chairs sold as a "set of 6" are counted correctly when a brief asks for 4 or 8 seats.
- **Errors that say how to fix the call.** Unknown ids get "did you mean" suggestions. A minimum above a maximum is rejected. Unknown argument names (for example `material` instead of `materials`) are rejected instead of being silently ignored. A cursor reused with different filters is rejected. Numbers typed into the free-text query are ignored with a note to use the numeric filters.
- **Empty results are useful.** When nothing matches, the response says which single filter to relax (and how many results that gives) and lists the nearest misses with how far off each one is, for example "width 152 cm, 2 cm over max_width_cm; $1,850, $350 over max_price".
- **Every change returns the running total.** `add_to_project`, `remove_from_project` and `swap_in_project` all return the project total and the remaining budget or overspend, so the assistant does not need an extra call.
- **Tool annotations.** Read-only tools are marked `readOnlyHint`, and removing or swapping is marked `destructiveHint`, so clients can decide what needs confirmation.
## How it is built
- Next.js 16 app on Vercel. The MCP endpoint is a route handler at `app/mcp/route.ts`.
- [`mcp-handler`](https://www.npmjs.com/package/mcp-handler) 2.x with the MCP TypeScript SDK v2 (`@modelcontextprotocol/server`). It serves the current MCP spec statelessly and falls back to 2025-era Streamable HTTP for older clients from the same URL.
- Tool inputs are zod schemas with a description on every field. The landing page lists the tools straight from the same definitions, so the docs cannot drift from the code.
```
app/mcp/route.ts MCP endpoint (Streamable HTTP) with open CORS
app/page.tsx landing page
lib/catalog.ts mock catalog (76 pieces)
lib/search.ts filtering, relevance, cursors, zero-result hints
lib/shortlist.ts room brief to budget-fitting shortlist
lib/projects.ts in-memory projects, compare, cost summary
lib/tools.ts tool names, descriptions, zod schemas, registration
scripts/smoke.ts end-to-end JSON-RPC test against any URL
```
## Run locally
Requires Node.js 20.9 or newer.
```bash
npm install
npm run dev # http://localhost:3000, endpoint at /mcp
npm test -- http://localhost:3000/mcp # 20 end-to-end checks over real JSON-RPC
```
`npm test` also works against the live URL: `npm test -- https://furniture-sourcing-mcp-demo.vercel.app/mcp`.
## Limits of the demo
- **Mock data.** Every listing, price, stock status and gallery is invented. Designer names are only there to make the listings realistic. Images are placeholders from picsum.photos.
- **In-memory projects.** Projects live in the memory of the running server instance. They reset on redeploys and cold starts, and two requests can land on different instances. Expired projects are pruned after 7 days. A real deployment would store projects in a database (for example Postgres) keyed by user.
- **No auth.** Anyone can call the endpoint, and anyone who has a `project_id` can read or change that project. That is fine for a demo with fake data and not fine for production.
## Auth in production
The plan for a production version follows the MCP authorization spec, which is built on OAuth 2.1:
1. **The MCP server is an OAuth resource server.** It publishes Protected Resource Metadata (RFC 9728) at `/.well-known/oauth-protected-resource`, naming its authorization server. Requests without a valid token get `401` with a `WWW-Authenticate` header that points to that metadata, which is how MCP clients discover where to log in. `mcp-handler` provides `withMcpAuth` and `protectedResourceHandler` for exactly this.
2. **A standard authorization server** (a hosted identity provider or the product's own) publishes its metadata (RFC 8414) and supports the authorization code flow with PKCE. For client registration it supports Client ID Metadata Documents, which the current MCP spec prefers, and Dynamic Client Registration (RFC 7591) for clients that still use it. Users sign in with their existing account and approve the requested scopes.
3. **Tokens are short-lived and bound to this server.** Clients request them with a resource indicator (RFC 8707) for the MCP URL. The server checks signature, issuer, audience and expiry on every request, and never forwards the token to other APIs.
4. **Scopes match the tools.** For example `catalog:read` for search, details, compare and shortlist, `projects:read` for cost summaries, and `projects:write` for create, add, remove and swap. A call without the needed scope gets `403` with an `insufficient_scope` challenge so the client can ask the user for more access.
5. **Per-user project access.** Projects move to a database with an owner (the token's subject) and optionally a studio or team. Every project query is filtered by the caller's identity, so a project id on its own is never enough to read or change a project. Inside a tool, the caller is available from the request's auth info.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues