AI MCP Connector
Module: Magenx_AiMcp · admin and AI clients only, no storefront part
Serves a Model Context Protocol (MCP) endpoint from Magento, so an AI agent such as Claude can inspect and manage the store backend. It offers about 270 tools across products, categories, orders, invoices, shipments, credit memos, customers, stock, prices, promotions, CMS, attributes, configuration, caches, indexers, logs, reports, and the companion modules (returns, help desk, blog, feeds, GDPR and more).
It is a management surface, disabled by default. Every call needs a Magento integration token, or an admin’s own sign-in through OAuth, and every tool is checked against that integration’s or admin’s role.
Why it lives in Magento
Section titled “Why it lives in Magento”- Store configuration has no stock REST write endpoint, and caches and indexers have no REST API at all.
- Management power belongs next to the thing managed. Putting admin write access behind the public storefront would turn any storefront bug into a catalog-destruction bug.
The four guards
Section titled “The four guards”- Module switch: off by default; the endpoint returns 404.
- Permissions: the caller’s role needs AI MCP Server to reach the endpoint, plus each tool’s own resource (Magento’s own, such as Catalog > Products).
- Write switch: off by default. While off, the endpoint is read-only whatever the role says.
- Confirm gate: a write without
"confirm": truereturns a preview of exactly what it would do, and changes nothing.
An OAuth connection adds a fifth: the admin grants write access per connection.
Configuration writes have two more limits: secret-looking paths (*password*, *secret*, *token*, admin/*, oauth/*, crypt/*) can never be written, and Allowed Config Paths is empty by default, which denies every configuration write until you list paths. Reading configuration hides secret values.
Every confirmed write appears in the Admin Activity Log with field-level changes, the connector and the role behind it. Every attempted write is also logged to var/log/magenx_ai_mcp.log.
Set up with an integration token
Section titled “Set up with an integration token”-
Go to System > Extensions > Integrations > Add New Integration. Give it a name and leave Callback URL and Identity Link URL empty.
-
On the API tab, grant AI MCP Server plus the resources for the tools you want.
-
Save, then Activate. Copy the Access Token (not the consumer key or token secret).
-
Enable the endpoint in Stores > Configuration > Magenx > AI MCP Server. Leave writes off until you have watched it read.
-
Route
/magenx-mcp/to Magento in nginx (below). -
Connect your client, for example Claude Code:
Terminal window claude mcp add --transport http magento \https://your-magento-host/magenx-mcp/server \--header "Authorization: Bearer <access token>"
Use an integration token, not an admin-user token: admin tokens expire after 4 hours, mid-session. Integration tokens never expire, so rotate them: Platform Overview shows each token’s age.
Set up with OAuth (claude.ai, Claude Desktop, mobile)
Section titled “Set up with OAuth (claude.ai, Claude Desktop, mobile)”With OAuth on, admins connect as themselves:
- System > Extensions > AI MCP Connections > Create Client. The secret is shown once.
- In Claude, Settings > Connectors > Add custom connector with URL
https://your-host/magenx-mcp/server. Under Advanced settings, enter the client ID and secret. - Sign in to the Magento admin in the tab that opens (password and two-factor), choose the tool areas and whether to allow writes, and approve.

The connection then acts as you: your role decides every tool, the audit log names you, and it ends when your admin account is deactivated, locked or deleted. Dynamic client registration is off by default; only clients created under AI MCP Connections can connect.
Route it at nginx
Section titled “Route it at nginx”location /magenx-mcp/ { # Optional edge allowlist; drop it for Claude Code on the web, which has no stable address. allow 160.79.104.0/21; # Anthropic's published egress range deny all; # Same upstream and fastcgi wiring as your existing `location /graphql`. try_files $uri $uri/ /index.php$is_args$args;}With OAuth on, also send /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server to Magento, ahead of any /.well-known/ block for the storefront. Check the route:
curl -sS -o /dev/null -w '%{http_code} %{redirect_url}\n' -X POST https://your-host/magenx-mcp/server404 means it reaches Magento with the module off. 307 means it still hits the storefront.
Narrowing the tool list
Section titled “Narrowing the tool list”Enabled Domains and Disabled Tools decide which tools a client is shown, not what it may do: permissions and the write switch still decide that. A full tool list takes a lot of an agent’s context; offering only the areas a task needs helps it plan. Both are empty by default, which means everything.
Check a caller
Section titled “Check a caller”bin/magento magenx:mcp:check --admin=alicebin/magento magenx:mcp:check --integration="Reporting"Prints how many tools that caller gets and how many write, the switches and rate limits, and fails with the reason when the caller can’t use the endpoint. Run it after changing a role.
Things to know
Section titled “Things to know”- Tool calls are rate-limited per caller: 120 a minute, and confirmed writes 30 a minute.
invalidate_indexersmarks indexers invalid for cron to rebuild; it doesn’t reindex within the request.set_configrefreshes Magento’s configuration cache, not the storefront’s. Refresh that through cache invalidation.- Allowed IPs checks the connecting address. Behind a proxy it only works if nginx sets the real client address.
User flows
Section titled “User flows”Connect with an integration token
- An admin creates an integration with the endpoint permission and the permissions it needs, and copies its token.
- The agent is configured with the endpoint address and token, optionally narrowed to a profile.
- The handshake succeeds only with the endpoint permission; discovery lists only tools the integration may use.
Connect a hosted assistant with OAuth
- With OAuth on, an admin creates a client; its secret is shown once.
- The user adds the store as a custom connector in the assistant with that client.
- The assistant opens the store; the admin signs in with password and second factor and sees a consent page naming the client, where the code goes, the tool areas to grant and a write checkbox.
- On approval the assistant receives tokens and acts as that admin with that admin's permissions.
Read
- The agent calls a read tool; permissions, rate limit and toolset filters are checked; results come back (lists in a standard paged envelope).
Write
- The agent calls a write tool without confirmation and receives an exact preview.
- It calls again with confirmation; if writes are on, the caller's permissions allow it and (for OAuth) the connection may write, the change is applied, attributed in the admin audit trail and logged.
Place an order for a customer
- The agent creates a cart for a named store view, adds items by SKU and quantity, estimates shipping, sets addresses and shipping method together, picks an offline payment method and places the order, which needs its own permission.
Operate
- The agent checks caches, indexes, background jobs and installed features, reads masked log tails, and marks indexes for rebuild by the background scheduler.
These always hold:
- A caller can never do through the endpoint what their admin permissions do not allow in the admin.
- No write happens while writes are off, without confirmation, or (OAuth) without the connection's write grant.
- No tool returns a secret, a file's contents or an arbitrary path.
- A setting or address parameter can only remove tools, never add them.
- Agents never set prices or order statuses directly.
- Visible tools = all tools ∩ permitted ∩ store domains − disabled tools ∩ client / connection areas ∩ address slice.
- Rate limits count per caller per minute; an admin counts once across all their connections.
- Revoking an admin, integration, client or connection stops access on the next call.
- A store that has not switched the endpoint on reveals nothing.
Edge cases
Section titled “Edge cases”| Situation | What happens |
|---|---|
| Caller without endpoint permission starts the handshake. | Forbidden. |
| Agent changes a payment API key setting while allow pattern is "everything". | Refused by the deny list. |
| Write without confirmation. | Preview; nothing changed. |
Log read with ../ in the name. | Unknown log. |
| Refresh token reused. | Connection revoked. |
| Authorization code replayed. | Everything it issued revoked. |
| Online payment method chosen for an agent order. | Refused when chosen. |
| Erasure approved with the wrong email. | Refused. |
| Customer group with members deleted. | Refused, naming the count. |
| Address allow list set behind a proxy that hides the real address. | Fails closed; refusal logged with the observed address. |
| Browser request from an unlisted origin. | Forbidden. |
| Settings leave no tools at all. | Logged as a warning. |
Who it applies to
Section titled “Who it applies to”- Integrations and admins with the endpoint permission, on stores where the endpoint is on.
Out of scope
Section titled “Out of scope”- Online card payments for agent-created orders (offline payment methods only).
- Setting customer passwords, raw order statuses or arbitrary prices.
- Disabling the configuration cache or running a full reindex inside a request.
- Returning file contents (attachments, media) or reading arbitrary paths.
- Streaming responses or batched protocol requests.
- Shopper-facing agent features.
Install
Section titled “Install”composer require magenxcommerce/module-ai-mcpbin/magento module:enable Magenx_AiMcpbin/magento setup:upgradebin/magento setup:di:compile # production mode onlybin/magento cache:flush- PHP
~8.4.0||~8.5.0, Magento 2.4.8. - Needs Admin Activity Log installed first.
- Needs Blog installed first.
- Needs GDPR installed first.
- Needs Help Desk installed first.
- Needs Platform Overview installed first.
- Needs Product Attachments installed first.
- Needs Product Feeds installed first.
- Needs Quick Search installed first.
- Needs Returns (RMA) installed first.
Configuration
Section titled “Configuration”Stores > Configuration > Magenx > AI MCP Server
General
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable MCP Endpointmagenx_ai_mcp/ | No | Global | Yes/No. Serves the Model Context Protocol endpoint at /magenx-mcp/server. While disabled the endpoint returns 404 and advertises nothing. Requires a Magento Integration whose ACL role includes "AI MCP Server". |
Security
| Setting | Default | Scope | Notes |
|---|---|---|---|
Allow Write Toolsmagenx_ai_mcp/ | No | Global | Yes/No. Shown when magenx_ai_mcp/general/enabled = Yes. When No, tools that change data are not listed and cannot be called; the endpoint is read-only. This is independent of the integration's ACL — both must permit the write. |
Allowed IP Addressesmagenx_ai_mcp/ | empty | Global | Text area. Shown when magenx_ai_mcp/general/enabled = Yes. Comma or newline separated. Plain addresses (203.0.113.7) and CIDR ranges (10.0.0.0/8) are supported. Leave empty to accept any source address that presents a valid token. Behind a reverse proxy this compares against REMOTE_ADDR, which is the proxy's own address unless nginx's real_ip module is rewriting it (set_real_ip_from / real_ip_header). Without that, filling this in locks the endpoint out entirely. Refusals are recorded with the observed address in var/log/magenx_ai_mcp.log. |
Allowed Browser Originsmagenx_ai_mcp/ | empty | Global | Text area. Shown when magenx_ai_mcp/general/enabled = Yes. Comma or newline separated, e.g. https://app.example.com. The MCP transport requires the Origin header to be validated against DNS-rebinding attacks. Requests that send no Origin — curl, Claude Code, every ordinary MCP client — are unaffected by this setting. Requests that send one are refused unless it is listed here, so empty means "no browser may call this endpoint". |
Writable Configuration Pathsmagenx_ai_mcp/ | empty | Global | Text area. Shown when magenx_ai_mcp/general/enabled = Yes. Comma or newline separated glob patterns, e.g. magenx_*/* or catalog/frontend/*. Empty denies every configuration write. Secret-bearing paths (keys, passwords, tokens, encrypted values) are refused regardless of what is listed here. |
Tool Calls per Minutemagenx_ai_mcp/ | 120 | Global | Text. Shown when magenx_ai_mcp/general/enabled = Yes. Per caller: one integration, or one admin across all their OAuth connections. A call over the limit is answered with an error the agent can read and wait on, and the first refusal in each minute is logged. 0 disables the limit. |
Write Calls per Minutemagenx_ai_mcp/ | 30 | Global | Text. Shown when magenx_ai_mcp/general/enabled = Yes. Confirmed write-tool calls per caller, counted on top of the limit above. Previews (a write called without confirm) count only towards the limit above. 0 disables the limit. |
Audit Readsmagenx_ai_mcp/ | off | Global | Dropdown. Shown when magenx_ai_mcp/general/enabled = Yes. Writes are always recorded in var/log/magenx_ai_mcp.log. This adds successful reads to the same file: the tool, the integration, the arguments and the ids of the records returned — never the records themselves. "Personal data only" covers customers, orders and their documents, carts, returns, help desk tickets, GDPR requests and admin users. |
OAuth
Lets claude.ai, Claude Desktop and other MCP clients connect with an admin's own sign-in instead of an integration token. The admin approves each connection on a consent page behind the normal admin login and two-factor check, and the client acts with that admin's role. Clients are created, connections listed and revoked, and the optional connector key generated under System > Extensions > AI MCP Connections. See the README for the nginx locations this needs.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enable OAuthmagenx_ai_mcp/ | No | Global | Yes/No. Shown when magenx_ai_mcp/general/enabled = Yes. Publishes /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server, and accepts OAuth access tokens on the MCP endpoint. Integration tokens keep working either way. |
Allow Dynamic Client Registrationmagenx_ai_mcp/ | No | Global | Yes/No. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. Leave this off. Create a client under System > Extensions > AI MCP Connections instead, and enter its client ID and secret in the connector's advanced settings ("Use your own OAuth client"). When on, anyone can register a client and start a flow: that reveals the admin URL to them, and lets them send an admin a consent link that would connect their Claude account to the admin's role. |
Allowed Redirect URIsmagenx_ai_mcp/ | https://claude.ai/api/mcp/auth_callback
https://claude.com/api/mcp/auth_callback | Global | Text area. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. One per line, matched exactly. A client can only be created or registered with, and only ever receive an authorization code at, a URI listed here. The default is claude.ai's callback. Add other clients' callbacks only for services you trust with an admin's access. |
Allow Loopback Redirectsmagenx_ai_mcp/ | No | Global | Yes/No. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. Accept http://localhost, http://127.0.0.1 and http://[::1] callbacks on any port, for clients that run on the admin's own machine (Claude Code, MCP Inspector). Any program on that machine can then complete a flow the admin approves. |
Access Token Lifetime (minutes)magenx_ai_mcp/ | 60 | Global | Text. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. 5 to 1440. The client renews it with its refresh token without asking the admin. |
Connection Lifetime (days)magenx_ai_mcp/ | 30 | Global | Text. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. 1 to 90, counted from approval and never extended by use. When it runs out the admin has to sign in, and pass two-factor authentication, again. |
Public Base URLmagenx_ai_mcp/ | empty | Global | Text. Shown when magenx_ai_mcp/general/enabled = Yes, magenx_ai_mcp/oauth/enabled = Yes. The origin clients reach the MCP endpoint on, e.g. https://www.example.com, when that is not the default store's secure base URL. It becomes part of the issuer and of every token's audience, so changing it ends every existing connection. |
Tools
These narrow what a client is shown, not what it is permitted to do. The integration's ACL role and the write switch still decide that, and a tool withheld here is withheld from every integration.
| Setting | Default | Scope | Notes |
|---|---|---|---|
Enabled Tool Domainsmagenx_ai_mcp/ | empty | Global | Multiple select. Shown when magenx_ai_mcp/general/enabled = Yes. Select nothing to offer every domain, which is the default. Selecting some offers only those: the whole tool list is a large part of a client's context window, and an agent given only the domains its task needs plans better within it. A tool outside the selection is not listed and cannot be called. |
Disabled Toolsmagenx_ai_mcp/ | empty | Global | Text area. Shown when magenx_ai_mcp/general/enabled = Yes. Comma or newline separated tool names, e.g. delete_product, delete_category. Applied after the domain selection above, so a name listed here is withheld even if its domain is enabled. A name no tool answers to is refused when you save rather than accepted and ignored. |
Admin pages and permissions
Section titled “Admin pages and permissions”- Magento_Integration::system_extensions > AI MCP Connections
Grant these under System > Permissions > User Roles > Role Resources:
| Resource | Under | ID |
|---|---|---|
| AI MCP Server | Magenx_AiMcp::server | |
| AI MCP Server Diagnostics | AI MCP Server | Magenx_AiMcp::ops |
| AI MCP Server Reports | AI MCP Server | Magenx_AiMcp::reports |
| AI MCP Server Logs | AI MCP Server | Magenx_AiMcp::logs |
| Approve AI Client Connections | AI MCP Server | Magenx_AiMcp::oauth_grant |
| Manage AI Client Connections | AI MCP Server | Magenx_AiMcp::oauth_manage |
| AI MCP Server Section | Stores > Settings > Configuration | Magenx_AiMcp::config |
| Job | Group | Default schedule | Change it at |
|---|---|---|---|
magenx_aimcp_oauth_purge | default | 17 * * * * | Fixed |
Glossary
Section titled “Glossary”| Term | Meaning |
|---|---|
| Tool | A named operation with input schema, description, hints and, for some reads, an output schema. |
| Read tool / write tool | A tool that does not / does change data or a live system. |
| Caller | An integration (token) or an admin (OAuth connection). |
| Endpoint permission | The admin permission needed to reach the endpoint at all. |
| Write switch | Store setting that allows write tools. |
| Confirm step | A write without confirm: true returns a preview and changes nothing. |
| Domain | A group of tools by business area (catalog, sales, content, returns, operations…). |
| Profile | A named set of domains: analytics, catalog, content, support, operations. |
| Connection | One admin's approval of one OAuth client, with chosen tool areas and an optional write grant. |
| Client | An OAuth client created by an administrator. |
| Audit log | The endpoint's own record of attempted writes (and of reads when configured). |
| Personal-data tool | A read that returns information about people. |