
Medusa
io.github.trhonpavelv0.2.2更新于 Oct 1, 2026
Medusa v2 store: orders, customers, products, inventory, sales reports and safe write actions.
概览
让助手通过 Medusa v2 管理 API 访问商店的订单、客户、商品、库存和销售报表,并执行有限范围的写操作。
- 功能
- 该服务器把 Medusa v2 管理 API 封装为 MCP 工具。读取类工具涵盖商店信息(区域、货币、销售渠道、库存地点)、带筛选条件的订单列表、订单详情、客户及其订单历史、商品与变体,以及带低库存阈值的库存水平。sales_report 工具可计算收入、客单价、件数、独立客户数、按日/周/月的序列和热销商品。写入类工具可创建发货和物流单、完成或取消订单、更新或删除商品、设置变体价格以及设置库存水平。
- 适用场景
- 当助手需要回答关于 Medusa v2 商店的问题或对其执行操作时适用:查询订单、浏览客户与商品、检查库存、生成销售报表,以及日常的履约或商品目录更新。适合希望以对话方式访问后台数据、而不想自建集成的商店运营人员。
- 运行要求
- 可通过 npm 包 medusa-mcp 以 stdio 方式在本地运行(需要 Node.js),也可作为带 OAuth 2.1 的远程 HTTP 连接器运行。需要 MEDUSA_BACKEND_URL,以及在 Medusa 后台“设置 → 开发者 → 密钥 API 密钥”中创建的 Medusa 密钥 API 密钥,放入 MEDUSA_API_KEY。可选设置包括 MEDUSA_READ_ONLY、REPORT_TIMEZONE;HTTP 模式还需 PUBLIC_URL、OWNER_PASSWORD 和 MCP_STATIC_TOKEN。需要能访问 Medusa 后端的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Medusa,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
medusa-mcp
🇨🇿 Česky
An MCP server for the Medusa v2 Admin API. It gives Claude (or any MCP client) access to orders, customers, products and inventory, computes sales reports, and performs a small set of carefully scoped write actions.
It runs in two modes:
- stdio – locally for Claude Desktop, Claude Code and other MCP clients
- Streamable HTTP + OAuth 2.1 – as a remote connector for Claude (web, desktop, mobile) and ChatGPT
It is listed in the MCP Registry as io.github.trhonpavel/medusa-mcp, and also ships as a Claude Code / Cowork plugin with skills and as a one-click Claude Desktop extension (.mcpb).
Tools
Amounts are in major currency units (Medusa v2 does not store minor units). Plain dates in filters (2026-09-01) are interpreted in REPORT_TIMEZONE (default UTC).
With MEDUSA_READ_ONLY=true the write tools are not registered at all.
1. Create a Medusa API key
In the Medusa Admin go to Settings → Developer → Secret API Keys → Create. The key (sk_…) acts with the permissions of the user who created it, so consider a dedicated admin user that you can revoke independently.
2. Local use (stdio)
Claude Code / Cowork plugin
Claude Code asks for the backend URL and the API key when you enable the plugin (the key goes to the system keychain). Write tools stay off until you turn off Read-only in /config. The plugin adds two skills:
store-briefing– yesterday's and month-to-date sales, paid orders waiting to ship, low stockfulfill-orders– fulfill paid orders and add tracking numbers, after you confirm the list
Claude Desktop extension
Download medusa-mcp-<version>.mcpb from the latest release and open it, or drag it to Settings → Extensions. Claude Desktop asks for the same settings and runs the server with its bundled Node.js. Build it yourself with npm run build:mcpb.
Manual configuration
Claude Desktop – claude_desktop_config.json:
Claude Code:
3. Remote connector (HTTP + OAuth)
Or clone the repo, copy .env.example to .env and run docker compose up -d --build.
The server listens on 127.0.0.1:3000; expose it through a reverse proxy with TLS. Claude connects to remote connectors from Anthropic's servers, so the endpoint must be publicly reachable over HTTPS. Caddy example:
Then add a custom connector in Claude with the URL https://mcp.example.com/mcp. Claude registers itself (Dynamic Client Registration), opens the consent page, you enter OWNER_PASSWORD and click Allow.
ChatGPT
In ChatGPT turn on developer mode in the settings, then create an app (connector) with the MCP server URL https://mcp.example.com/mcp and OAuth authentication. ChatGPT registers itself the same way and redirects to chatgpt.com, which is in the default ALLOWED_REDIRECT_HOSTS. The server returns the RFC 9207 iss parameter, so ChatGPT uses its stable callback URL.
Claude Code
Claude Code can use the same OAuth flow, or a static token if you set MCP_STATIC_TOKEN:
Configuration
Endpoints
Security model
- The Medusa API key never leaves the server. Clients get their own short-lived tokens (1 h access, 30-day refresh with rotation).
- Only SHA-256 hashes of tokens are stored, in
DATA_DIR/oauth-state.json(mode 600). Delete the file to sign out every client. - Dynamic Client Registration only accepts redirect URIs on
ALLOWED_REDIRECT_HOSTS, so an arbitrary app cannot register its own callback and phish a token. - Authorization codes are single-use, expire after 5 minutes, and PKCE S256 is mandatory.
- The consent page sends
Content-Security-Policy: default-src 'none'andX-Frame-Options: DENY, and compares the password in constant time. - Write tools are not marked
readOnlyHintandcancel_order/delete_productcarrydestructiveHint, so clients like Claude ask for approval before running them. - Set
TRUST_PROXYto the number of reverse proxies in front of the server, otherwise rate limiting only sees the proxy's IP.
See SECURITY.md for reporting vulnerabilities.
Development
npm run smoke needs MEDUSA_BACKEND_URL and MEDUSA_API_KEY. Its output contains only keys and types, so it is safe to paste into an issue.
License
来源:README.md,提交 7b484cb
工具
0版本历史
1- v0.2.2最新Oct 1, 2026


