Medusa MCP in n8n
In this guide, you'll learn how to connect an n8n workflow to the Medusa MCP server and use it to ask questions about your Medusa stores.
What is the Medusa MCP in n8n?#
n8n's MCP Client Tool connects an AI Agent node to the Medusa MCP server, so the agent in your workflow can retrieve your stores' orders, products, customers, and other commerce data. In stores with read and write access, it can also create, update, and delete data.
Prerequisites#
Add Medusa MCP to an n8n Workflow#
n8n registers itself with Medusa automatically through OAuth, so you don't need a client ID or secret. To add the Medusa MCP server to an n8n workflow:
- In your n8n workflow, add an AI Agent node.
- Under the AI Agent node's tools, add an MCP Client Tool.
- In the MCP Client Tool, create a new credential of type MCP OAuth2 API.
- Fill in the credential's fields:
- Use Dynamic Client Registration: Turn it on.
- Server URL:
https://cloud.medusajs.com/mcp - Allowed HTTP Request Domains: Choose Specific Domains, then enter
cloud.medusajs.com. - Resource URL:
https://cloud.medusajs.com/mcp
- Click Save, then click Connect.
- In the browser window that opens, log in to your Medusa account.
- On the consent page, which shows the application's name as
n8n, select the environments that n8n can access, then click Approve.
Use Medusa in n8n#
Run the AI Agent node with a prompt to test the connection. For example:
- "List my connected Medusa environments."
- "Show me the 5 most recent orders in my store, with each order's total and status."
- "How many orders are waiting to be fulfilled?"
Refer to the Medusa MCP guide for the list of tools that the agent can call.
Remove Medusa from n8n#
The n8n connector appears with the n8n logo in your organization's MCP and Connectors settings. From there, you can:
- Revoke the connector to remove it.
- Change the connector's environments to change which stores n8n can access or their access levels.
Troubleshooting#
Domain Not Allowed Error#
If n8n shows a "Domain not allowed" error when you click Connect, add api.prod.medusajs.cloud to the credential's Allowed HTTP Request Domains, along with cloud.medusajs.com.
Other Errors#
Refer to the Medusa MCP troubleshooting section for other common errors.