mintymcpserver

mcp
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: AFL-3.0
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 6 GitHub stars
Code Uyari
  • network request — Outbound network request in .github/ISSUE_TEMPLATE/bug_report.yml
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

PrestaShop 9 module: an MCP server inside the shop for Claude, with OAuth 2.1, rights bounded by the employee's profile, audit log and undo.

README.md

Minty MCP Server

A PrestaShop 8.1+ and 9 module that turns your shop into an MCP server: Claude (web, desktop, mobile), Claude Code and Codex read and update the shop on behalf of a back-office employee, never beyond that employee's PrestaShop permissions.

Minty MCP Server (mintymcpserver) is a standalone module for PrestaShop 8.1 to 9.2 (PHP 8.1+), published by Mintfull Agency under the Academic Free License 3.0 (AFL-3.0), like PrestaShop's native modules. Employees connect Claude with their back-office account through OAuth 2.1, or with a personal access key. Every call is checked against three layers of rights, written to an audit log, and most writes are kept in a change history so they can be undone. Other modules can add their own tools, prompts and rights through two hooks.

Full documentation (merchants, administrators, developers, reference of every tool): docs/index.html, a self-contained page to open in a browser. Extension guide: docs/EXTENDING.md.

188 MCP tools declared (167 always offered, 18 with PrettyBlocks, 3 on PrestaShop 8.1 to 9.1 only, so 185 on a PrestaShop 9.2 shop with PrettyBlocks), plus 3 compact mode tools and 7 prompts. 86 read, 102 write, 36 accept dry_run, 77 record their writes in the history.

Features

  • No other module required: the MCP endpoint, the OAuth 2.1 authorization server and the back-office screens all ship in this module.
  • Connect without copying keys: add the shop as a custom connector in Claude, log in with your back-office account, receive a code by e-mail, choose what Claude may do.
  • Rights you control: effective right = shop settings ∩ rights granted to the connection ∩ the employee's PrestaShop profile, recomputed on every call. Tools the caller may not use are not even listed.
  • Broad coverage: products, categories, bulk catalog edits and texts per language, product photos, attributes, features, brands, suppliers, taxes, attachments, cart rules and catalog price rules, stock, customers, addresses and groups, orders, refunds, order statuses and carriers, statistics and sales, CMS pages, PrettyBlocks content (when the prettyblocks module is active), SEO and AI visibility, public page checks, modules, main menu, theme and cache.
  • Prompts: seo_audit, seo_aeo_audit, shop_modules_review, shop_storefront_menu, shop_cache_maintenance, translate_prettyblocks, catalog_import_features.
  • Safe writes: risky or bulk writes accept dry_run (on by default for most of them); every write goes through PrestaShop's ObjectModels or core commands, so native validation and actionObject* hooks run as in the back office.
  • Change history with undo: changes_list, change_revert and changes_revert_batch, plus a History screen in the back office.
  • Audit log of every call, with per-token rate limiting.
  • Compact mode for clients that struggle with long tool lists.
  • Extensible: other modules register tools, prompts and rights of their own.

Requirements

  • PrestaShop 8.1 or later (ps_versions_compliancy min 8.1.0), tested on 8.2.9, 9.0.0 and up to 9.2
  • PHP 8.1+ (on PrestaShop 8, the 8.1 and 8.2 releases run on PHP 8.1)
  • MySQL 8 or MariaDB 10.4+
  • HTTPS in production (tokens travel in the Authorization header)
  • Friendly URLs enabled (needed by the OAuth routes)
  • On the client side: Claude (custom connector, nothing to install), Claude Code or Codex (app or CLI). The mcp-remote bridge (Node.js) is only needed to use a manual access key in Claude Desktop.

Installation

From a zip (back office upload)

composer build   # runs bin/build-zip.sh: zips the committed HEAD into dist/mintymcpserver-<version>.zip

Then, in the back office: Modules > Module Manager > Upload a module, and pick the zip. The build script refuses to run on a dirty working tree. Development files (tests, tooling, docs/) are left out of the zip through export-ignore entries in .gitattributes.

From a clone

cd /path/to/prestashop/modules
git clone https://github.com/Mintfull-Agency/mintymcpserver.git
php ../bin/console prestashop:module install mintymcpserver

vendor/ is committed (production dependencies only), so the module works without running composer install on the shop.

What the installation does

