Skip to main content
Glama

medusa-mcp

概述

medusa-mcp是一个**模型上下文协议 (MCP) 服务器,**旨在与 Medusa JavaScript SDK 集成。它提供了一个可扩展的后端层,用于管理和与 Medusa 的数据模型交互,从而实现自动化、编排和智能服务扩展。


Related MCP server: Example MCP SSE Server

🧩 什么是 MCP 服务器?

MCP 服务器是一个模块化、可扩展的后端,它:

  • 支持实时服务编排

  • 支持标准化、高吞吐量通信

  • 充当人工智能/自动化工具和现实世界系统之间的桥梁

这些服务器用于人工智能、物联网和企业软件等领域,以连接各种服务并使用 JSON-RPC 等标准化协议自动执行任务。

🔑 主要特点

  • 模块化架构——可组合服务,灵活性强

  • 高效率——针对速度和规模进行优化

  • 可扩展设计——轻松添加新功能

  • 跨环境部署– 云、本地或混合

  • AI-Ready 接口– 无缝集成 LLM 和工具

🧠 在人工智能系统中的作用

MCP 服务器允许 AI 代理:

  • 从 API、文件或数据库访问实时数据

  • 自动化业务流程(例如订单履行、价格更新)

  • 以安全可控的方式与外部服务交互



🚀 美杜莎 JS + MCP

使用medusa-mcp ,Medusa JS 可以:

  • 自动化工作流程(例如库存或价格调整)

  • 连接外部工具(电子邮件、分析等)

  • 使用人工智能代理分析趋势并触发行动

  • 为商业平台提供可扩展的模块化架构


✨ 特点

  • ✅**模型上下文协议(MCP)**支持

  • 📈可扩展的基础设施

  • 🧱可扩展的插件架构

  • 🔗 与 Medusa JS SDK集成


🛠️ 安装

克隆存储库并安装依赖项:

npm install

构建项目:

npm run build

▶️ 使用方法

启动服务器:

npm start

使用 MCP 检查器进行测试:

npx @modelcontextprotocol/inspector ./dist/index.js

**注意:**每次重建后重新启动检查器和浏览器。


🌍 环境变量

多变的

描述

MEDUSA_BACKEND_URL

您的 Medusa 后端 URL

PUBLISHABLE_KEY

您的 Medusa 可发布 API 密钥

MEDUSA_USERNAME

Medusa 管理员用户名(用于管理员)

MEDUSA_PASSWORD

Medusa 管理员密码(用于管理员)

服务器运行于: http://localhost:3000


🧠 架构图

以下是medusa-mcp服务器如何与 Medusa JS 和外部系统一起适应典型设置:


       +-------------------------+
       |     AI Assistant /      |
       |     LLM / Automation    |
       +-----------+-------------+
                   |
                   v
    +--------------+--------------+
    |     MCP Server (medusa-mcp) |
    |-----------------------------|
    | - JSON-RPC Communication    |
    | - AI-Ready Interface        |
    | - Plugin Support            |
    +------+----------------------+
                   |                             
                   +
                   |                                                         
                   v                                                         
         +-------------------+
         | Medusa Backend    |
         | (Products, Orders)|
         +-------------------+
                   |
                   |
                   v
           +--------------+
           | Medusa Store |
           | Frontend     |
           +--------------+
                   |
                   |
                   v
      +-------------------------+
      | External Services / API |
      | (e.g., Payments, Email) |
      +-------------------------+

🧪 定制

要根据您的 Medusa 设置定制服务器:

将admin.json和store.json替换为您自己的 OAS 定义,以实现细粒度控制。

  • 替换oas/文件夹中的 OpenAPI 模式:

    • admin.json – 管理端点

    • store.json – 店面端点

使用@medusajs/medusa-oas-cli重新生成这些文件。

您还可以分叉此项目来构建您自己的自定义 MCP 驱动的 Medusa 集成。


🤝 贡献

欢迎大家贡献!请参阅我们的CONTRIBUTING.md指南。


📄 许可证

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

Available Tools

48 tools
GetCartsIdC

Retrieve a cart by its ID. You can expand the cart's relations or select the fields that should be returned.

Inputs: id, fields.

GetCollectionsC

Retrieve a list of collections. The collections can be filtered by fields such as handle. The collections can also be sorted or paginated.

Inputs: fields, offset, limit, order, +7 more.

GetCollectionsIdB

Retrieve a collection by its ID. You can expand the collection's relations or select the fields that should be returned.

Inputs: id, fields.

GetCurrenciesC

Retrieve a list of currencies. The currencies can be filtered by fields such as code. The currencies can also be sorted or paginated.

