Skip to content

Connect Mirakl Connect to ChatGPT: Manage Orders and Support

Learn how to connect Mirakl Connect to chatgpt using Truto. Step-by-step guide to tool calling, API quirks, and autonomous workflows.

Sidharth Verma Sidharth Verma · · 9 min read
Connect Mirakl Connect to ChatGPT: Manage Orders and Support

If you need to connect Mirakl Connect to ChatGPT to automate marketplace order orchestration, synchronize product catalogs, or manage customer conversations natively, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's JSON-RPC tool calls and Mirakl Connect's complex REST APIs.

If your team uses Claude, check out our guide on connecting Mirakl Connect to Claude 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 marketplace platform like Mirakl Connect is a significant engineering challenge. You must handle asynchronous action polling, parse complex pagination cursors, and safely expose destructive catalog updates. Every time an API changes, your custom server code must be updated and redeployed.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Mirakl Connect, connect it natively to ChatGPT, and execute complex e-commerce workflows using natural language.

Mirakl Connect to ChatGPT Quickstart Guide

If you just want the fastest path from a fresh Truto account to ChatGPT successfully calling the Mirakl Connect API, follow these steps. Deeper architectural and lifecycle details live in the sections below.

What you need:

  • A Truto account with API access.
  • A Mirakl Connect environment and admin credentials.
  • A ChatGPT Pro, Plus, Business, Enterprise, or Education seat with Developer Mode enabled.

Step 1: Connect Mirakl Connect as an Integrated Account. In the Truto dashboard, open Integrated Accounts -> New Integrated Account, select Mirakl Connect, and authenticate. Truto establishes the connection and manages the underlying credentials securely.

Step 2: Create the MCP Server. Truto dynamically generates your MCP tools based on the active API documentation and specific constraints you define. You can generate this server via the Truto UI or programmatically via the API.

Method A: Via the Truto UI

  1. Navigate to the Integrated Account page for your Mirakl Connect connection.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration (e.g., allow read and write methods, filter by orders and support tags).
  5. Copy the generated MCP server URL (it will look like https://api.truto.one/mcp/<token>).

Method B: Via the API You can provision MCP servers dynamically for your users by sending a POST request to Truto. Grab your integrated_account_id and run:

curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mirakl Connect for ChatGPT",
    "config": {
      "methods": ["read", "write"],
      "tags": ["orders", "conversations", "products"]
    }
  }'

The API response contains a url field. This URL is self-contained - it handles routing, authentication, and tool execution. Treat it like a secret.

Step 3: Connect the MCP Server to ChatGPT. You can inject this MCP server directly into the ChatGPT interface, or run it through a local configuration file for custom AI applications.

Method A: Via the ChatGPT UI

  1. Open ChatGPT and navigate to Settings -> Connectors (or Settings -> Integrations -> Add MCP Server depending on your exact tier and layout).
  2. Click Add custom connector.
  3. Paste the Truto MCP URL generated in Step 2.
  4. Click Add. ChatGPT will automatically execute an initialize handshake, discover all available Mirakl Connect tools, and expose them to your chat session.

Method B: Via Manual Config File If you are running an external MCP client or a custom OpenAI wrapper that supports MCP, you can route it using the standard SSE transport layer:

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

The Engineering Reality of the Mirakl Connect API

Building a basic MCP server is just wrapping JSON-RPC. Building a reliable MCP server that an LLM can use against Mirakl Connect requires handling specific vendor quirks. If you build this from scratch, here are the architectural traps you will hit.

Asynchronous Action Processing

Unlike a standard CRUD API where a POST request completes the action and returns the finalized object, many critical Mirakl Connect operations are asynchronous.

If ChatGPT tries to approve an order or initiate a customer conversation, the API does not execute the action immediately. Instead, it returns an HTTP 202 with an action_id. The LLM must be explicitly guided to take that action_id, wait, and then call a separate polling endpoint (like get_single_mirakl_connect_order_action_by_id) to verify if the action succeeded or failed. Truto automatically enriches the tool schemas to instruct the LLM to handle these asynchronous action_id callbacks, preventing hallucinated success states.

