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 Cloud 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.
The connection is read-only. The agent can retrieve data from your stores, but it can't create, update, or delete data.
Prerequisites#
Add Medusa MCP to an n8n Workflow#
The Medusa MCP server authenticates with OAuth, and n8n registers itself with Medusa automatically. So, you don't need to create 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 Cloud account.
- On the consent page, which shows the application's name as
n8n, select the environments that n8n can access, then click Approve.
Refer to the Medusa MCP guide for more details on the consent page.
Use Medusa in n8n#
Once you connect the credential, 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 connection appears with the n8n logo in your organization's Connections settings, where you can view its details.
To remove the connection, revoke it from the Connections settings.
To change the stores that n8n can access, change the connection's environments from the Connections settings.
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 and how to fix them.