Tendrils.io
Insights

MCP architecture · 9 min read

MCP server design for a digital storefront: tools, resources, and checkout boundaries

Designing an MCP server for a storefront is mostly a set of decisions about what a machine client is allowed to see and do. Catalog search is a tool. Product documents are resources. Variant resolution is a tool. Availability is a resource with a freshness contract. Checkout is a boundary with a human on the far side. This post walks through each decision, including the ones most reference servers get wrong, like pricing exposure and rate limits that assume polite clients.

Server racks with network cables, the machine-facing side of a storefront that an MCP server exposes to AI agents
Your customers see a product page. An agent sees a tool list. This is the view the agent gets, and it deserves the same design effort.

What does the agent actually need from your storefront?

Start from the jobs, not the spec. A buying agent arrives at a storefront-shaped MCP server to do four things: find products matching a constraint, read enough detail to compare candidates, resolve a specific configuration it can price, and either check out or hand a prepared cart to a human. Everything the server exposes exists to serve one of those four jobs, and anything that does not is surface area you maintain and secure for no return.

This framing matters because it kills the most common first design mistake: mirroring your existing REST or Admin API one endpoint per tool. A REST API is organized around your data model. An agent is organized around its task. When you wrap endpoints, the agent has to know your data model to use it, which means pagination conventions, ID schemes, and join logic leak into prompts. When you wrap tasks instead, the tool list reads like the job list above, and the agent's model does the rest without training on your schema.

The reference design we use has five tools and a small resource tree. The tools: search_products, get_product_detail, resolve_variant, create_checkout, and get_order_status. The resources: product documents, specification sheets, availability records, and policy documents covering shipping, returns, and warranty. That is the whole surface. The rest of this post is why each piece sits where it does.

How do you split tools from resources?

MCP gives you two primitives that look interchangeable and are not. Tools are verbs: the agent calls them with arguments, something executes, and a result comes back. Resources are documents: named, fetchable blobs that a client reads like files, often cached or indexed client-side. The temptation on a first build is to make everything a tool because tools feel like APIs. Resist it. The split carries real semantics.

The rule of thumb that holds up: a tool computes, filters, or acts, while a resource states. Search is a tool because the result depends on the agent's query. A product document is a resource because it is the same bytes regardless of who asks. Availability sits in a gray zone, but we put it on the resource side deliberately: agents re-read availability constantly during a conversation, and a resource with a clean freshness contract beats a tool that invites hammering. The pricing and variant decisions get their own sections below, because they are the two storefront-specific calls that do not generalize from the usual todo-list examples.

[object Object]

Two failure modes sit on either side of the line. Make everything a tool and you get chatty agents paying a round trip per document plus a discoverability problem, since tools are for doing and agents underuse them for background reading. Make everything a resource and you lose the ability to enforce authorization and rate limits per call, because resource access is far coarser. The split is not aesthetic; it is where your access control model lives. Our MCP server glossary entry covers the primitive vocabulary if any of this is new.

Where does the checkout boundary go?

This is the decision that determines your blast radius. The question is not whether agents can shop; it is what happens at the moment money moves. There are three coherent designs, and they differ in who holds payment authority.

Design one, read-only with cart handoff: the server never creates a checkout. It exposes cart construction as structured output, and the agent's own client renders a checkout link the human clicks. Design two, checkout creation with human confirmation: the server exposes create_checkout, which builds a real checkout session and returns a URL, but payment completion happens on your normal checkout page in a browser under the human's control. Design three, full transaction: the agent completes payment inside the conversation using stored credentials or a delegated payment mandate, the pattern behind agentic checkout protocols now emerging from the big platforms.

For most storefronts, design two is the right initial perimeter. It gives agents an end-to-end journey, from search to a checkout the human opens and confirms, while keeping payment authorization, address entry, and the final fraud surface inside your existing checkout where your existing controls live. Design three is where the industry is heading, but it imports delegated-payment liability and a mandate format that is still settling. Design one is a legitimate starting point only if your catalog is genuinely informational; for a store that sells, the agent experience dead-ends awkwardly at the most valuable moment.

Whatever you pick, hold this boundary rule: every state-mutating capability is a tool, never a resource, and every mutating tool returns a human-verifiable artifact. create_checkout returns a URL a human can open and inspect before paying, not a silent order. If you are weighing the two checkouts against each other, our piece on what agentic commerce is frames the spectrum, and the build walkthrough for our agent-native storefront shows design two implemented on Shopify Plus.

How should machine clients authenticate?

Machine clients are not browsers and they are not admin users, so neither session cookies nor your staff tokens fit. The pattern that works is OAuth 2.1 with a small set of purpose-built scopes, because the spec and the ecosystem have converged on it and because scoped tokens map cleanly onto the boundary decisions above.

Design the scopes to match the perimeter, not the endpoints. Ours are: catalog:read for the anonymous-adjacent tier, cart:create for checkout creation, and account:read for order status and member pricing. The first scope is the interesting one. A surprising amount of traffic is best served by a lightweight, freely issuable credential that is still identified, because an identified anonymous client can be rate-limited, revoked, and studied, while truly anonymous traffic can only be blocked by network fingerprints. Issue cheap credentials fast; keep the expensive scopes behind real account binding.

Two details that bite in practice. First, agents retry aggressively on 401 and 403 responses, so your token endpoint needs its own rate limit or a single buggy client becomes an auth-flood incident. Second, log the credential on every call and make it easy to answer 'which agent did this,' because the day a client does something strange you will want attribution before you want a fix. This is the same discipline as any service-to-service auth; our auth microservice writeup covers scope design that translates directly.

What does availability need that ordinary data does not?

Availability is the one resource where a wrong answer converts directly into a customer-service ticket. An agent that quotes 'in stock' off a stale read creates an oversell with extra steps, and agents re-check availability constantly because their users ask 'is it actually available' repeatedly mid-conversation. That combination, high read volume plus high cost of staleness, is why availability is a resource and not a tool.

The design: one availability record per sellable SKU or variant, served as a resource with two attached promises. First, a freshness contract stamped on every response, the timestamp of the underlying inventory sync, so the agent can say 'as of ten minutes ago' instead of asserting certainty it does not have. Second, a closed vocabulary for states: in_stock, low_stock, made_to_order with a lead-time field, and out_of_stock. Free-text availability is a trap because agents will faithfully relay 'usually ships quickly' into a delivery promise your warehouse never made.

For make-to-order and vendor-fed catalogs, the honest state is usually made_to_order plus a lead time, not a count. That only works if your availability resource is downstream of a real sync pipeline; if the resource reads a number someone typed in January, the freshness stamp just documents staleness precisely. This is the same plumbing problem as keeping a storefront honest for human shoppers, which is why it rides on the same inventory sync layer described in our vendor sync post, and the failure mode when you skip it is documented in why stores oversell.

How do you resolve variants and expose pricing?

These are the two storefront-specific decisions that generic MCP guidance does not cover, and both are easy to get subtly wrong.

[object Object]

Variant resolution is computation with failure modes, which is the definition of a tool. The important design work is in the failure responses, not the success path: 'invalid combination, here are the three closest that resolve' is what lets an agent recover gracefully instead of brute-forcing your option space.

[object Object]

The pattern across both decisions is the same: compute at the boundary, expose the minimum. The agent does not need your option graph or your margin; it needs one resolvable configuration and one quotable number. This is also where the multi-vendor catalog pipeline underneath matters, because resolve_variant can only return real SKUs if your option data is clean upstream.

What does abuse look like, and what do you do about it?

Assume your clients will be impolite, because agent frameworks retry on a hair trigger and some agents will systematically crawl your entire catalog through search. Rate limiting for a machine-facing surface is different from web rate limiting in two ways: the offenders are usually well-funded automation rather than script kiddies, and a hard block often just triggers faster retry from a misconfigured client.

The controls that hold up: per-identity token budgets rather than per-IP limits (agents share cloud egress IPs, so IP limits punish the innocent and miss the guilty), separate budgets for search versus mutation tools (a search flood is annoying, a create_checkout flood fills your checkout tables with garbage sessions), and graduated responses. Return 429 with a Retry-After first, because well-behaved frameworks honor it. Escalate to temporary suspension for clients that keep hammering, and revoke credentials for the ones that treat suspension as a suggestion.

One storefront-specific abuse case deserves its own line: competitive price and assortment scraping through your own front door. Agents will enumerate your catalog through search; that is partly the point of exposing it. The lever is not preventing enumeration but pricing exposure, which is why the pricing tiers above matter more than any throttle. If the public tier only ever sees the public price, being crawled costs you little. And keep honest signals cheap: the agent check and the threat modeling on our developers page both treat identified-agent traffic as a feature to encourage, not a bug to block, because an identified crawler is auditable and an anonymous one is just a scraper with better manners.

What is the rollout order, and what would we do differently?

Ship the surface in three staged perimeters, each independently useful. Stage one: the full read surface, meaning search_products, get_product_detail, resolve_variant, and every resource, plus the anonymous-tier credential and per-identity budgets. Stage two: create_checkout with human-confirmation handoff, behind the cart:create scope, with checkout creation rate-limited separately from everything else. Stage three, only if demand proves it: account-bound order status and tiered pricing behind account:read.

Two lessons from building these. First, stage ordering should follow security blast radius, not demo appeal. A demo that jumps to checkout creation looks great in a video and inherits fraud surface, abandoned-session cleanup, and mandate questions before you have attribution working. Second, test with real agent clients, not a hand-rolled JSON-RPC caller. An LLM client will call resolve_variant with 'the blue one, but bigger' as literal arguments, and your error responses either teach it to recover or teach it to flail. Our MCP server development service builds and load-tests this surface against actual agent frameworks for exactly that reason.

The punch list we would hand any team starting now: tasks not endpoints, documents as resources, mutations as tools with human-verifiable artifacts, identified anonymous credentials before real scopes, a freshness contract on availability, tiered pricing as policy, and per-identity budgets with a separate line for mutations. Get those seven right and the server is boring in the best way: agents can shop, humans still authorize money, and your on-call phone stays quiet.

Questions this answers

What is the difference between an MCP tool and an MCP resource for a storefront?

Tools are verbs the agent calls with arguments: search_products, resolve_variant, create_checkout. Resources are documents the client fetches: product pages, spec sheets, availability records, policies. The rule of thumb is that tools compute or mutate while resources state, and the split matters because it is where per-call authorization and rate limiting live.

Should a storefront MCP server let agents complete checkout?

Most stores should start one step short: let agents create a checkout session and return a URL, but keep payment on your normal checkout page under human confirmation. Full in-conversation payment is arriving via delegated-payment protocols, but it imports liability and mandate handling most teams are not ready to own on day one.

Do I need to build a custom MCP server for Shopify?

Shopify exposes catalog primitives through its own APIs, and commerce MCP reference implementations exist to adapt. The custom work is not the protocol; it is the storefront-specific decisions: variant resolution against your option space, availability with a real freshness contract, tiered pricing, and checkout boundaries. That is the layer our MCP server development service builds.

How do you authenticate AI agents against an MCP server?

OAuth 2.1 with scoped tokens. Issue a cheap, identified anonymous credential for catalog read access so all traffic is attributable and rate-limitable, then bind real accounts to scopes like cart:create and account:read for mutation and private data. Rate-limit the token endpoint itself, because agents retry auth failures hard.

What is the minimum viable MCP surface for a store?

Three tools (search_products, get_product_detail, resolve_variant), product and policy resources, and an availability resource with freshness stamps. That covers discovery through configuration. Add create_checkout when you want agents to reach a purchasable endpoint instead of handing off a cart description.

How do you stop agents from abusing a storefront MCP server?

Per-identity token budgets rather than IP limits, separate budgets for search versus mutating tools, and graduated enforcement: 429 with Retry-After, then suspension, then revocation. Keep catalog crawling cheap to survive by making the public tier public-priced only, so enumeration yields nothing your product page does not already show.

Want an MCP storefront designed around real boundaries?

We design and build MCP servers that expose catalogs to agents without exposing your margin, your checkout, or your on-call rotation. See the MCP server development service, read the developers page for how we think about machine clients, or book a call to scope your server surface together.

New systems notes when we publish: