Skip to content

Connect Mirakl Connect to Claude: Orchestrate Returns and Shipping

A definitive engineering guide to connecting Mirakl Connect to Claude via a managed MCP server. Automate orders, returns, and shipments without custom code.

Uday Gajavalli Uday Gajavalli · · 10 min read
Connect Mirakl Connect to Claude: Orchestrate Returns and Shipping

If you need to connect Mirakl Connect to Claude to automate marketplace order approvals, orchestrate returns, manage complex catalog updates, or oversee customer communications, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's tool calls and Mirakl Connect's REST APIs. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses ChatGPT, check out our guide on connecting Mirakl Connect to ChatGPT or explore our broader architectural overview on connecting Mirakl Connect to AI Agents.

Giving a Large Language Model (LLM) read and write access to a sprawling e-commerce ecosystem like Mirakl Connect is an engineering challenge. You have to map massive JSON schemas to MCP tool definitions, deal with strict API quotas, and handle Mirakl's highly specific asynchronous action patterns. Every time Mirakl updates an endpoint or deprecates a legacy resource, you have to update your server code, redeploy, and test the integration.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Mirakl Connect, connect it natively to Claude Desktop or web environments, and execute complex marketplace workflows using natural language.

The Engineering Reality of the Mirakl Connect API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against specialized B2B e-commerce APIs is painful. Mirakl Connect is built to handle massive throughput across multiple marketplace operators, meaning its architecture prioritizes eventual consistency and batch processing over synchronous HTTP operations.

If you decide to build a custom Mirakl Connect MCP server, here are the specific integration challenges you will face:

The Asynchronous Action Pattern The most significant hurdle when connecting an LLM to Mirakl Connect is its heavy reliance on asynchronous operations. When an agent attempts to approve an order (mirakl_connect_orders_approve), refund an item (mirakl_connect_orders_refund), or update return tracking (create_a_mirakl_connect_return_tracking), Mirakl does not return a synchronous 200 OK with the updated resource. Instead, it returns a 202 Accepted containing an action_id.

LLMs are fundamentally stateless and struggle with delayed gratification. If Claude gets an action_id back, it will often hallucinate that the order was successfully processed immediately. To prevent this, your MCP server must strictly define the tool schemas to explicitly instruct the LLM to use the get_single_mirakl_connect_order_action_by_id tool to poll for the actual result. Building this polling awareness into MCP tool descriptions requires continuous refinement.

Non-JSON Payloads for Documents and Attachments Mirakl Connect frequently handles compliance documents, shipping labels, and customer invoices. Endpoints like list_all_mirakl_connect_order_document_contents and list_all_mirakl_connect_conversation_attachment_contents do not return JSON schemas that an LLM can easily parse into text. They return raw ZIP files containing binary data. If an LLM attempts to call these endpoints blindly, the resulting binary stream will crash the context window or cause a protocol parsing error. Your MCP server must intercept these binary streams, write them to secure temporary storage, and return a sanitized manifest or presigned URL back to Claude.

Strict Pagination with Volatile Cursors Mirakl Connect uses a volatile next_page_token implementation for high-volume endpoints like list_all_mirakl_connect_orders. These tokens expire quickly and are highly sensitive to URL encoding issues. When an LLM passes a token back into the MCP server for the next page, it will sometimes attempt to stringify, truncate, or decode the string based on its own tokenizer logic. If the token is altered by even a single character, Mirakl rejects the request. The MCP layer must force the LLM to treat the cursor as an opaque blob.

Creating the Mirakl Connect MCP Server

Truto abstracts away the complexity of building API schemas and managing authentication state. It dynamically translates Mirakl's documentation into LLM-ready MCP tools and wraps them in a standardized JSON-RPC 2.0 endpoint.

You can generate this server via the Truto UI for rapid prototyping, or via the API for programmatic, multi-tenant deployments.

Method 1: Via the Truto UI

If you are setting up an internal tool or testing a workflow locally, generating the server through the dashboard is the fastest path.

  1. Log into your Truto dashboard and navigate to the integrated account page for your active Mirakl Connect connection.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration. You can filter the server to only expose read methods or restrict it to specific tags like orders or returns.
  5. Click Save, and copy the generated MCP server URL. (e.g., https://api.truto.one/mcp/a1b2c3d4...)

Method 2: Via the Truto API

For engineering teams building multi-tenant AI agents, you need to provision MCP servers dynamically on behalf of your users. You can do this by making an authenticated POST request to the Truto API.

Request:

curl -X POST https://api.truto.one/integrated-account/{integrated_account_id}/mcp \
  -H "Authorization: Bearer YOUR_TRUTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mirakl Fulfillment Agent MCP",
    "config": {
      "methods": ["read", "write", "custom"],
      "tags": ["orders", "returns", "shipments"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'

Response:

{
  "id": "mcp_8f7e6d5c4b3a2",
  "name": "Mirakl Fulfillment Agent MCP",
  "config": {
    "methods": ["read", "write", "custom"],
    "tags": ["orders", "returns", "shipments"],
    "require_api_token_auth": false
  },
  "expires_at": "2026-12-31T23:59:59.000Z",
  "url": "https://api.truto.one/mcp/xyz987654321..."
}

Keep the url safe. It contains a cryptographically hashed token that binds the MCP server to the specific tenant's Mirakl Connect credentials.

Connecting the MCP Server to Claude

Once you have your Truto MCP URL, connecting it to Claude requires zero additional code. You can configure this via the Claude desktop application or web interface, or deploy it programmatically using a configuration file.

Option A: Via the Claude UI

If you are using Claude's web interface or team workspaces:

  1. Navigate to Settings -> Integrations -> Add MCP Server (Note: If you are using ChatGPT for a similar workflow, the path is Settings -> Connectors -> Add).
  2. Name your server (e.g., "Mirakl Connect Integration").
  3. Paste the Truto MCP URL.
  4. Click Add.

Claude will immediately execute the MCP initialize handshake, discover all available Mirakl Connect tools, and make them available in your chat context.

Option B: Via Manual Config File (Claude Desktop)

If you are running Claude Desktop locally or configuring a headless agent environment, you must update the claude_desktop_config.json file. Because Truto uses Server-Sent Events (SSE) over HTTPS, you will use the official @modelcontextprotocol/server-sse transport wrapper.

Edit your configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "mirakl-connect": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/xyz987654321..."
      ]
    }
  }
}

Save the file and restart Claude Desktop. The application will boot the node process, connect to Truto's SSE endpoint, and ingest the Mirakl Connect tooling schemas.

Security and Access Control

Exposing an e-commerce backend to an autonomous AI agent introduces significant risk. Truto provides four mechanisms to lock down the MCP server configuration before Claude even sees the tools:

  • Method Filtering: Set config.methods to ["read"] to ensure Claude can only execute GET operations (e.g., listing orders). This prevents the agent from accidentally refunding customers or modifying shipments.
  • Tag Filtering: Use config.tags to limit the API surface area. For example, passing ["returns"] restricts the agent to the returns domain, keeping it away from core product catalog endpoints.
  • Require API Token Auth: By default, possessing the MCP URL is enough to invoke tools. Setting require_api_token_auth: true adds a secondary authentication layer. The MCP client must provide a valid Truto API token in the Authorization header on every request.
  • Automatic Expiration: Setting an expires_at timestamp creates a short-lived server. Truto's background alarm system will automatically purge the credentials and invalidate the URL when the time expires, which is ideal for temporary contractor access or limited-scope agent runs.

Hero Tools for Mirakl Connect

Truto automatically generates detailed MCP schemas for every endpoint in the Mirakl Connect API. Below are the highest-leverage tools available for orchestrating marketplace operations.

