Skip to content

Connect PrestaShop to ChatGPT: Manage Orders, Stock, and Inventory

Generate a secure MCP server to connect ChatGPT to PrestaShop. Automate order fulfillment, update stock levels, and query inventory directly via AI.

Nachi Raman Nachi Raman · · 8 min read

If you want to connect PrestaShop to ChatGPT so your AI agents can manage inventory, fulfill orders, process refunds, and update product catalogs, you need a Model Context Protocol (MCP) server. This server acts as a translation layer, mapping ChatGPT's JSON-RPC tool calls to PrestaShop's underlying REST endpoints. You can either spend weeks building and hosting this infrastructure yourself, or use a managed platform like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude, check out our guide on connecting PrestaShop to Claude or explore our broader architectural overview on connecting PrestaShop to AI Agents.

Giving a Large Language Model (LLM) read and write access to a mature, highly structured e-commerce platform like PrestaShop is an engineering challenge. You have to handle fragmented endpoints, nested associative data structures, and complex multi-shop routing.

This guide breaks down exactly how to use Truto to generate a secure MCP server for PrestaShop, connect it natively to ChatGPT, and execute complex store operations using natural language.

The Engineering Reality of the PrestaShop API

A custom MCP server is essentially a self-hosted integration layer. While the open MCP standard provides a predictable way for LLMs to discover tools, implementing it against PrestaShop's API introduces several platform-specific hurdles.

If you decide to build a custom MCP server for PrestaShop, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with PrestaShop:

The XML Legacy and Nested Payload Structures

While modern SaaS platforms default to flat JSON structures, PrestaShop's API is heavily rooted in XML. Even when forcing JSON responses via the output_format=JSON query parameter, write operations (POST, PUT, PATCH) require a highly specific, nested wrapper payload. For example, updating an address requires the payload to be wrapped exactly as {"prestashop": {"address": {...}}}. If your custom MCP server doesn't enforce this wrapping logic during tool generation, the LLM will hallucinate flat JSON objects, resulting in 400 Bad Request errors on every write attempt.

Segmented Stock and Order Data Models

In many e-commerce APIs, updating a product's stock is a simple PATCH to the /products/{id} endpoint. PrestaShop decouples this. Products, combinations, and stock levels exist in completely separate tables. To update inventory, your AI agent cannot just update the product. It must query the stock_availables resource, find the corresponding id_product and id_product_attribute combination, and push the update there. Similarly, deleting an order in PrestaShop does not cascade to order details, payments, or order histories - leaving orphaned records in the database if your AI isn't explicitly programmed to clean them up.

Multi-Shop Context Routing

PrestaShop supports multi-store configurations from a single installation. When interacting with the API, context matters. Fetching products without specifying a shop context might return global definitions, while pricing and active status might vary by id_shop. Your custom MCP server must manage this multi-tenant reality, ensuring that AI agents pass the correct shop or group IDs when managing localized catalogs.

Creating the PrestaShop MCP Server

Instead of hardcoding tool schemas to match PrestaShop's quirks, Truto derives them dynamically from the integration's internal resources and documentation. You can generate an MCP server scoped to a specific PrestaShop account either through the dashboard or programmatically via the API.

Method 1: Via the Truto UI

If you are setting this up manually for an internal ChatGPT workspace, the UI is the fastest path:

  1. Navigate to the Integrated Accounts page in your Truto dashboard.
  2. Select your connected PrestaShop instance.
  3. Click the MCP Servers tab.
  4. Click Create MCP Server.
  5. Select your configuration. You can restrict the server to specific HTTP methods (e.g., read only) or specific resource tags (e.g., orders, catalog).
  6. Click Generate and copy the resulting URL (https://api.truto.one/mcp/<token>).

Method 2: Via the Truto API

If you are building an application that dynamically provisions MCP servers for your own users, call the /mcp endpoint. This returns the secure URL programmatically.

Request:

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": "PrestaShop Fulfillment MCP",
    "config": {
      "methods": ["read", "write"],
      "tags": ["orders", "stock", "products"]
    }
  }'

Response:

{
  "id": "mcp_abc123",
  "name": "PrestaShop Fulfillment MCP",
  "config": {
    "methods": ["read", "write"],
    "tags": ["orders", "stock", "products"]
  },
  "expires_at": null,
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f6..."
}

Treat this URL as a sensitive credential. It encodes the routing and authentication needed to act on behalf of that specific PrestaShop tenant.

Connecting the MCP Server to ChatGPT

