Skip to content

Commerce MCP

Calling the server

The commerce MCP speaks the Model Context Protocol over streamable HTTP. Any MCP client works; so does plain curl.

Transport#

  • POST one JSON-RPC 2.0 message per request to the endpoint, with content-type: application/json.
  • Send accept: application/json, text/event-stream. Without both, the server answers HTTP 406.
  • Protocol versions 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05, 2024-10-07 on the same endpoint. A request that names its version in _meta is served as 2026-07-28; anything else as the 2025-era version in its MCP-Protocol-Version header (2025-03-26 without one).
  • Responses are plain JSON, not event streams. The server is stateless: there is no session ID, and each request stands alone. GET and DELETE answer HTTP 405: there is no server-to-client stream and no session to end.
  • Because it is stateless, 2025-era tools/list and tools/call work without a prior initialize. MCP clients send it anyway, which is fine.
  • Server-side clients send no Origin header. A browser request whose Origin is not an Aiptimise site or a known AI client app answers HTTP 403; ask us to add yours.
  • Every response carries X-Request-Id. Quote it when you contact support.

Raw JSON-RPC#

With an API key on /api/mcp. For a directory endpoint, drop the Authorization line.

1. initialize

curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"example-client","version":"1.0.0"}}}'
Response
{
  "result": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "tools": {
        "listChanged": false
      }
    },
    "serverInfo": {
      "name": "aiptimise-commerce",
      "title": "Aiptimise Commerce",
      "version": "2.15.0",
      "websiteUrl": "https://developers.aiptimise.com/docs/mcp"
    },
    "instructions": "Aiptimise serves read-only catalog data from participating independent stores. No tool places orders, takes payments or reads shopper accounts; purchases happen on the merchant site through product_url.\nstore_id, product_id and variant_id come from search_products results, or from get_store_info with store_domain when the shopper names a store website.\nPrices and availability in search results and variants are from the last catalog sync (as_of). get_live_price_and_inventory returns the current offer (source live or snapshot); use it before stating a current price or stock.\nFor a product with several variants, pick one from get_product_variants (options and available_only narrow the list) and pass its variant_id.\nA refused call returns {\"error\": {code, message, retryable, next_tool?}}. not_available means the store or product is missing, not served, or restricted: do not retry it with guessed IDs."
  },
  "jsonrpc": "2.0",
  "id": 1
}

2. tools/list

curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

The result lists the tools your scopes allow, each with name, title, description, inputSchema, outputSchema, annotations and securitySchemes. See the tools reference.

3. tools/call

curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_store_info","arguments":{"store_id":"edab46c9-76c6-4eb5-92dd-f593ed4bd9ad"}}}'

A successful result has structuredContent (the JSON the output schema describes) and the same JSON as text in content, for clients that only read text. A full response, from get_loyalty_program:

Response
{
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"store_id\":\"edab46c9-76c6-4eb5-92dd-f593ed4bd9ad\",\"product_id\":\"demo-trekker-45-backpack\",\"program\":{\"name\":\"Trail Rewards\",\"tiers\":[{\"name\":\"Explorer\",\"perks\":[\"Birthday bonus of 50 points\"],\"threshold_points\":0},{\"name\":\"Summit\",\"perks\":[\"Free express shipping\",\"Early access to new gear\"],\"threshold_points\":1000}],\"terms_url\":\"https://demo.aiptimise.com/pages/trail-rewards\",\"description\":\"Earn 1 point per dollar spent. Every 100 points is worth $5 off a future order.\"},\"points\":{\"basis\":\"1 point per $1 spent\",\"program\":\"Trail Rewards\",\"points_earned\":199},\"programs\":[]}"
      }
    ],
    "structuredContent": {
      "store_id": "edab46c9-76c6-4eb5-92dd-f593ed4bd9ad",
      "product_id": "demo-trekker-45-backpack",
      "program": {
        "name": "Trail Rewards",
        "tiers": [
          {
            "name": "Explorer",
            "perks": [
              "Birthday bonus of 50 points"
            ],
            "threshold_points": 0
          },
          {
            "name": "Summit",
            "perks": [
              "Free express shipping",
              "Early access to new gear"
            ],
            "threshold_points": 1000
          }
        ],
        "terms_url": "https://demo.aiptimise.com/pages/trail-rewards",
        "description": "Earn 1 point per dollar spent. Every 100 points is worth $5 off a future order."
      },
      "points": {
        "basis": "1 point per $1 spent",
        "program": "Trail Rewards",
        "points_earned": 199
      },
      "programs": []
    }
  },
  "jsonrpc": "2.0",
  "id": 9
}

Protocol 2026-07-28#

No handshake: each request carries its protocol version, and the result says which server answered.