list_all_mirakl_connect_orders

Fetches paginated lists of orders from the marketplace. This tool is heavily utilized for initial synchronization and finding orders in specific statuses (like AWAITING_ACCEPTANCE). The LLM is instructed to pass the next_page_token back unmodified if pagination is required.

"Fetch all recent orders that are currently marked as awaiting acceptance so we can review them for approval."

mirakl_connect_orders_approve

Accepts or refuses specific order lines within an order. Because this triggers downstream logistics on the marketplace, Mirakl processes it asynchronously. The tool returns an action_id rather than a final success message.

"Approve all items on order ID MK-89234 and let me know the action ID generated."

get_single_mirakl_connect_order_action_by_id

Checks the status of an asynchronous action request (like an order approval or refund). This is the crucial secondary step for all write operations. The LLM must call this tool with the action_id to verify if the operation succeeded or if errors occurred during processing.

"Check the status of action ID ACT-554992 to confirm if the order approval went through successfully."

list_all_mirakl_connect_returns

Retrieves returns updated since a specific timestamp. This tool is critical for syncing RMAs with your internal warehouse management systems. It follows the standard next_page_token pagination pattern.

"Pull a list of all marketplace returns that were updated in the last 24 hours."

mirakl_connect_returns_approve

Accepts a return request from a customer, triggering the next phase of the RMA lifecycle. Like order approvals, this returns an action_id for tracking the asynchronous processing.

"Approve the return request for return ID RET-77312 and poll the resulting action ID to confirm it is complete."

create_a_mirakl_connect_shipment

Logs a shipment for one or more items within an order, updating the marketplace with the carrier and tracking information. This is processed asynchronously and requires tracking the resulting action_id.

"Create a new shipment for order ID MK-99112 using FedEx tracking number 39228399120, then verify the action status."

For the complete inventory of available endpoints and granular JSON schemas, visit the Mirakl Connect integration page.

Workflows in Action

When Claude is equipped with these tools, it can act as an autonomous e-commerce operations manager, handling multi-step processes that previously required human intervention.

Automated Order Triage and Approval

Customer service and fulfillment teams often spend hours manually reviewing orders in a "pending" or "awaiting acceptance" state before clearing them for the warehouse.

"Check Mirakl Connect for any orders currently in an 'awaiting acceptance' state. For each one, initiate the approval process for all order lines. Make sure to check the status of the resulting action IDs until they are marked as complete. If any approvals fail, list the errors."

  1. Claude calls list_all_mirakl_connect_orders with the status filter set to AWAITING_ACCEPTANCE.
  2. For each returned order, it extracts the order_id and the associated order_lines.
  3. It loops through the orders, calling mirakl_connect_orders_approve with the required payload.
  4. Mirakl returns an action_id for each approval.
  5. Claude enters a polling loop, calling get_single_mirakl_connect_order_action_by_id with the action_id until the status changes from pending to complete.

The user receives a concise summary confirming which orders were successfully approved and sent to the warehouse, and which ones failed due to inventory constraints.

sequenceDiagram
    participant User as Claude User
    participant Claude as Claude Desktop
    participant Truto as Truto MCP
    participant Mirakl as Mirakl Connect
    
    User->>Claude: "Approve all pending orders."
    Claude->>Truto: call tool: list_all_mirakl_connect_orders
    Truto->>Mirakl: GET /api/orders?status=AWAITING_ACCEPTANCE
    Mirakl-->>Truto: JSON (Order MK-101)
    Truto-->>Claude: Tool result (Order MK-101)
    Claude->>Truto: call tool: mirakl_connect_orders_approve
    Truto->>Mirakl: POST /api/orders/approve (MK-101)
    Mirakl-->>Truto: 202 Accepted (action_id: 9942)
    Truto-->>Claude: Tool result (action_id: 9942)
    Claude->>Truto: call tool: get_single_mirakl_connect_order_action_by_id
    Truto->>Mirakl: GET /api/actions/9942
    Mirakl-->>Truto: 200 OK (status: COMPLETED)
    Truto-->>Claude: Tool result (Completed)
    Claude-->>User: "Order MK-101 approved successfully."

Managing the RMA and Return Tracking Lifecycle

When a warehouse receives a returned item, the marketplace must be updated to trigger the customer refund. Claude can orchestrate this entire handoff.

"We just received the physical items back for return ID RET-44821. Please confirm receipt of the items on Mirakl, approve the return, and close the RMA record. Let me know when the final action is complete."

  1. Claude calls mirakl_connect_returns_confirm using the provided return_id to acknowledge physical receipt.
  2. It captures the resulting action_id and polls get_single_mirakl_connect_order_action_by_id until successful.
  3. Next, it calls mirakl_connect_returns_approve to authorize the refund.
  4. It captures the new action_id and polls again.
  5. Finally, it calls mirakl_connect_returns_close to terminate the lifecycle, polling the final action ID to guarantee success.

The user gets a definitive confirmation that the return is closed and the customer refund process has been successfully handed off to the marketplace.

Handling Rate Limits and Execution Quotas

Mirakl Connect enforces strict rate limiting, particularly on high-volume read endpoints and search queries. It is critical to understand how these limits surface through the MCP layer.

Truto operates as a transparent proxy for rate limits. It does not retry, throttle, or apply artificial backoff logic on rate limit errors. When the upstream Mirakl Connect API returns an HTTP 429 Too Many Requests error, Truto immediately passes that 429 error back to the MCP caller.

To help your agents handle these constraints gracefully, Truto normalizes the upstream rate limit information into standard IETF headers across all endpoints:

  • ratelimit-limit: The total number of requests allowed in the current time window.
  • ratelimit-remaining: The number of requests remaining in the current window.
  • ratelimit-reset: The timestamp when the rate limit window will reset.

Your application layer (or the agent orchestrator, like LangGraph) is entirely responsible for detecting the 429 error, reading the ratelimit-reset header, pausing execution, and retrying the tool call. Building this explicit retry logic into your system is mandatory for stable, high-volume production deployments.

Moving Beyond the Integration Bottleneck

Exposing a complex e-commerce API like Mirakl Connect to an AI agent requires more than just formatting JSON. You must orchestrate authentication, enforce strict access policies, manage complex asynchronous data patterns, and handle volatile pagination schemas.

By deploying a managed Truto MCP server, you offload the entire lifecycle of the integration - from the underlying tool generation to the secure transport layer. You get a normalized, highly secure endpoint that Claude can interact with natively, freeing your engineering team to focus on building intelligent e-commerce workflows rather than chasing API updates.

FAQ

How does Truto handle Mirakl Connect API rate limits?
Truto does not absorb, retry, or apply backoff logic to rate limits. When Mirakl Connect returns an HTTP 429 error, Truto passes it directly to the caller while normalizing the rate limit data into standard headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). The caller is responsible for implementing retry logic.
Why does Truto require polling for Mirakl Connect write operations?
Mirakl Connect processes major write operations (like order approvals and shipments) asynchronously. The API returns an action_id rather than a synchronous success message. Truto exposes tools to capture this action_id, allowing the LLM to poll the status until the operation completes.
Can I restrict Claude from modifying orders in Mirakl Connect?
Yes. When creating the Truto MCP server, you can configure method filtering by passing ["read"] to the config.methods array. This ensures the MCP server only generates read-only tools, physically preventing the LLM from executing write operations like order approvals or cancellations.
How do I securely pass Truto MCP credentials to Claude?
The generated Truto MCP URL contains a cryptographically hashed token binding it to a specific account. You simply add this URL to Claude's UI under Custom Connectors, or add it to the claude_desktop_config.json file using the official @modelcontextprotocol/server-sse transport.

More from our Blog