Once you have your Truto MCP URL, you need to expose it to your LLM environment.

Method A: Via the ChatGPT UI (Custom Connectors)

For ChatGPT Pro, Plus, Business, Enterprise, and Education users with Developer Mode enabled:

  1. Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
  2. Ensure Developer mode is enabled.
  3. Under MCP servers / Custom connectors, click Add new server.
  4. Give it a label (e.g., "PrestaShop Store Ops").
  5. Paste the Truto MCP URL into the Server URL field.
  6. Click Save.

ChatGPT will immediately ping the endpoint, perform the JSON-RPC initialization handshake, and load the PrestaShop tools.

Method B: Via Manual Config File (SSE Client)

If you are integrating this into a custom AI agent framework (like LangGraph, CrewAI, or an SSE-based client), you connect by passing the URL directly to the Server-Sent Events (SSE) transport.

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

Security and Access Control

Exposing an e-commerce database to an autonomous agent requires strict boundaries. Truto provides several mechanisms to lock down what an MCP server can do:

  • Method Filtering: Pass "methods": ["read"] during server creation to prevent the LLM from executing create, update, or delete operations. This is critical for reporting-only agents.
  • Tag Filtering: Restrict access to specific domains. Passing "tags": ["products"] ensures the agent can query the catalog but cannot access customer PII or orders.
  • Double Authentication (require_api_token_auth): By default, the URL token is the only authentication required. Setting this flag to true forces the calling client to also pass a valid Truto API token in the Authorization header, securing the endpoint even if the URL leaks.
  • Ephemeral Servers (expires_at): You can pass an ISO datetime to automatically terminate the MCP server at a specific time, ideal for short-lived contractor access or temporary auditing sessions.
  • Rate Limits: Truto normalizes PrestaShop rate limit responses into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). Truto does not retry, throttle, or apply backoff on rate limit errors - when PrestaShop returns HTTP 429, Truto passes that error directly to the caller. The LLM or agent framework is responsible for handling retry/backoff logic.

PrestaShop Hero Tools

When ChatGPT connects, it receives a curated set of JSON schemas derived directly from PrestaShop's capabilities. Here are the highest-leverage tools available for e-commerce workflows.

list_all_presta_shop_orders

Retrieves a paginated list of customer orders. Essential for tracking revenue, fulfillment queues, and recent activity. Supports filtering by date or order status.

"Fetch all PrestaShop orders placed in the last 24 hours that are currently marked as 'Payment accepted'."

get_single_presta_shop_order_by_id

Retrieves the complete payload for a specific order. Because PrestaShop separates concerns, this record provides the foundational IDs (customer, address, cart, currency) needed to lookup further details.

"Pull the complete order record for order ID 1402 and extract the delivery address ID."

update_a_presta_shop_order_state_by_id

Changes the status of an existing order. This requires submitting the payload wrapped in the {"prestashop": {"order_state": {...}}} structure. Crucial for moving items from 'Processing' to 'Shipped'.

"Update the status of order ID 1402 to 'Shipped'. Make sure to format the payload correctly."

list_all_presta_shop_products

Queries the product catalog. Returns full records by default, enabling the agent to view pricing, active status, and reference codes for inventory management.

"List all active PrestaShop products where the base price is greater than $50.00."

get_single_presta_shop_stock_available_by_id

Fetches the current available stock quantity for a specific product or product combination. This is the required prerequisite step before updating stock levels.

"Check the current available stock for product ID 45. I need the exact stock_available_id record."

presta_shop_stock_availables_partial_update

Partially updates a stock record (PATCH). You must pass the ID as stock_available_id in the query and send the fields to change wrapped in {"prestashop": {"stock_available": {...}}}. This is the only safe way to programmatically adjust inventory.

"Subtract 5 units from stock_available_id 112 to account for an offline wholesale purchase."

For the complete tool inventory - including detailed schemas for cart rules, taxes, multi-shop configurations, and customer threads - view the PrestaShop integration page.

Workflows in Action

With the MCP server connected, ChatGPT can execute complex, multi-step operations that traditionally required custom middleware.

1. The Inventory Reconciliation Agent

A warehouse manager asks the AI agent to audit and update stock levels based on a recent manual count.

"We just did a physical count. The SKU 'CERAMIC-MUG-01' actually only has 42 units left in the main warehouse. Find it and fix the stock in PrestaShop."

