mcp-commerce-starter

mcp-commerce-starter

MCP server exposing Shopify commerce backend with ~22 typed tools for orders, inventory, logistics, and fulfillment, including read/write separation and structured errors.

Category
访问服务器

README

mcp-commerce-starter

An MCP server is how you hand an AI agent a real set of hands. This one exposes a Shopify commerce backend — orders, inventory, logistics, fulfillment — as ~22 typed tools an agent can actually call, with the guardrails that keep it from doing something irreversible.

It's ~1,100 lines of Node.js, and it's a real server, not a tutorial. It handles pagination over large order sets, idempotent fulfillment calls, structured errors the model can recover from, and read/write separation so an agent can analyze freely but only mutate through explicit, narrow tools.

I'm shipping it as a starter because the gap between "MCP hello-world" and "MCP server you'd trust against a production backend" is exactly the part nobody publishes.


Tools

Analytics (read-only)

Tool What it does
get_monthly_sales Revenue, order count, AOV, COD/prepaid split for a month
get_daily_sales Sales for a specific date
get_monthly_trend Month-over-month trend table
compare_months Side-by-side comparison of two months
get_product_sales_by_month Per-product revenue breakdown
get_store_stats Lifetime store stats

Products (read + write)

Tool What it does
get_all_products Full catalog with status, price, SEO fields
get_product Single product by ID
update_product_seo Update SEO meta title + description
update_product_description Update product body HTML
update_product_image_alt Update image alt text
get_product_page_analytics Cross-references catalog with orders to flag low-converting products
get_inventory_status Live inventory levels across all products

Orders (read-only)

Tool What it does
search_order Find order by name, phone, or email
get_order Single order by ID
get_order_tracking AWB + tracking status for an order
get_recent_orders Last N orders
get_cod_orders COD orders for a date range
get_unfulfilled_orders Pending fulfillment queue

Logistics (write — Delhivery API)

Tool What it does
create_delhivery_shipment Book a forward shipment (creates AWB)
create_delhivery_reverse_pickup Book a return pickup from customer
fulfill_shopify_order Mark order fulfilled in Shopify with tracking

Architecture Notes

Auth: Uses Shopify Partner app OAuth flow (client_credentials) — access tokens cached in memory, auto-refreshed before expiry. No session tokens stored to disk.

Pagination: Large order sets paginated transparently via Shopify's cursor-based page_info system. Callers get complete data without managing cursors.

Read/write separation: Analytics, product reads, and order reads are all read-only. Only update_*, create_*, and fulfill_* tools mutate state. This separation is enforced at the tool description level — the model is told explicitly which tools are safe to call freely vs. which require confirmation.

IST date handling: All date boundaries shifted for IST (UTC+5:30). A query for "today's orders" returns orders placed on the Indian calendar day, not the UTC day.

Structured errors: Tool errors return a JSON object with error, code, and detail fields — not raw stack traces. The model can parse the error and either retry with corrected inputs or explain the failure to the user.


Setup

1. Clone and install

git clone https://github.com/singhjitesh889-blip/mcp-commerce-starter.git
cd mcp-commerce-starter
npm install

2. Configure environment

cp .env.example .env
# Fill in your Shopify credentials and seller details

3. Create a Shopify Partner app

You need a Shopify Partner app with the following scopes:

  • read_products, write_products
  • read_orders
  • read_inventory

Get your client_id and client_secret from the Shopify Partner Dashboard.

4. Wire into Claude Code

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "commerce": {
      "command": "node",
      "args": ["/path/to/mcp-commerce-starter/index.js"],
      "env": {
        "SHOPIFY_SHOP": "https://your-store.myshopify.com",
        "SHOPIFY_CLIENT_ID": "your_client_id",
        "SHOPIFY_CLIENT_SECRET": "your_client_secret",
        "SELLER_NAME": "Your Business",
        "SELLER_CITY": "Your City",
        "SELLER_STATE": "Your State",
        "RETURN_PIN": "000000",
        "RETURN_PHONE": "9999999999",
        "RETURN_ADDRESS": "Your return address",
        "RETURN_CITY": "Your City",
        "RETURN_STATE": "Your State"
      }
    }
  }
}

5. Test

> what were my sales last month?
> show me unfulfilled orders
> search for order #1234

The Logistics Tools

The Delhivery integration (create_delhivery_shipment, create_delhivery_reverse_pickup) requires a Delhivery API account. These are India-specific — swap in your own logistics provider's API for other markets. The tool interface stays the same; the API call underneath is what changes.

If you don't use Delhivery, leave DELHIVERY_API_TOKEN unset — the tools will return an error if called, but all other tools continue to work.


Related

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选