Inputs: fields, offset, limit, order, +4 more.

GetCurrenciesCodeC

Retrieve a currency by its code. You can expand the currency's relations or select the fields that should be returned.

Inputs: code, fields.

GetCustomersMeB

Retrieve the logged-in customer. You can expand the customer's relations or select the fields that should be returned.

Inputs: fields.

GetCustomersMeAddressesC

Retrieve the addresses of the logged-in customer. The addresses can be filtered by fields such as country_code. The addresses can also be sorted or paginated.

Inputs: fields, offset, limit, order, +4 more.

GetCustomersMeAddressesAddress_idC

Retrieve an address of the logged-in customer. You can expand the address's relations or select the fields that should be returned.

Inputs: address_id, fields.

GetOrdersC

Retrieve the orders of the logged-in customer. The orders can be filtered by fields such as id. The orders can also be sorted or paginated.

Inputs: fields, offset, limit, order, +4 more.

GetOrdersIdC

Retrieve an order by its ID. You can expand the order's relations or select the fields that should be returned.

Inputs: id, fields.

GetPaymentProvidersB

Retrieve a list of payment providers. You must provide the region_id query parameter to retrieve the payment providers enabled in that region.

Inputs: fields, offset, limit, order, +1 more.

GetProductCategoriesC

Retrieve a list of product categories. The product categories can be filtered by fields such as id. The product categories can also be sorted or paginated.

Inputs: fields, offset, limit, order, +12 more.

GetProductCategoriesIdB

Retrieve a product category by its ID. You can expand the product category's relations or select the fields that should be returned.

Inputs: id, fields, include_ancestors_tree, include_descendants_tree.

GetProductsC

Retrieve a list of products. The products can be filtered by fields such as id. The products can also be sorted or paginated.

Inputs: fields, offset, limit, order, +19 more.

GetProductsIdC

Retrieve a product by its ID. You can expand the product's relations or select the fields that should be returned.

Inputs: id, fields, region_id, country_code, +5 more.

GetProductTagsC

Retrieve a list of product tags. The product tags can be filtered by fields such as id. The product tags can also be sorted or paginated.

Inputs: fields, offset, limit, order, +7 more.

GetProductTagsIdC

Retrieve a product tag by its ID. You can expand the product tag's relations or select the fields that should be returned.

Inputs: id, fields.

GetProductTypesC

Retrieve a list of product types. The product types can be filtered by fields such as id. The product types can also be sorted or paginated.

Inputs: fields, offset, limit, order, +7 more.

GetProductTypesIdC

Retrieve a product type by its ID. You can expand the product type's relations or select the fields that should be returned.

Inputs: id, fields.

GetRegionsC

Retrieve a list of regions. The regions can be filtered by fields such as id. The regions can also be sorted or paginated.

Inputs: fields, offset, limit, order, +6 more.

GetRegionsIdC

Retrieve a region by its ID. You can expand the region's relations or select the fields that should be returned.

Inputs: id, fields.

GetReturnReasonsC

Retrieve a list of return reasons. The return reasons can be sorted or paginated.

Inputs: fields, offset, limit, order.

GetReturnReasonsIdC

Retrieve a return reason by its ID. You can expand the return reason's relations or select the fields that should be returned.

Inputs: id, fields.

GetShippingOptionsC

Retrieve a list of shipping options for a cart. The cart's ID is set in the required cart_id query parameter.

The shipping options also be sorted or paginated.

Inputs: fields, offset, limit, order, +4 more.

PostActor_typeAuth_providerA

Authenticate a customer and receive the JWT token to be used in the header of subsequent requests.

When used with a third-party provider, such as Google, the request returns a location property. You redirect to the specified URL in your storefront to continue authentication with the third-party service.

Inputs: auth_provider.

PostActor_typeAuth_providerCallbackB

This API route is used by your storefront or frontend application when a third-party provider redirects to it after authentication. It validates the authentication with the third-party provider and, if successful, returns an authentication token. All query parameters received from the third-party provider, such as code, state, and error, must be passed as query parameters to this route. You can decode the JWT token using libraries like react-jwt in the storefront. If the decoded data doesn't have an actor_id property, then you must register the customer using the Create Customer API route passing the token in the request's Authorization header.

Inputs: auth_provider.

PostActor_typeAuth_provider_registerC

This API route retrieves a registration JWT token of a customer that hasn't been registered yet. The token is used in the header of requests that create a customer.

Inputs: auth_provider.

PostActor_typeAuth_providerResetPasswordA

Generate a reset password token for a customer. This API route doesn't reset the customer password or send them the reset instructions in a notification.