Binary Payload Returns (ZIP Files)

The Mirakl Connect API is designed for enterprise systems, not conversational agents. When you request order documents or conversation attachments, the API frequently returns binary .zip archives rather than parsed JSON. Standard AI frameworks crash when attempting to parse a ZIP file as a JSON context window string. The MCP server must explicitly define the return schema constraints for binary outputs, forcing the agent to route the binary stream to a storage bucket or local file system rather than trying to read it natively.

Bulk Upsert "Patch" Behavior

Mirakl Connect handles product updates via bulk upsert operations. A standard API PUT replaces the entire object. In Mirakl Connect, mirakl_connect_products_bulk_upsert behaves like a PATCH - any omitted top-level elements remain entirely unchanged in the catalog. If ChatGPT hallucinates a schema or omits required nested fields, it won't overwrite the data with nulls, but it can create deeply fragmented product states. Truto solves this by injecting strict, derived JSON schemas directly from the active API documentation into the MCP tool definitions, ensuring ChatGPT constructs valid, sparse payloads.

Raw IETF Rate Limiting (No Retries)

Mirakl Connect enforces strict concurrency and rate limits. Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Mirakl Connect API returns an HTTP 429 Too Many Requests, Truto passes that 429 error directly back to the MCP caller.

However, Truto normalizes the upstream rate limit information into standardized headers per the IETF specification: ratelimit-limit, ratelimit-remaining, and ratelimit-reset. Your agent framework (or the LLM itself) is entirely responsible for reading these headers, sleeping until the reset timestamp, and retrying the function call. Do not assume the integration layer will absorb rate limit pressure for you.

Mirakl Connect to ChatGPT Hero Tools

Truto derives MCP tools dynamically from the underlying Mirakl Connect documentation. If an endpoint is documented, it becomes an AI tool. Here are the highest-leverage operations for ChatGPT to manage orders and support.

list_all_mirakl_connect_orders

Synchronize Mirakl Connect orders with your system. This tool handles pagination via the next_page_token. Truto automatically injects cursor instructions into the schema so ChatGPT knows to pass the token back exactly as received.

"Fetch the first 50 orders from Mirakl Connect. If there is a next_page_token in the response, fetch the next page and summarize all orders currently in AWAITING_ACCEPTANCE status."

mirakl_connect_orders_approve

Accept or refuse order lines. This is a critical asynchronous operation. The tool requires an order_id and an array of order_lines. Mirakl processes this asynchronously and returns an action_id.

"Approve all order lines for order ID ORD-99213. Take the resulting action_id and check its status immediately to ensure the approval was registered."

get_single_mirakl_connect_order_action_by_id

Check the status of an asynchronous action request (such as order approvals, cancellations, or refunds) and retrieve any potential errors that occurred during the batch processing.

"Check the status of order action ACT-5542. If it threw any errors, list the specific order lines that failed and why."

create_a_mirakl_connect_conversation

Initiate a new asynchronous conversation with a customer on a marketplace. You provide the initial message payload, and the system queues it for delivery.

"Start a new conversation with the customer for order ORD-1144 regarding a shipping delay. Inform them the new expected delivery date is Friday."

mirakl_connect_products_bulk_upsert

Create or update products in bulk. Because this behaves like a PATCH, ChatGPT only needs to send the fields that require updating.

"Update the inventory count to 45 for product SKU 'WIDGET-01' using the bulk upsert tool. Leave all other product attributes unchanged."

create_a_mirakl_connect_shipment

Ship one or more items from the same order within the same package, applying unified tracking information to the payload.

"Create a shipment for order ORD-8832. Mark items 1 and 2 as shipped via FedEx with tracking number FX123456789."

To view the complete inventory of available Mirakl Connect tools, schemas, and required parameters, visit the Mirakl Connect integration page.

Workflows in Action

Here is how these tools combine to solve real-world marketplace operations without human intervention.

Scenario 1: Automated Order Triage and Approval

Marketplace sellers often deal with hundreds of orders stuck in an 'awaiting acceptance' state. An AI agent can automatically evaluate inventory and approve orders.