Put the version, client info and capabilities in params._meta, and send the MCP-Protocol-Version and Mcp-Method headers (plus Mcp-Name, the tool name, on tools/call); a header that disagrees with the body answers HTTP 400. MCP SDKs do all of this for you. server/discover is optional; it returns the supported versions and capabilities.

curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -H "mcp-protocol-version: 2026-07-28" \
  -H "mcp-method: server/discover" \
  -d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"example-client","version":"1.0.0"},"io.modelcontextprotocol/clientCapabilities":{}}}}'
Response
{
  "result": {
    "supportedVersions": [
      "2026-07-28"
    ],
    "capabilities": {
      "tools": {
        "listChanged": false
      }
    },
    "instructions": "Aiptimise serves read-only catalog data from participating independent stores. No tool places orders, takes payments or reads shopper accounts; purchases happen on the merchant site through product_url.\nstore_id, product_id and variant_id come from search_products results, or from get_store_info with store_domain when the shopper names a store website.\nPrices and availability in search results and variants are from the last catalog sync (as_of). get_live_price_and_inventory returns the current offer (source live or snapshot); use it before stating a current price or stock.\nFor a product with several variants, pick one from get_product_variants (options and available_only narrow the list) and pass its variant_id.\nA refused call returns {\"error\": {code, message, retryable, next_tool?}}. not_available means the store or product is missing, not served, or restricted: do not retry it with guessed IDs.",
    "resultType": "complete",
    "ttlMs": 300000,
    "cacheScope": "private",
    "_meta": {
      "io.modelcontextprotocol/serverInfo": {
        "name": "aiptimise-commerce",
        "title": "Aiptimise Commerce",
        "version": "2.15.0",
        "websiteUrl": "https://developers.aiptimise.com/docs/mcp"
      }
    }
  },
  "jsonrpc": "2.0",
  "id": 2
}

Every result has resultType and the server's identity in _meta. tools/list and server/discover also carry ttlMs and cacheScope: "private": reuse the answer for that long, for the same credential only. ping and the initialize handshake do not exist in this version.

curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -H "mcp-protocol-version: 2026-07-28" \
  -H "mcp-method: tools/list" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"example-client","version":"1.0.0"},"io.modelcontextprotocol/clientCapabilities":{}}}}'

Directory apps: ChatGPT and Claude#

These connect without an API key, to a directory endpoint such as https://app.aiptimise.com/api/mcp/p/openai.

ChatGPT (apps / developer mode)

Settings → Apps & Connectors → Create. MCP server URL: the directory endpoint; Authentication: none. ChatGPT does not send API keys.

Claude (custom connector)

Settings → Connectors → Add custom connector, with the directory endpoint as the URL. Claude.ai connectors authenticate with OAuth or not at all, not with API keys.

Anthropic Messages API (MCP connector)#

Anthropic connects to the MCP server for you; pass your key as the authorization token.
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.beta.messages.create({
  model: "claude-opus-5",
  max_tokens: 16000,
  betas: ["mcp-client-2025-11-20"],
  mcp_servers: [
    {
      type: "url",
      url: "https://app.aiptimise.com/api/mcp",
      name: "aiptimise",
      authorization_token: process.env.AIPTIMISE_MCP_KEY,
    },
  ],
  tools: [{ type: "mcp_toolset", mcp_server_name: "aiptimise" }],
  messages: [
    { role: "user", content: "Find a waterproof hiking jacket under 200 USD" },
  ],
});

OpenAI Responses API (remote MCP tool)#

OpenAI connects to the MCP server for you; pass your key in authorization.
JavaScript
import OpenAI from "openai";

const openai = new OpenAI();

const response = await openai.responses.create({
  model: "<your model>",
  tools: [
    {
      type: "mcp",
      server_label: "aiptimise",
      server_description: "Product search and store information for participating merchants.",
      server_url: "https://app.aiptimise.com/api/mcp",
      authorization: process.env.AIPTIMISE_MCP_KEY,
      require_approval: "never",
    },
  ],
  input: "Find a waterproof hiking jacket under 200 USD",
});

Any MCP client or plain HTTP#

Any client that speaks streamable HTTP and can send a header works (Gemini and agent SDKs, MCP Inspector).
curl https://app.aiptimise.com/api/mcp \
  -H "Authorization: Bearer $AIPTIMISE_MCP_KEY" \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Clients may send _meta with a call. The service reads ChatGPT's openai/locale, openai/userLocation and openai/session for usage reporting only; the session is stored as a keyed hash. Nothing in _meta grants access.

Link shoppers with the product_url a tool returns, unchanged. It carries the UTM parameters that credit your platform, and checkout always happens on the merchant's site.

API snippets checked against the providers' docs on 2026-09-27.