Execution Steps:

  1. list_all_presta_shop_products: The LLM queries products filtering by the SKU 'CERAMIC-MUG-01' to find the internal id_product.
  2. list_all_presta_shop_stock_availables: The LLM queries the stock table using that id_product to locate the exact stock_available_id.
  3. presta_shop_stock_availables_partial_update: The LLM executes a PATCH request, wrapping the payload {"prestashop": {"stock_available": {"quantity": 42}}} to align the system inventory with reality.
sequenceDiagram
    participant User
    participant ChatGPT as ChatGPT
    participant TrutoMCP as Truto MCP
    participant PrestaShop as PrestaShop API

    User->>ChatGPT: "Fix stock for CERAMIC-MUG-01 to 42 units"
    ChatGPT->>TrutoMCP: Call list_all_presta_shop_products
    TrutoMCP->>PrestaShop: GET /api/products?filter[reference]=CERAMIC-MUG-01
    PrestaShop-->>TrutoMCP: Returns id_product = 88
    TrutoMCP-->>ChatGPT: Result
    
    ChatGPT->>TrutoMCP: Call list_all_presta_shop_stock_availables
    TrutoMCP->>PrestaShop: GET /api/stock_availables?filter[id_product]=88
    PrestaShop-->>TrutoMCP: Returns stock_available_id = 104
    TrutoMCP-->>ChatGPT: Result
    
    ChatGPT->>TrutoMCP: Call presta_shop_stock_availables_partial_update
    TrutoMCP->>PrestaShop: PATCH /api/stock_availables/104
    PrestaShop-->>TrutoMCP: 200 OK
    TrutoMCP-->>ChatGPT: Success
    ChatGPT->>User: "Stock updated successfully."

2. The Customer Support Investigator

A support agent asks ChatGPT to investigate an escalating customer complaint regarding a missing delivery.

"Look up the most recent order for customer email 'alex.d@example.com'. Tell me its current status, which carrier was used, and if there are any tracking numbers attached to the delivery."

Execution Steps:

  1. list_all_presta_shop_customers: The LLM searches for the email to retrieve the internal id_customer.
  2. list_all_presta_shop_orders: The LLM searches for orders tied to that id_customer, sorting by date descending, to grab the latest id_order.
  3. get_single_presta_shop_order_by_id: The LLM pulls the full order record to extract the current status ID and the id_carrier.
  4. list_all_presta_shop_order_carriers: The LLM fetches the shipping logistics tied to that id_order to extract the tracking_number.
  5. The LLM synthesizes the data into a clean text summary for the support agent.
flowchart TD
    A["User Prompt<br>Check order for alex.d@example.com"] --> B["list_all_presta_shop_customers<br>Find id_customer"]
    B --> C["list_all_presta_shop_orders<br>Find latest id_order"]
    C --> D["get_single_presta_shop_order_by_id<br>Check order state"]
    C --> E["list_all_presta_shop_order_carriers<br>Extract tracking_number"]
    D --> F["Format Response<br>Send summary to User"]
    E --> F

Moving Beyond Static Integrations

Building an AI agent that can reliably operate a PrestaShop storefront requires deep knowledge of its XML-based payload structures, multi-shop routing, and segmented database tables. Hand-coding an MCP server to manage these edge cases requires constant maintenance and testing against live stores.

By leveraging Truto, you bypass the boilerplate. Truto's dynamically generated MCP servers ensure your LLMs receive the correct schemas, enforce required payload wrappers, and securely authenticate against the correct tenant - allowing your engineering team to focus on building better AI workflows instead of maintaining API infrastructure.

FAQ

Does Truto automatically handle PrestaShop API rate limits?
No. Truto standardizes rate limit information into IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) and passes HTTP 429 errors directly to the caller. The LLM or your agent framework is responsible for implementing retry and backoff logic.
How does Truto handle PrestaShop's XML payload requirements?
Truto translates the JSON-RPC tool calls into the specific payload formats PrestaShop expects, but the LLM must still provide the correct nested JSON structure (e.g., {"prestashop": {"address": {...}}}) as defined in the dynamically generated tool schemas.
Can I restrict the AI agent to read-only access for PrestaShop?
Yes. When creating the MCP server in Truto, you can configure method filtering by passing 'methods': ['read']. This prevents the LLM from executing any POST, PUT, PATCH, or DELETE operations.
How do I securely pass my MCP server URL to a hosted LLM?
For clients like ChatGPT, you add the URL as a custom connector in the settings. For programmatic or multi-tenant setups, you can enable 'require_api_token_auth' on the MCP server, which forces the client to pass a valid Truto API token in the Authorization header alongside the secure URL.

More from our Blog