Repository avatar
Monitoring
v0.1.0
active

shopnex-mcp

io.github.khoap1220-hue/shopnex-mcp

Manage ShopNex products, inventory, orders, customers, and analytics via the Admin API.

Documentation

shopnex-mcp

Model Context Protocol (MCP) server for ShopNex stores. Connect Claude Desktop, Cursor, Cline / VS Code, Windsurf, or n8n to your ShopNex Admin REST API (/api/v1/admin/*) using a scoped sk_… API token.

Built on the official @modelcontextprotocol/sdk stdio transport with JSON Schema 2020-12 validated tool definitions, pagination from day one, dashboard analytics, preview-first inventory writes, and an optional read-only lock (SHOPNEX_READ_ONLY=1).


Features

  • Official MCP SDK transport: Uses @modelcontextprotocol/sdk (Server + StdioServerTransport) with zero hand-rolled framing and zero stdout log pollution.
  • JSON Schema 2020-12 & Anthropic API verified: Every tool's inputSchema is validated in CI with Ajv2020 (strict: true) and checked against Anthropic's strict tool-use schema rules.
  • ShopNex /api/v1/admin/* native contract: Authenticates via Authorization: Bearer sk_…, maps pagination to ?limit=&offset=, preserves exact integer-cent money amounts (priceCents, totalCents, salesCents), and surfaces missing read_* / write_* token scopes clearly on HTTP 403.
  • Safe-by-default writes: update_product_inventory defaults to confirm: false (dry-run diff preview) before mutating live variant stock, and SHOPNEX_READ_ONLY=1 removes write tools completely.

Tools

ToolMethod & ShopNex EndpointRequired ScopeDescription
list_productsGET /api/v1/admin/productsread_productsPaginated catalog listing (limit, page / offset, search, customField).
get_productGET /api/v1/admin/products/{id}read_productsFull product details including options, variant UUIDs, SKUs, priceCents, and stock.
update_product_inventoryPATCH /api/v1/admin/variants/{variantId}write_productsUpdates variant inventoryQuantity (and optional priceCents / sku) with confirm preview gate. Hidden when SHOPNEX_READ_ONLY=1.
list_ordersGET /api/v1/admin/ordersread_ordersPaginated orders with financialStatus, fulfillmentStatus, cancelled, customerId, and search (#1001, email, name).
list_customersGET /api/v1/admin/customersread_customersPaginated customer directory with search across email, name, and phone.
shop_analyticsGET /api/v1/admin/analytics/overview + /admin/shopread_ordersStore sales, order count, AOV, returning customer rate vs. prior period, daily series, top 5 products, and unfulfilled/unpaid queues (days, IANA timezone).

1-Step Token Setup

In your ShopNex Admin (Settings → API tokens), create a token (sk_…) with the scopes you want the assistant to have:

ModeRecommended Scopes (Settings → API tokens)
Read + Inventory updateswrite_products, read_orders, read_customers (write_* automatically includes read_*)
Read-only (SHOPNEX_READ_ONLY=1)read_products, read_orders, read_customers

Environment Variables

VariableRequiredDefaultDescription
SHOPNEX_URLYes—Base URL of your ShopNex store (e.g. https://shop.example.com or http://localhost:3000).
SHOPNEX_API_KEYYes—Secret API token (sk_…) from Settings → API tokens.
SHOPNEX_READ_ONLYNo0Set to 1 or true to hide and block all write tools.
SHOPNEX_TIMEOUT_MSNo15000Per-request HTTP timeout in milliseconds (1000–120000).

Client Configuration

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "shopnex": {
      "command": "npx",
      "args": ["-y", "github:khoap1220-hue/shopnex-mcp"],
      "env": {
        "SHOPNEX_URL": "https://shop.example.com",
        "SHOPNEX_API_KEY": "sk_your_token_here"
      }
    }
  }
}

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "shopnex": {
      "command": "npx",
      "args": ["-y", "github:khoap1220-hue/shopnex-mcp"],
      "env": {
        "SHOPNEX_URL": "https://shop.example.com",
        "SHOPNEX_API_KEY": "sk_your_token_here"
      }
    }
  }
}

Cline / VS Code (.vscode/mcp.json)

{
  "servers": {
    "shopnex": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "github:khoap1220-hue/shopnex-mcp"],
      "env": {
        "SHOPNEX_URL": "https://shop.example.com",
        "SHOPNEX_API_KEY": "sk_your_token_here"
      }
    }
  }
}

Windsurf (~/.codeium/windsurf/mcp_config.json)

{
  "mcpServers": {
    "shopnex": {
      "command": "npx",
      "args": ["-y", "github:khoap1220-hue/shopnex-mcp"],
      "env": {
        "SHOPNEX_URL": "https://shop.example.com",
        "SHOPNEX_API_KEY": "sk_your_token_here"
      }
    }
  }
}

n8n (MCP Client Tool Node — Command-line / Stdio)

FieldValue
Connection TypeCommand Line (STDIO)
Commandnpx
Arguments-y github:khoap1220-hue/shopnex-mcp
EnvironmentSHOPNEX_URL=https://shop.example.com,SHOPNEX_API_KEY=sk_your_token_here

Development & Verification

Requires Node.js >= 20.

npm install
npm run lint
npm run typecheck
npm run build
npm test

License

MIT © 2026 Khoa Phan