Skip to main content

MCP Server

Unchained Engine includes a built-in Model Context Protocol (MCP) server that exposes the full commerce API as AI-callable tools. Any MCP-compatible client — Claude Desktop, Claude Code, Cursor, or custom agents — can connect and manage your store programmatically.

The MCP server is always available at the /mcp endpoint (configurable via MCP_API_PATH environment variable). No additional setup is needed beyond running Unchained Engine.

Authentication

  • Admin-only: The MCP server requires an authenticated user with the admin role.
  • Bearer token: Pass your session token via Authorization: Bearer <token> header or through cookies.
  • 401 behavior: Unauthenticated requests receive a 401 response with OAuth resource metadata.

Transport

The server uses the Streamable HTTP transport (the standard MCP HTTP transport):

  • POST /mcp — Send client messages (tool calls, resource reads)
  • GET /mcp — Query existing sessions
  • DELETE /mcp — Clean up sessions

Sessions are identified by the mcp-session-id header, generated on first connection.

Tool categories

The MCP server organizes its tools into 9 categories with granular operations:

1. Product Management

Full product lifecycle including media, variations, bundles, and pricing.

Operation groupActions
CRUDCREATE, UPDATE, REMOVE, GET, LIST, COUNT
StatusUPDATE_STATUS (publish/unpublish)
MediaADD_MEDIA, REMOVE_MEDIA, REORDER_MEDIA, GET_MEDIA, UPDATE_MEDIA_TEXTS
VariationsCREATE_VARIATION, REMOVE_VARIATION, ADD_VARIATION_OPTION, REMOVE_VARIATION_OPTION, UPDATE_VARIATION_TEXTS
AssignmentsADD_ASSIGNMENT, REMOVE_ASSIGNMENT, GET_ASSIGNMENTS, GET_VARIATION_PRODUCTS
BundlesADD_BUNDLE_ITEM, REMOVE_BUNDLE_ITEM, GET_BUNDLE_ITEMS
PricingSIMULATE_PRICE, SIMULATE_PRICE_RANGE, GET_CATALOG_PRICE
TextGET_PRODUCT_TEXTS, GET_MEDIA_TEXTS, GET_VARIATION_TEXTS
ReviewsGET_REVIEWS, COUNT_REVIEWS
OtherGET_SIBLINGS

Supported product types: SIMPLE, CONFIGURABLE, BUNDLE, PLAN, TOKENIZED.

2. Order Management

Read-only order listing and analytics.

Operation groupActions
QueriesLIST
AnalyticsSALES_SUMMARY (daily), MONTHLY_BREAKDOWN (12 months), TOP_CUSTOMERS, TOP_PRODUCTS

Supports date-range filtering and provider-based segmentation.

3. Assortment Management

Category trees with products, filters, links, and media.

Operation groupActions
CRUDCREATE, UPDATE, REMOVE, GET, LIST, COUNT
StatusUPDATE_STATUS (activate/deactivate)
MediaADD_MEDIA, REMOVE_MEDIA, REORDER_MEDIA, GET_MEDIA, UPDATE_MEDIA_TEXTS
ProductsADD_PRODUCT, REMOVE_PRODUCT, GET_PRODUCTS, REORDER_PRODUCTS
FiltersADD_FILTER, REMOVE_FILTER, GET_FILTERS, REORDER_FILTERS
LinksADD_LINK, REMOVE_LINK, GET_LINKS, REORDER_LINKS
NavigationGET_CHILDREN, SET_BASE
SearchSEARCH_PRODUCTS

4. User Management

Full user lifecycle, roles, emails, and related data.

Operation groupActions
CRUDLIST, GET, CREATE, UPDATE, REMOVE, COUNT
EnrollmentENROLL, SEND_ENROLLMENT_EMAIL, SEND_VERIFICATION_EMAIL
AdminSET_ROLES, SET_TAGS, SET_PASSWORD, SET_USERNAME
EmailADD_EMAIL, REMOVE_EMAIL
Data accessGET_ORDERS, GET_ENROLLMENTS, GET_QUOTATIONS, GET_BOOKMARKS, GET_CART, GET_PAYMENT_CREDENTIALS, GET_AVATAR, GET_REVIEWS, GET_REVIEWS_COUNT
Current userGET_CURRENT_USER

5. Filter Management

Search filters with options and localized texts.

Operation groupActions
CRUDCREATE, UPDATE, REMOVE, GET, LIST, COUNT
OptionsCREATE_OPTION, REMOVE_OPTION
TextUPDATE_TEXTS, GET_TEXTS

6. System Management

Shop info, background workers, and event logs.

Operation groupActions
ShopSHOP_INFO
WorkersWORKER_ADD, WORKER_REMOVE, WORKER_GET, WORKER_LIST, WORKER_COUNT, WORKER_ALLOCATE, WORKER_FINISH_WORK, WORKER_PROCESS_NEXT, WORKER_STATISTICS, WORKER_ACTIVE_WORK_TYPES
EventsEVENT_GET, EVENT_LIST, EVENT_COUNT, EVENT_STATISTICS

7. Localization Management

Countries, currencies, and languages.

Operation groupActions
All entitiesCREATE, UPDATE, REMOVE

Countries use 2-letter ISO codes, currencies use 3-letter ISO codes, languages use BCP 47 locale codes.

8. Provider Management

Payment, delivery, and warehousing providers.

Operation groupActions
CRUDCREATE, UPDATE, REMOVE, GET, LIST
DiscoveryINTERFACES (list available adapter types)

9. Quotation Management

Request-for-quote lifecycle.

Operation groupActions
QueriesLIST, GET, COUNT
LifecycleREQUEST, VERIFY, MAKE_PROPOSAL, REJECT

Resources

The MCP server exposes 3 read-only resources that provide shop configuration:

Resource URIDescription
unchained://shop/languagesActive languages with ISO codes and BCP 47 format
unchained://shop/currenciesActive currencies with ISO codes and decimal precision
unchained://shop/countriesActive countries with ISO codes

AI agents should check these resources before using localization tools to validate that an entity exists.

Important notes

  • Prices are integers: All monetary values are stored as integers. Check the currency resource for decimal precision (e.g., CHF has 2 decimals, so 1990 = 19.90 CHF).
  • Resource validation: Always check resources before creating or referencing localization entities to avoid errors.
  • Session management: Sessions are stored in memory and cleaned up when closed. Long-running agents should handle reconnection.

Connecting AI clients

Claude Desktop

Add to your claude_desktop_config.json:

{
"mcpServers": {
"unchained": {
"url": "https://your-engine.example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_ADMIN_TOKEN"
}
}
}
}

Claude Code

claude mcp add unchained \
--transport http \
--url https://your-engine.example.com/mcp \
--header "Authorization: Bearer YOUR_ADMIN_TOKEN"

Cursor

Add to your .cursor/mcp.json:

{
"mcpServers": {
"unchained": {
"url": "https://your-engine.example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_ADMIN_TOKEN"
}
}
}
}

Custom agents (TypeScript)

import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';

const transport = new StreamableHTTPClientTransport(
new URL('https://your-engine.example.com/mcp'),
{
requestInit: {
headers: {
Authorization: 'Bearer YOUR_ADMIN_TOKEN',
},
},
},
);

const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(transport);

// List available tools
const { tools } = await client.listTools();

// Call a tool
const result = await client.callTool({
name: 'product_management',
arguments: { operation: 'LIST', limit: 10 },
});