Search Documentation

Search for a documentation page...

MCP Server

Connect an AI agent to a Your Next Store store over the Model Context Protocol – endpoint, authentication, and the two tools that cover the whole Store API.

Every store is also reachable over the Model Context Protocol, so an agent can run store operations without you building an integration first.

https://yns.store/mcp

Streamable HTTP, scoped to one store, able to do anything the REST API can. https://yournextstore.com/mcp is the same server under a second address, and both authentication methods work on either.

Authentication

Either credential works:

  • Store API key – send Authorization: Bearer sk-…, from Settings → API → API keys.
  • OAuth 2.1 – connect with a YNS account. Clients discover the authorization server the standard way: an unauthenticated request answers 401 with WWW-Authenticate: Bearer resource_metadata="https://yns.store/.well-known/oauth-protected-resource". Authorized apps appear under Settings → Connected apps, and disconnecting one revokes access immediately. An OAuth connection can do no more than the person who connected it: a teammate with a limited role gets 403 on anything outside it.
{
"mcpServers": {
"yns": {
"type": "http",
"url": "https://yns.store/mcp",
"headers": { "Authorization": "Bearer sk-your-api-key" }
}
}
}

Tools

The whole API is exposed through two tools rather than one per endpoint, which keeps the tool list small enough to stay in an agent's context:

ToolUse
search_apiDiscover endpoints. Returns a compact index of { method, path, operationId, summary }, optionally filtered by a substring query. Read-only. Call this first when you don't know the exact path.
execute_apiCall one /api/v1/* endpoint. GET reads; POST, PUT, PATCH and DELETE write. Substitute path parameters inline and pass body as a raw JSON object.
search_api { "query": "inventory" }
→ [{ "method": "POST", "path": "/api/v1/inventory/adjust", "operationId": "adjustInventory", … }]

execute_api { "method": "POST", "path": "/api/v1/inventory/adjust",
"body": { "variantId": "019…", "delta": -3, "reason": "damaged" } }

Nothing is evaluated server-side – the agent composes the calls in its own loop.

One tool per endpoint

Add ?codemode=false (https://yns.store/mcp?codemode=false) to get one tool per Store API operation instead, named by its operationId (listOrders, createProduct, …). Path parameters are arguments by name, query string parameters go in query, and a JSON request body goes in body. Use it only when your client can't work with search_api and execute_api, for example when it composes several servers in its own code mode: the tool list is several hundred tools long. File uploads and CSV imports have no tool of their own in this mode.

Directory versions

The Claude and ChatGPT directories list their own versions of the server, which leave out the operations each directory doesn't allow. They sign in the same way and act on the same store.

AddressToolsLeft out
https://yournextstore.com/mcp/claudesearch_api and execute_api (?codemode=false for one per endpoint)Refunds, gift card changes, AI image and video generation, connecting shipping or tracking add-ons, resetting the catalog and transferring store ownership
https://yournextstore.com/mcp/chatgptOne tool per endpointRefunds, gift card changes, subscription plans and boxes, cart checkout links, ticket attendee profiles, connecting shipping or tracking add-ons, resetting the catalog and transferring store ownership

Both reach only the documented endpoints. To do what they leave out, use the dashboard or the full server.

Storefront MCP server

A separate, unauthenticated MCP server runs on each storefront at https://<your-store-domain>/api/mcp, meant for shopping assistants rather than administration. It has two groups of tools: search and fetch, and the Universal Commerce Protocol (UCP, version 2026-08-25) shopping tools. The endpoint accepts plain JSON-RPC posts, so a UCP client needs no MCP session. The store advertises the UCP side in its profile at https://<your-store-domain>/.well-known/ucp.

search and fetch

ToolInputUse
searchqueryFind products whose name or summary matches. Returns one result per variant.
fetchidGet one variant by its id, with its stock and the product's other variants.

search returns an array of variants, fetch a single object:

{
"id": "01971b30-ea24-702d-9a3a-52675fa8a8b5",
"title": "Ceramic Dripper (Black)",
"text": "Handmade ceramic dripper with 24 drainage holes.",
"url": "https://your-store.yns.store/product/ceramic-dripper?Color=Black",
"imageUrl": "https://cdn.yournextstore.com/...",
"price": "24.00",
"currency": "USD",
"available": true,
"options": { "Color": "Black" }
}
FieldDescription
priceDecimal string as the storefront shows it (gross on a tax-inclusive store), with any active promotion applied.
currencyThe store currency.
availablefalse only when the variant tracks stock and none is left.
optionsOption label to value for this variant.

fetch adds stock (null when not tracked), productName and variants, the same shape for every variant of the product.

url is the variant's canonical product page – /product/<slug> with one query parameter per variant option – so it opens on every storefront, including the open-source template and an AI-built store.

fetch answers the text Variant not found when no variant has that id, or its product is not published.

UCP shopping tools

ToolUse
search_catalogFind published products by free text (catalog.query) and filters (categories, price.min/price.max in minor units). Without a query it lists the catalog. Paginate with catalog.pagination.cursor and limit.
lookup_catalogResolve catalog.ids (product ids, variant ids, SKUs or product handles) to products.
get_productProduct detail for a product or variant id. Send catalog.selected ([{ "name", "label" }]) to narrow to a variant.
create_cartCreate a cart from cart.line_items and get its totals and a continue_url.
get_cart / update_cart / cancel_cartRead a cart by id, replace its line items (lines left out are removed; keep one by sending its id), or delete it.
create_checkoutStart a checkout from checkout.cart_id or checkout.line_items.
get_checkout / update_checkout / complete_checkout / cancel_checkoutRead, change, finish or cancel a checkout by id.

Each line item is { "item": { "id": "<variant id or SKU>" }, "quantity": 1 }. Every tool accepts an optional meta object (ucp-agent.profile, idempotency-key). Results come back as JSON in both content and structuredContent.

The buyer chooses delivery and pays on the store's checkout page, so an agent never takes payment itself. A checkout comes back requires_escalation with a continue_url to open in the buyer's browser; get_checkout reports completed with the order once they have paid. Items that cannot be bought are reported in the response messages. The store takes no payment credentials over MCP, so its UCP profile lists no payment handlers. In browsers with WebMCP, the checkout page also gives an agent get_checkout, update_checkout and complete_checkout for the buyer's open checkout.

Pages as Markdown

The home page, product pages (/product/<slug>), collection pages (/collection/<slug>), blog posts (/blog/<slug>) and search (/search?q=<words>) answer in Markdown when an agent asks for it:

  • with an Accept header that names text/markdown or text/plain and does not start with text/html, or
  • by adding .md to the address: /product/<slug>.md, /collection/<slug>.md, /blog/<slug>.md, /search.md?q=<words>, and /index.md for the home page.

A product page lists prices, availability, options, variants with their IDs, and the description. The home page lists the store's collections and products, and collection and search pages list their products with price and availability. A blog post has its title, publish date, image and body. Descriptions and post bodies keep their headings, lists, links and tables. Every response is text/markdown, carries a Link header with the canonical page URL and X-Robots-Tag: noindex, and varies by Accept, so browsers keep getting HTML at the same address. An unknown or unpublished product, collection or post answers 404.

Each response opens with YAML front matter: title, description (when the page has one), canonical_url, last_updated (when known) and language.

Pages in a language other than the store's default are served under the language prefix, such as /de/product/<translated slug>, and answer in that language with links to the pages in that language. Items are found by their translated slug. A language the store does not offer answers 404.