magento-mcp
Provides storefront-shaped GraphQL queries for catalog search, product details, and category tree navigation.
Offers read-only SQL access to the Magento database, including prebuilt insight queries, with safety guards enforcing single SELECT statements and row limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@magento-mcpshow me the top 5 best-selling products this month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
magento-mcp
MCP server exposing a Magento 2 store to AI assistants via:
REST Admin API — catalog, orders, customers, CMS, inventory, promotions, store config (write tools require
confirm: true), authenticated via OAuth 1.0a against a Magento IntegrationGraphQL — storefront-shaped catalog search, product details, category tree
Direct read-only SQL — a
run_readonly_sqltool plus prebuilt insight queries against the live Magento database, optionally reached over an SSH tunnel
Tools
Tool | Domain | Notes |
| Catalog | read-only |
| Catalog | destructive, |
| Orders | read-only |
| Orders | destructive, |
| Customers | read-only |
| Customers | destructive, |
| CMS | read-only |
| Inventory | read-only |
| Inventory | destructive, |
| Promotions | read-only |
| Store config | read-only |
| Store config | destructive, |
| GraphQL catalog | read-only, storefront-shaped queries |
| Database | single |
| Database | prebuilt read-only insight queries |
Also exposes one MCP resource: magento://store/config (store configuration — currencies, locales, store views, base URLs).
Related MCP server: Shopify MCP
Prerequisites
Node.js >= 18
A Magento 2 store (Open Source or Adobe Commerce) with REST/GraphQL enabled
A Magento Integration for OAuth 1.0a credentials (see Quick Start below) — admin-user password auth is not supported
MySQL/MariaDB network access to the Magento database, for the read-only SQL tools (optional — the REST/GraphQL tools work without it)
Quick Start (using the published package)
No clone or build needed — this installs and runs on demand via npx.
In Magento Admin: System → Extensions → Integrations → Add New Integration. Grant it only the API resources this server actually needs, then Activate it to get four OAuth 1.0a values (shown once): consumer key/secret, access token/secret. This also sidesteps the 2FA restriction that blocks admin-user password auth.
If using the DB tools, create a
SELECT-only MySQL user:CREATE USER 'mcp_readonly'@'%' IDENTIFIED BY 'change_me'; GRANT SELECT ON magento_db.* TO 'mcp_readonly'@'%'; FLUSH PRIVILEGES;Do not grant this user INSERT/UPDATE/DELETE/DDL under any circumstance — the application-level query guard (
src/db/guard.ts) is defense in depth, not the safety boundary.Register with Claude Desktop/Code, e.g. in
claude_desktop_config.json:{ "mcpServers": { "magento": { "command": "npx", "args": ["-y", "@fahadhussain777/magento-mcp"], "env": { "MAGENTO_BASE_URL": "...", "MAGENTO_CONSUMER_KEY": "...", "MAGENTO_CONSUMER_SECRET": "...", "MAGENTO_ACCESS_TOKEN": "...", "MAGENTO_ACCESS_TOKEN_SECRET": "...", "MAGENTO_DB_HOST": "...", "MAGENTO_DB_NAME": "...", "MAGENTO_DB_READONLY_USER": "...", "MAGENTO_DB_READONLY_PASSWORD": "...", "MAGENTO_DB_SSH_HOST": "...", "MAGENTO_DB_SSH_USER": "...", "MAGENTO_DB_SSH_PRIVATE_KEY_PATH": "..." } } } }The
MAGENTO_DB_SSH_*fields are only needed when tunneling the DB connection over SSH — omit them entirely (not just leave blank) to connect directly. See "Reaching a remote/firewalled DB" below.If REST calls fail with
{"message":"Signature method %1 is not supported","parameters":["HMAC-SHA1"]}, add"MAGENTO_OAUTH_SIGNATURE_METHOD": "HMAC-SHA256"to theenvblock — Magento instances vary on which OAuth1 signature method they accept (defaults toHMAC-SHA1if unset). Check Magento Admin under Stores → Configuration → Services → OAuth if unsure which one a given instance requires.
Development (working on this repo)
npm installCopy
.env.exampleto.envand fill in the same OAuth/DB values as Quick Start above.npm run buildnpm run test:connections— sanity-checks REST auth, GraphQL, and the DB connection against the values in.env. See Local dev with self-signed certs below if this fails on TLS.In
claude_desktop_config.json, use"command": "node", "args": ["/path/to/magentoMCP/dist/index.js"]instead of thenpxform, so you're running your local changes instead of the published version.
Publishing
Published at npmjs.com/package/@fahadhussain777/magento-mcp. To publish a new version:
Bump
versioninpackage.json(semver) — npm rejects re-publishing an existing version.Make sure you're logged in as the intended npm account:
npm whoami(ornpm login).npm publish—prepublishOnly(typecheck + test + build) runs automatically first and aborts the publish if any of them fail. The package is scoped withpublishConfig.access: "public"already set, so this publishes publicly on the free tier without needing--access publicon the command line.
To test a packed tarball locally without touching the registry: npm pack, then npm install /path/to/the/tarball.tgz in a scratch project.
Development scripts
npm run dev— run directly from TS source viatsxnpm run typechecknpm test— unit tests (src/db/guard.test.tscovers the SQL safety guardrails)npm run test:connections— live smoke test of REST/GraphQL/DB reachability against.env(not a substitute fornpm test)npx @modelcontextprotocol/inspector node dist/index.js— interactively list/invoke tools
Local dev with self-signed certs (mkcert, Warden, etc.)
Node's fetch uses its own bundled CA list, separate from your system's trust store — so even if curl and your browser trust a locally-issued mkcert certificate, Node will reject it with UNABLE_TO_VERIFY_LEAF_SIGNATURE. Point Node at the same root CA:
NODE_EXTRA_CA_CERTS=$(mkcert -CAROOT)/rootCA.pem npm run devor set NODE_EXTRA_CA_CERTS in the environment your MCP client launches the server with (e.g. the env block in claude_desktop_config.json). Also double-check MAGENTO_BASE_URL actually matches a hostname the certificate covers (ERR_TLS_CERT_ALTNAME_INVALID means it doesn't) — local Magento setups often have several *.local/*.example.com hostnames configured and only one has a matching cert.
Docker-based setups (e.g. Warden, markoshust/magento-docker): the container itself may generate its own mkcert CA independently of your host's mkcert -CAROOT — if so, the CA cert lives inside the container, not on the host, and gets regenerated (new CA, still UNABLE_TO_VERIFY_LEAF_SIGNATURE even with a previously-working NODE_EXTRA_CA_CERTS path) whenever the container is recreated. Pull the current one out with:
docker exec <nginx-container> find / -iname '*mkcert*.crt' 2>/dev/null
docker cp <nginx-container>:<path-from-above> ./magento-dev-ca.pemthen point NODE_EXTRA_CA_CERTS at that file. Also worth checking after any container restart: docker inspect <db-container> --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' — container IPs on the Docker bridge network can change across restarts, so a previously-working MAGENTO_DB_HOST may go stale (ECONNREFUSED) even though nothing in .env looks wrong.
Reaching a remote/firewalled DB (SSH tunnel)
MAGENTO_DB_HOST/PORT don't need to be on the same machine as this server — mysql2 just connects over TCP. But never expose MySQL's port to the open internet to make that work. If the DB isn't already reachable over a private network/VPN, set MAGENTO_DB_SSH_* in .env (see .env.example for the full field list) to tunnel the DB connection through SSH instead — this server opens the SSH connection itself (via the ssh2 package, not a shelled-out ssh process) and forwards a local port to MAGENTO_DB_HOST/PORT as resolved from the SSH host's side. A private key (MAGENTO_DB_SSH_PRIVATE_KEY_PATH) is preferred over a password. Leave MAGENTO_DB_SSH_HOST unset to connect directly, as before — the tunnel is opt-in and only engages when that variable is present.
Safety notes
Every destructive REST tool (
update_product,delete_product,cancel_order,refund_order,update_customer,delete_customer,update_stock_item,set_config_value) previews the action and no-ops unless called withconfirm: true.run_readonly_sqlonly accepts a singleSELECTstatement, rejects DML/DDL keywords and sensitive tables (admin_user, etc.), and injects/caps aLIMIT— seesrc/db/guard.ts. This is on top of, not instead of, the DB user's SELECT-only grants.Query timeout and row cap are configurable via
MAGENTO_DB_QUERY_TIMEOUT_MS/MAGENTO_DB_MAX_ROWSin.env.
Issues & contributing
Bugs and feature requests: github.com/FahadEjaz/magento-mcp/issues. MIT licensed — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Unified MCP server for 70+ eCommerce platforms: products, orders, customers, and more.
MCP server for Product Management
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Federated commerce search across independent WooCommerce merchants. Keyless, read-only MCP server.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.158 npm17MIT
- AlicenseAqualityAmaintenanceA read-only MCP server that exposes the full Shopify Admin GraphQL API through 6 universal tools, with multi-store support and mutation rejection at the parser level for safety.6MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for integrating with Adobe Commerce and Magento REST API to manage products, categories, customers, pricing, and attributes.3Apache 2.0
- FlicenseAqualityCmaintenanceSecurity-focused MCP server for Shopify Admin GraphQL with read-only queries by default and mutations requiring preview and one-time confirmation. It manages short-lived tokens internally and enforces strict scope and approval controls.42 npm-