Instead, This API route emits the auth.password_reset event, passing it the token as a payload. You can listen to that event in a subscriber as explained in this guide, then send the customer a notification. The notification is sent using a Notification Module Provider, and it should have a URL that accepts a token query parameter, allowing the customer to reset their password from the storefront.

Use the generated token to update the customer's password using the Reset Password API route.

Inputs: auth_provider.

PostActor_typeAuth_providerUpdateC

Reset a customer's password using a reset-password token generated with the Generate Reset Password Token API route. You pass the token as a bearer token in the request's Authorization header.

Inputs: auth_provider.

PostAdminAuthTokenRefreshA

Refresh the authentication token of a customer. This is useful after authenticating a customer with a third-party service to ensure the token holds the new user's details, or when you don't want customers to re-login every day.

Inputs: no named parameters.

PostCartsD

Create a cart.

Inputs: fields.

PostCartsIdCompleteC

Complete a cart and place an order.

Inputs: id, fields.

PostCartsIdCustomerB

Set the customer of the cart. This is useful when you create the cart for a guest customer, then they log in with their account.

Inputs: id, fields.

PostCartsIdLineItemsC

Add a product variant as a line item in the cart.

Inputs: id, fields.

PostCartsIdLineItemsLine_idC

Update a line item's details in the cart.

Inputs: id, line_id, fields.

PostCartsIdPromotionsC

Add a list of promotions to a cart.

Inputs: id, fields.

PostCartsIdShippingMethodsB

Add a shipping method to a cart. Use this API route when the customer chooses their preferred shipping option.

Inputs: id, fields.

PostCartsIdTaxesC

Calculate the cart's tax lines and amounts.

Inputs: id, fields.

PostCustomersC

Register a customer. Use the /auth/customer/emailpass/register API route first to retrieve the registration token and pass it in the header of the request.

Inputs: fields.

PostOrdersIdTransferAcceptB

Accept an order to be transfered to a customer's account, which was specified when the transfer request was created. The transfer is requested previously either by the customer using the Request Order Transfer Store API route, or by the admin using the Request Order Transfer Admin API route.

Inputs: id, fields.

PostOrdersIdTransferCancelC

Cancel an order transfer that the logged-in customer previously requested using the Request Order Transfer API route.

Inputs: id, fields.

PostOrdersIdTransferDeclineC

Decline an order transfer previously requested, typically by the admin user using the Request Order Transfer Admin API route.

Inputs: id, fields.

PostOrdersIdTransferRequestC

Request an order to be transfered to the logged-in customer's account. The transfer is confirmed using the Accept Order Transfer API route.

Inputs: id, fields.

PostPaymentCollectionsC

Create a payment collection for a cart. This is used during checkout, where the payment collection holds the cart's payment sessions.

Inputs: fields.

PostPaymentCollectionsIdPaymentSessionsB

Initialize and add a payment session to a payment collection. This is used during checkout, where you create a payment collection for the cart, then initialize a payment session for the payment provider that the customer chooses.

Inputs: id, fields.

PostReturnB

Create a return for an order's items. The admin receives the return and process it from their side.

Inputs: no named parameters.

PostSessionA

Set the cookie session ID of a customer. The customer must be previously authenticated with the /auth/customer/{provider} API route first, as the JWT token is required in the header of the request.

Inputs: no named parameters.

PostShippingOptionsIdCalculateC

Calculate the price of a shipping option in a cart.

Inputs: id, fields.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 48 tools

    Disambiguation5/5

    Every tool has a distinct purpose targeting specific resources and actions, such as GetCartsId for retrieving a cart by ID, PostCarts for creating a cart, and PostCartsIdComplete for completing a cart. The naming and descriptions clearly differentiate between retrieval, creation, update, and other operations, with no overlapping or ambiguous tools.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, using 'Get' for retrieval, 'Post' for creation or action, and specific identifiers like 'Id' or 'Code'. Examples include GetProductsId, PostCartsIdLineItems, and PostActor_typeAuth_provider, all adhering to a predictable and readable convention.

    Tool Count2/5

    With 48 tools, the count is excessive for an MCP server, making it cumbersome for agents to navigate and increasing the risk of misselection. While the server covers a broad e-commerce domain, a more streamlined set of 15-25 tools would be more appropriate for usability and coherence.

    Completeness5/5

    The tool set provides comprehensive coverage of the e-commerce domain, including CRUD operations for carts, products, orders, customers, and authentication, as well as specialized actions like payment processing, shipping, and returns. There are no obvious gaps, ensuring agents can handle full workflows without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers