Building an MCP Server for a Magento Catalog
Shoppers are starting to ask AI assistants the questions they used to type into a search bar. "Find me a 12V water pump under £40 that's in stock." Today the assistant scrapes a few product pages, guesses at the price, and sometimes invents the availability. That's a bad experience for the shopper and a missed sale for the merchant.
The fix is to stop making AI agents scrape, and start letting them *ask*. That's what an MCP server for Magento does — and it's exactly what we built with Horizon.
What is MCP, and why a server?
The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools and data. Instead of parsing HTML, an MCP-compatible model — Claude, ChatGPT, Perplexity, or an enterprise buyer agent — calls typed tools and gets structured data back. "Search products," "get inventory," "get this product's price" become real function calls with real schemas.
A Magento MCP server is the piece that sits between those agents and your store: it speaks MCP to the agent, and the Magento API to your catalog. Get it right and your products are presented accurately — correct price, live stock, real specifications — instead of hallucinated.
The architecture
We deliberately split Horizon into two parts rather than bolting MCP straight onto Magento:
┌──────────────┐ MCP ┌──────────────────┐ API ┌────────────────┐
│ AI Agents │ ───────▶ │ Horizon Server │ ──────▶ │ Magento Store │
│ (Claude, …) │ HTTP │ (Rust / rmcp) │ │ (thin module) │
└──────────────┘ └──────────────────┘ └────────────────┘
1. A Rust gateway built on Axum and the rmcp crate, exposing an MCP endpoint over Streamable HTTP. This is where protocol handling, auth, rate limiting, usage metering, and multi-tenant isolation live — none of which you want running inside the Magento request cycle.
2. A thin Magento module that adds one lightweight, read-only endpoint. No core patches, no writes, no measurable storefront impact — it typically answers in under 50ms.
Keeping the protocol logic in a separate Rust service buys three things: the gateway can be hardened and scaled independently of the store, one server can front many stores, and the agent-facing contract stays stable even as Magento internals change.
The eight tools
The whole catalog collapses into eight MCP tools, each returning typed, canonical data:
search_products— query by name, SKU, or description with category/type/stock filters and paginationget_product— full detail: description, pricing, images, categories, attributesget_categories— the category tree with depth controlget_inventory— stock levels by SKU and sourceget_orders/get_order— order lookups with filtersget_customers— customer search by name/emailping— connectivity check
ProductSummary, ProductDetail, Category — a clean canonical shape. That abstraction matters more than it looks: the same eight tools describe *any* commerce catalog, not just Magento, which is what lets the gateway grow beyond a single platform later.
Why a flat index, not EAV
Magento stores product data in EAV — flexible, but slow to read, with a single product fanning out into dozens of joins. An AI agent fielding a live shopper query can't wait on that.
So the module maintains a flat, denormalised AI-index table: the fields agents actually ask for, pre-joined, refreshed on catalog changes via a push webhook. The agent gets a sub-50ms answer; the store does almost no work per request.
Why read-only (for now)
Every Horizon tool reads. None writes. That's a deliberate trust boundary: letting an autonomous agent mutate a live store — change prices, cancel orders — is a different project with a much higher security bar. We'd rather ship a rock-solid read surface that makes catalogs *discoverable* than a risky write surface nobody can safely enable. Agent-driven writes are a separate roadmap item, gated behind explicit confirmation and audit logging.
Answer Engine Optimization
There's a marketing-shaped side effect to all this. When an AI assistant summarises a product for a shopper, it can now pull accurate, structured facts instead of guessing. We call this Answer Engine Optimization — the AEO counterpart to SEO. The merchants who make their catalogs machine-readable now will be the ones AI assistants cite as the channel grows.
Security
Because the gateway is the only thing facing the agents, security lives in one place: per-store API keys (rotatable), request rate limiting per plan, and full usage logging of every tool call. A store's data is only ever reachable by an authorised key.
---
If you run a Magento store, your catalog is currently invisible to the assistants your customers are starting to shop with. An MCP server fixes that.