Build a remote MCP server for ecommerce: tools, auth and review-ready metadata
Design a remote MCP server for ecommerce: catalog, stock and order tools, auth, a TypeScript example and why checkout stays out.
Build a remote MCP server for ecommerce
Short answer: an ecommerce server for a public catalog needs read-only search, product and availability tools, no authentication and no checkout or payment tool. Order lookup is user data, so ship it as a separate OAuth endpoint.
Basis: the MCP specification, the official TypeScript SDK docs (v2, package @modelcontextprotocol/server, read 2026-12-04) and our scanner rule pages. Tool sets are our recommendation, not a requirement. Anything marked (unverified) is not confirmed in those sources.
Recommended tool set
Say whose catalog it is, and return price with currency and a stable product id.
search_products
- Title: Search products
- Description: see the example below.
- Input:
querystring, required;categorystring;max_pricenumber;limitinteger 1 to 20 - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
get_product
- Title: Get product details
- Description: "Use this for the full details of one product by id: description, sizes, price, currency and rating."
- Input:
product_idstring, required - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
check_availability
- Title: Check availability
- Description: "Use this to check whether a product and size is in stock and when it ships to a postal code."
- Input:
product_id,size,postal_codestrings - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
get_order_status
- Title: Get order status
- Description: "OAuth endpoint only. Use this to look up the signed-in customer's order by number. Returns status and tracking."
- Input:
order_numberstring, required - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
Annotations are hints, not security (see annotations explained). Here openWorldHint is true only where a tool reaches arbitrary outside parties, and false for a fixed domain. Catalog tools read your own data (closed domain). Do not add place_order or add_payment_method.
Auth
Recommendation: no authentication. This is public read-only data, which the checks accept. Hold any upstream key on your server so no user ever types one (schema.secret-param). Add no write tools to a no-auth server, because auth.write-tools-unauthenticated warns when it lists create, update or delete tools. Without sign-in your protection is rate limiting and bounded results; see rate limits and 429s. Put get_order_status and any account tool on an OAuth endpoint; the public catalog endpoint stays open (recommendation).
Transport
Serve Streamable HTTP on one HTTPS path such as https://mcp.example.com/mcp (auth.https). In the v2 SDK, createMcpHandler(factory) builds a fresh McpServer for every request, so the endpoint is stateless and needs no sticky sessions (sessions and serverless). The handler checks no Host, Origin or token itself, so put those checks in front of it. Still on SSE? See the migration guide. Keep the handshake fast (latency.handshake).
Minimal TypeScript example
This targets SDK v2; coming from v1, use the SDK's migration guide. In v2 inputSchema is a z.object(...). Replace lookup with your own code.
import { createMcpHandler, McpServer } from '@modelcontextprotocol/server';
import * as z from 'zod/v4';
const handler = createMcpHandler(() => {
const server = new McpServer({ name: 'acme-shop', version: '1.0.0' });
server.registerTool(
'search_products',
{
title: "Search products",
description:
"Use this to search the Acme Outdoors catalog by keyword, category or price range. Returns up to 20 products with id, name, price and currency. Covers only Acme Outdoors products.",
inputSchema: z.object({
query: z.string().describe('Keyword, for example rain jacket'),
max_price: z.number().positive().optional(),
limit: z.number().int().min(1).max(20).default(10)
}),
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }
},
async (args) => {
const result = await lookup(args); // your upstream call
if (!result) return { isError: true, content: [{ type: 'text', text: 'No products matched. Try a broader keyword.' }] };
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
}
);
return server;
});
export default handler; // web-standard runtimes; wrap with toNodeHandler on Node
Return price as a number plus a currency field.
Errors, size and speed
Return isError: true with text that says what was wrong and how to fix it; messages such as "Internal Server Error" fail review (errors.unhelpful-message). Reviewers run every tool with valid input and reject failures (errors.fixture-failed). Keep a call under 3 seconds where you can: the scanner warns above 3 and fails above 15 (latency.tool-call). For slower work see tool timeouts, cap result size (response size limits) and never echo keys or tokens in output (errors.secrets-in-output). Run the same calls in CI so a regression never reaches review.
Getting models to pick your tools
The leaderboard method shows the model every tool in the category as a function named <server>__<tool>, with your description and input schema, and records the first tool it calls. Your name, description and schema are the whole pitch. In the December 4 2026 run, 59.3% (64 of 108) of ecommerce trials ended with no tool called. The ecommerce set mostly asks about the user's own account or orders, so 59.3% no-tool is expected for a catalog server. Name the brand and range in the first sentence, so a general shopping question does not pick you by mistake and a specific one does. Keep marketing words out of product-facing text copied into descriptions. Limits apply: the harness is offline, uses one model family, and measures selection, not correct answers. Rewrite method and prompt sets are in writing tool descriptions models pick; write about your own task and sibling tools, never about other servers (desc.injection-directive).
Pitfalls our rules catch
- Checkout and payment tools are rejected (policy.money-movement).
- Card numbers as parameters fail schema.secret-param.
- Sales language trips desc.promotional and price text trips desc.pricing-mention.
- Mirroring a store API produces long lists (count.vscode-limit).
Submission checklist
- Run the scan at https://mcpshipyard.com/scan and clear every blocker.
- Every tool has
title, a description, aninputSchemaand explicitreadOnlyHint,destructiveHintandopenWorldHint(annotations explained). - Reproduce the failures in works in Inspector, fails in Claude before you submit.
- Claude: walk the Claude connector directory submission checklist.
- ChatGPT: walk the ChatGPT app submission checklist.
- Optional listings: Grok Build (formerly Cursor) and the official registry.
- Set up monitoring before launch.
- No tool places an order, takes a payment or moves money.
- Order tools are only on the OAuth endpoint.
Check your server against these rules at https://mcpshipyard.com/scan.
Check your server against these rules
Scan runs the checks from this guide against a live URL and lists each failing rule with its fix.