"Find all Mirakl Connect orders currently awaiting acceptance. For each one, verify we have the items in stock using the product catalog. If we do, approve the order lines. Wait to verify the approval action succeeds, then send a message to the customer confirming their order is being packed."

Step-by-step execution:

  1. The agent calls list_all_mirakl_connect_orders filtering by AWAITING_ACCEPTANCE.
  2. It extracts the SKUs and checks internal systems or uses list_all_mirakl_connect_products to verify stock.
  3. It calls mirakl_connect_orders_approve for valid orders.
  4. It receives an action_id and enters a loop, calling get_single_mirakl_connect_order_action_by_id until the status reads complete.
  5. It calls create_a_mirakl_connect_conversation to alert the buyer.
sequenceDiagram
    participant ChatGPT as ChatGPT Agent
    participant MCP as Truto MCP Server
    participant API as Mirakl Connect API

    ChatGPT->>MCP: Call mirakl_connect_orders_approve
    MCP->>API: POST /api/orders/approve
    API-->>MCP: HTTP 202 { "action_id": "12345" }
    MCP-->>ChatGPT: Tool Result: action_id 12345
    
    Note over ChatGPT,API: Agent knows it must poll for async completion
    
    ChatGPT->>MCP: Call get_single_mirakl_connect_order_action_by_id(12345)
    MCP->>API: GET /api/order_actions/12345
    API-->>MCP: HTTP 200 { "status": "PROCESSING" }
    MCP-->>ChatGPT: Tool Result: status PROCESSING
    
    ChatGPT->>MCP: Call get_single_mirakl_connect_order_action_by_id(12345)
    MCP->>API: GET /api/order_actions/12345
    API-->>MCP: HTTP 200 { "status": "COMPLETE" }
    MCP-->>ChatGPT: Tool Result: status COMPLETE

Scenario 2: Proactive Returns Management

When a buyer requests a return, speed is critical for marketplace metrics. ChatGPT can orchestrate the return lifecycle and handle the support communications automatically.

"Check for any new return requests created in the last 24 hours. For each return, approve the request, mark the tracking status as pending, and send a message to the buyer with instructions on how to box the item."

Step-by-step execution:

  1. The agent calls list_all_mirakl_connect_returns passing yesterday's date to updated_from.
  2. For each return, it executes mirakl_connect_returns_approve.
  3. It immediately captures the action_id and verifies success via polling.
  4. It calls create_a_mirakl_connect_return_tracking to initialize the inbound logistics state.
  5. It calls create_a_mirakl_connect_conversation_message passing the relevant conversation_id mapped to that order to provide the boxing instructions.

Security and Access Control

Giving an LLM unconstrained access to a production Mirakl Connect environment is a massive security risk. A hallucinated bulk product deletion could wipe out a catalog. Truto enforces strict security controls at the MCP server level:

  • Method Filtering: When generating the server URL, you can pass config.methods: ["read"]. Truto actively blocks the generation of any tool that performs a POST, PUT, PATCH, or DELETE. The LLM physically cannot mutate data.
  • Tag Filtering: You can restrict the MCP server to specific resource domains. Setting config.tags: ["orders"] means ChatGPT will only see order-related tools, fully blind to the catalog or financial endpoints.
  • Secondary Authentication: By default, possessing the MCP URL grants access. By enabling require_api_token_auth: true, the MCP client must also pass a valid Truto API token in the Authorization header, enforcing identity validation before executing any tool.
  • Ephemeral Servers: You can pass an expires_at ISO timestamp. Truto's underlying scheduling infrastructure automatically destroys the MCP token and purges the key-value cache precisely when the timer hits, ensuring temporary LLM access safely revokes itself.

Wrapping Up

Building an MCP server for Mirakl Connect from scratch requires deep expertise in handling asynchronous job polling, paginated cursors, binary file routing, and IETF rate limit headers. Maintenance is a permanent tax as endpoints drift and authentication specs shift.

By leveraging a managed infrastructure layer, you abstract the protocol translation entirely. Truto handles the dynamic schema generation, secure credential storage, and JSON-RPC routing, allowing your engineering team to focus entirely on building high-value agentic workflows instead of parsing API documentation.

More from our Blog