It creates the module tables, registers its hooks (employee deletion, module routes, history capture, GDPR erasure), declares the two extension hooks, and adds the Advanced Parameters > MCP for Claude tab. Defaults on a new installation: server enabled, read-only rights without personal data, OAuth enabled, compact tool list enabled, login page closed, e-mail code required. Uninstalling drops the module tables, its settings, the translation guidelines and the photos waiting to be attached.

Upgrade

Upload the new zip (or pull the new code) and let PrestaShop run the scripts in upgrade/. Existing connections and rights are kept. A shop that upgrades keeps the full tool list (compact mode stays off until an administrator turns it on), and a shop upgraded from a version older than 1.1.0 keeps its login page always open; new installations start with the login page closed.

Getting started in the back office

Everything happens in Advanced Parameters > MCP for Claude:

  1. Settings (super administrators only): pick a preset ("Look only", "Manage the catalog, content and promotions", "Everything I am allowed to do") or choose rights one by one, select the employee profiles allowed to use Claude and the applications allowed to connect (by default Claude, plus Claude Code, Codex and the other apps installed on the employee's computer; ChatGPT when ticked). This is also where you open the login page (for 15 minutes, 1 hour, 24 hours or always), send yourself a test login code, declare trusted reverse proxies and switch the compact tool list.
  2. Connections: the server URL to paste into Claude, a Check the setup button, and the list of connections and access keys (revocable).
  3. Photos: drop photos that Claude can then attach to products.
  4. Translation: translation guidelines per shop (style, glossary, terms never to translate), which Claude reads before translating.
  5. Audit log: every call, filterable by result and by tool.
  6. History: the changes made through Claude, with See and undo.

A Checks block lists what prevents connecting (server off, no HTTPS, friendly URLs disabled, no right available) and how to fix it.

Connecting Claude

The server URL is https://your-shop.example/module/mintymcpserver/mcp. Open the login page in Settings before the first connection.

Claude (web, desktop, mobile)

Settings > Connectors > Add custom connector, paste the server URL, click Connect. The shop's login page opens: back-office e-mail and password, code received by e-mail, choice of rights, Allow. Nothing to install, no key to copy. On Claude Team or Enterprise plans, an organization owner adds the connector first.

To give an existing connection more rights, revoke it in Connections and connect again: rights are chosen on the login page, and a token refresh can only keep or reduce them.

Claude Code

claude mcp add --transport http --scope user my-shop https://your-shop.example/module/mintymcpserver/mcp

Then type /mcp in Claude Code, pick the shop and choose Authenticate: the login page opens in your browser.

ChatGPT

Tick ChatGPT: custom MCP connectors (chatgpt.com) in Settings > Applications allowed to connect first: it is off by default. Then add the server URL as a custom MCP server in ChatGPT (on the web) and connect: the same login page opens. Only ChatGPT's connector callbacks are accepted (https://chatgpt.com/connector_platform_oauth_redirect, used because the module returns iss as RFC 9207 asks, and https://chatgpt.com/connector/oauth/<callback id>). Do not type chatgpt.com in "Another application": the Settings refuse it, and upgrading to 1.2.4 ticks the ChatGPT box for shops that did. Which ChatGPT plans may add custom MCP servers is up to OpenAI.

Codex

Use the shop from Codex: in the ChatGPT desktop app, select Codex in the menu (or use the Codex CLI). A server added in Codex stays in Codex: ChatGPT conversations do not see it (to use the shop there, see ChatGPT above).

Codex logs in like Claude Code, through a loopback redirect: keep Claude Code, Codex and other apps installed on the employee's computer ticked in Settings.

In the Codex app: Settings > Plugins > Add > Add MCP server, any name, type Streamable HTTP, paste the server URL, Save. Back in Plugins, open the MCPs tab and click Authenticate on the shop's line: the login page opens.

With the CLI (same configuration as the app and the IDE extension: ~/.codex/config.toml, %USERPROFILE%\.codex\config.toml on Windows, or $CODEX_HOME/config.toml when CODEX_HOME is set):

codex mcp add my-shop --url https://your-shop.example/module/mintymcpserver/mcp
codex mcp login my-shop   # if the login page did not open by itself

Type /mcp in a new Codex conversation to check: the shop must show Enabled and Authenticated (OAuth).

Manual access key

For scripts and clients without OAuth, and always available whether OAuth is on or not: Create an access key in Connections (expiry date, optional allowed IPs). The mcp_... key is shown once. Use it as Authorization: Bearer mcp_... (for Claude Code: --header "Authorization: Bearer mcp_..."), with the claude_desktop_config.json snippet the screen provides (npx mcp-remote bridge), or with its ~/.codex/config.toml block for Codex (http_headers = { "Authorization" = "Bearer mcp_..." }). That block replaces any [mcp_servers.<name>] block of the same name already in the file: Codex refuses the whole file when a name appears twice. The key then sits in clear in that file, as in claude_desktop_config.json: keep it out of shared or versioned dotfiles.

Rights model

The effective right of a call is the intersection of:

  1. Shop settings: what a super administrator allows on this shop;
  2. Connection rights: what the employee granted when connecting (or when creating the key);
  3. The employee's PrestaShop profile: each right is bound to a back-office tab and permission (for example products.update to AdminProducts edit, orders.refund to AdminOrders edit plus orders.delete, as in the back office).

It is recomputed on every request: removing a permission from a profile, unchecking a right in Settings, disabling or deleting the employee, or revoking the token takes effect on the next call. Removing a profile's read access to the MCP for Claude tab turns off all its employees' tokens. shop_get_context returns the effective rights and, for every other right, which layer blocks it.

Other rules worth knowing:

  • Without personal_data.read, names and e-mails are masked and addresses are not returned.
  • An employee can only create a token for themselves, with rights they hold and the administrator allows.
  • Tokens are bound to one shop (multistore), may be restricted to IPs or CIDR ranges, have a maximum lifetime (365 days by default, also applied to tokens already issued) and a rate limit (60 tool calls per minute by default).
  • In multistore, editing an object shared by several shops requires rights on each of them.
  • Orders are never deleted (invoice numbering must stay complete): "deleting" an order cancels it. Refunds go through four tools mirroring the four back-office buttons, with a simulation first.
  • Installing, uploading or upgrading a module is never possible through MCP; enabling or disabling one is, with an explicit confirmation for payment, carrier and critical modules.

The complete list of rights, with their back-office tab, permission and presets, is in docs/index.html#rights.

Compact mode

A long tool list weighs on every request, and some clients cap it. With Settings > Compact list of tools (on by default for new installations), tools/list only returns shop_get_context, shop_search_tools (search among the tools allowed for this token, with their schema), shop_run_read_tool (refuses any writing tool) and shop_run_write_tool (annotated as destructive so the client asks for confirmation). Rights, rate limiting and audit are the same as for a direct call, and the audit log records the tool actually run. After switching modes, refresh the tool list in the client's settings.

Change history and undo

Each call of a writing tool is recorded with the values it replaced:

  • What is recorded: writes made through ObjectModels during the call (captured by the actionObject* hooks), configuration values (from PrestaShop 9.2.1, which adds actionConfigurationUpdateValueBefore), product links (categories, tags, accessories, features), stock movements and module activation. Tools added by extension modules are covered as long as they write through ObjectModels.
  • What is never recorded or undoable: orders, refunds, payments, order and return statuses, e-mails, cache clearing, and settings that look like credentials. Deletions of heavy objects (product, combination, category, customer, attribute, feature, catalog price rule) are listed but cannot be undone; deletions of light objects (brand, supplier, unused address, cart rule, CMS page, SEO page) are restored with the same id.
  • Retention: the last 3 versions of each object, 30 days at most, cleaned up on each write (no cron job). Passwords and keys are never stored.
  • Undo: change_revert (preview first, dry_run defaults to true), changes_revert_batch for a whole request (up to 50 changes), or the History screen. An undo is refused when a value has changed since; nothing is overwritten. Undoing requires the rights of the original tool; an employee sees and undoes their own changes, a super administrator everyone's.
  • GDPR: when a customer is deleted (by Claude, in the back office, or through the official psgdpr module), every stored version holding their data is erased from the history.

Architecture

  • MCP endpoint: front controller controllers/front/mcp.php (/module/mintymcpserver/mcp), stateless Streamable HTTP transport (JSON-RPC over POST, JSON responses, no SSE, no session). Protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05. Body limited to 1 MB, batches to 50 messages, foreign Origin refused. Works in maintenance mode too.
  • OAuth 2.1: the module is its own authorization server, following the MCP authorization specification: discovery (RFC 9728 and RFC 8414), dynamic client registration (RFC 7591), authorization code with mandatory PKCE S256, resource indicators (RFC 8707), iss in responses (RFC 9207), rotating refresh tokens, revocation (RFC 7009). Redirect URIs are limited to Claude's callback, ChatGPT's connector callbacks when allowed, the employee's own machine (localhost) and domains added by a super administrator. Controllers in controllers/front/, logic in classes/OAuth/, login page in views/templates/front/authorize.tpl (overridable by the theme).
  • Composition: classes/McpServerFactory.php wires the front side (the Symfony admin container is not available there); the back office uses Symfony DI (config/admin/services.yml) and routes (config/routes.yml).
  • Code layout (classes/): Mcp/ (server, registry, definitions, compact mode), Tool/ (tool providers by domain), Http/, Security/ (rights, tokens, rate limiting, IPs), OAuth/, History/, Extension/, domain folders (Catalog/, Order/, Stock/, Seo/...), Controller/ and Admin/ (back office), Entity/, Repository/, Exception/, Log/, Support/.
  • Errors: every refusal carries a code (invalid_argument, permission_denied, not_found, conflict, rate_limited, internal_error), a clear message and a hint on how to fix it. Unexpected errors get a reference, found in the module's daily log var/logs/mintymcpserver-YYYY-MM-DD.log and, for warnings and errors, in Advanced Parameters > Logs.

More details: docs/index.html#architecture.

Web server notes

  • Uploaded photos are stored under upload/mintymcpserver/ with random names and only served through the back office. On Apache, the module writes a .htaccess that denies direct access. On nginx, add:

    location ^~ /upload/mintymcpserver/ { deny all; }
    
  • Apache with PHP-FPM: if the Authorization header does not reach PHP, add to the shop's .htaccess:

    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    
  • Reverse proxies: the client IP is REMOTE_ADDR by default. Behind a Kubernetes ingress, a load balancer or a CDN, declare the proxy IPs or ranges in Settings > Trusted reverse proxies (for example 10.0.0.0/8), otherwise IP restrictions on tokens and login lockouts see the proxy's address. X-Forwarded-For is never read when the direct peer is not declared.

  • PrestaShop 9.2+ ships ps_mcp_server, which uses /.well-known/oauth-protected-resource at the domain root. This module does not take over that path and announces its own metadata URL in the WWW-Authenticate header.

Extending

Another module can add tools, prompts and rights without touching this one, through the actionMintyMcpServerRegisterRights and actionMintyMcpServerRegisterTools hooks. Extension rights stay disabled until a super administrator enables them, and the employee still needs the matching profile permission. See docs/EXTENDING.md and the complete example module in docs/examples/mintymcpexample/.

Development

A local PrestaShop 9.2 instance with the module mounted:

cp .env.example .env          # fill in the passwords and admin e-mail
docker compose up -d          # then open http://localhost:8395/admin-dev

To try the module on PrestaShop 8, set PS_IMAGE_TAG (for example PS_IMAGE_TAG=8.2.1-apache in .env) on a fresh database volume.

Tooling:

composer install       # dev dependencies
composer test          # PHPUnit
composer lint          # PHP CS Fixer (dry run); composer lint:fix to apply
composer phpstan       # PHPStan level 5, needs _PS_ROOT_DIR_ pointing to a PrestaShop 9 install (PrestaShop 8: composer phpstan -- -c phpstan-ps8.neon)
composer build-vendor  # before committing: rebuild the production-only vendor/
composer build         # distributable zip of HEAD

PHPStan needs a PrestaShop installation. Running it against the lowest supported versions catches use of newer core APIs (the CI runs 8.1.0, 8.2.9 and 9.0.0):

docker run --rm --entrypoint "" -v "$PWD":/module -w /module -e _PS_ROOT_DIR_=/var/www/html \
  prestashop/prestashop-flashlight:9.0.0-8.1-nginx vendor/bin/phpstan analyse --memory-limit=-1
docker run --rm --entrypoint "" -v "$PWD":/module -w /module -e _PS_ROOT_DIR_=/var/www/html \
  prestashop/prestashop-flashlight:8.1.0-8.1-nginx vendor/bin/phpstan analyse -c phpstan-ps8.neon --memory-limit=-1

PrestaShop 8 and 9

The module runs on both from one code base. What differs is kept in a few places:

  • classes/Controller/Admin/AbstractAdminController.php and Compat/: the back-office controllers extend PrestaShopAdminController (9) or FrameworkBundleAdminController (8). Access checks are declared twice on every action: #[AdminSecurity] / #[DemoRestricted] attributes (read by PrestaShop 9) and @LegacyAdminSecurity / @LegacyDemoRestricted annotations (read by PrestaShop 8, no-op on 9). Use $this->trans($id, $parameters, $domain), adminShopContext(), contextEmployeeId() and arrayInput() rather than the PrestaShop 9 context services or ParameterBag::all($key) (Symfony 4.4 on PrestaShop 8).
  • classes/Support/CoreFeatures.php: checks for core features that depend on the version (feature value positions).
  • Core services built by hand (Catalog/Images/ThumbnailGenerator.php, Order/CoreOrderCommands.php) follow the constructors of both versions; Order/PsrLoggerBridge.php fits psr/log 1 (8) and 3 (9).

The vendor/ autoloader is an optimized classmap: after adding, renaming or removing a class, run composer build-vendor again.

Generated files:

python3 bin/build-tool-catalog.py           # regenerate the tool catalog, tables and counts in docs/index.html and this README
python3 bin/build-tool-catalog.py --check   # fail if they are out of date
python3 bin/build-translations.py           # rebuild the fr-FR XLIFF catalogues in translations/ from bin/translations*.fr.json

bin/build-tool-catalog.py reads the tool and prompt definitions from the PHP sources without running PHP, and fails if a tool has no description in the catalog descriptions file (or if that file describes a tool that no longer exists). After adding, renaming or removing a tool, update that file and run the script again.

Continuous integration (GitHub Actions) runs the syntax check, the vendor/ freshness check, PHP CS Fixer, PHPUnit and PHPStan.

Known limitations

  • Combination stock and prices, and cart rule restrictions (countries, carriers, groups, product selection) are managed in the back office.
  • The product type only switches between standard and virtual; switching to or from combinations or packs is done in the back office.
  • Main menu items cannot be removed through MCP yet.
  • Invoice and credit slip PDFs are not returned.
  • Order line tools (order_add_product, order_update_product, order_delete_product) are only offered on PrestaShop 8.1 to 9.1.
  • On PrestaShop 8, predefined feature values have no position: they are listed in the order they were created, and feature_value_create / feature_value_update refuse a position.
  • On PrestaShop 8, enabling a module that overrides core classes is left to the back office (module_set_active refuses it).
  • Configuration changes made by extension modules are only recorded in the history from PrestaShop 9.2.1.
  • A call touching more than 500 objects, or a write affecting several shops at once, is listed in the history but cannot be undone automatically.

Security

Please report vulnerabilities privately as described in SECURITY.md.

Hardening in place:

  • Keys, OAuth tokens, codes and client secrets are stored hashed (SHA-256); the login page cookie is signed with a key derived from _COOKIE_KEY_.
  • The login page is closed by default (it answers the shop's 404 page), locks an account for 15 minutes after 5 failed attempts (20 per IP), has CSRF protection, anti-framing headers and a second factor by e-mail (6-digit code, 10 minutes, 5 attempts).
  • Authorization codes are single-use (5 minutes); replaying a code or an old refresh token revokes the connection.
  • Unknown or non-finite arguments are refused before any tool code runs; tools that handle personal data or secrets only log argument names.
  • Outgoing HTTP requests (remote media, public page checks) are limited to HTTPS, refuse private addresses and are bounded in size and time.
  • HTML written by tools is sanitized, including script URLs.

The extension hooks are not a sandbox: an installed module runs PHP on the shop, so only install modules you trust.

Contributing

Contributions are welcome. See CONTRIBUTING.md.

Acknowledgements

Part of the tools (orders, refunds, statuses and carriers, catalog structure, stock, sales, SEO, modules, menu, theme and cache) were inspired by novalo-dev/Prestashop-MCP-Server (AFL-3.0), then rewritten for this module's rights model, multistore rules and change history. Thanks to its authors.

License

Copyright (c) 2026 Mintfull Agency.

Licensed under the Academic Free License version 3.0 (AFL-3.0), see LICENSE.

Yorumlar (0)

Sonuc bulunamadi