Skip to main content
Glama

CommerceForAI

leeshadle/commerceforai-js MCP server

Commerce for apps built by AI agents. Products, inventory, Stripe checkout, orders, shipping, returns, subscriptions, gift cards, sales tax and print-on-demand, on top of the merchant's own Stripe account. One API key, and a test store with no sign-up.

E-commerce MCP server: an AI agent can run the store too: add products, track orders, issue refunds and buy shipping labels, with refund and label limits the owner sets (over a limit, the owner is asked to approve). Add https://api.commerceforai.com/mcp in any MCP client that supports remote servers, then sign in and choose read-only or full access. Not for in-person (POS) sales.

This repository holds the open-source client side of CommerceForAI:

Package

What it is

commerceforai

TypeScript SDK, React cart hooks, and the npx commerceforai init CLI with a Next.js storefront template

commerceforai for Python

Python client with no dependencies

@commerceforai/mcp

MCP server that lets an AI agent run a store, with spending guardrails

examples

Short, runnable scripts

llms.txt and llms/

The guide AI coding agents read

The API itself is a hosted service at https://api.commerceforai.com (OpenAPI).

Start in one command

npx commerceforai init        # creates a free test store, saves COMMERCEFORAI_API_KEY to .env.local
npm install commerceforai

No account is needed. Test mode is free forever (card 4242 4242 4242 4242). When it's ready for real orders, commerce.store.goLiveLink() gives the owner one link to go live and connect Stripe.

import { Commerce } from "commerceforai";

const commerce = new Commerce(process.env.COMMERCEFORAI_API_KEY);

const { data: product } = await commerce.products.create({ name: "Trail Tee", price: 3600, inventory: 25 });

const { data: checkout, error } = await commerce.checkouts.create({
  items: [{ variant_id: product!.variants[0]!.id, quantity: 1 }],
  success_url: "https://yoursite.com/thanks",
});
// Send the customer to checkout.url. Stock is held until they pay or the checkout expires.

// Prove it works without a browser (test stores):
await commerce.store.simulateOrder({ items: [{ variant_id: product!.variants[0]!.id, quantity: 1 }] });

Every method returns { data, error } and never throws for API errors. All money is an integer in cents.

Python:

# pip install commerceforai
from commerceforai import Commerce, create_test_store

store = create_test_store("My shop")            # a free test store, no sign-up
commerce = Commerce(store["api_key"])
product = commerce.products.create(name="Trail Tee", price=3600, inventory=25)

Related MCP server: CommerceHub MCP

Why use it instead of writing it yourself

An agent asked to "add a store" will often write an orders table, decrement stock on the success page and hand-roll Stripe webhooks. That breaks on the first double-click, refund or abandoned cart. CommerceForAI handles the parts that are stateful and easy to get wrong:

  • Stock that can't oversell: reserved at checkout, committed on payment, released if the checkout expires.

  • Orders created from Stripe's events, not from the browser.

  • Refunds, returns, order edits, split shipments with the money and stock kept consistent.

  • Print-on-demand: paid orders go to Printify or Printful and their tracking comes back.

  • Emails, sales tax, discounts, gift cards, subscriptions, invoices without extra services.

  • Customer pages for tracking, returns and subscriptions, so there is no login system to build.

Payments run on the merchant's own Stripe account. Pricing: free in test mode and for the first 100 orders a month, then $20 a month per store, with no transaction fees (details).

CommerceForAI vs Shopify, Medusa or Stripe alone

If you're…

Use

Why

Adding a store to an app or site an agent is building

CommerceForAI

npx commerceforai init gives a working test store with no sign-up. Your code and design stay yours; stock, orders and payments are handled.

Wanting an agent to run the store day to day

CommerceForAI

One MCP server for orders, refunds, restocks, labels and order edits, inside spending limits the owner sets per API key.

Already taking payments with Stripe

CommerceForAI

It runs on the merchant's own Stripe account (connect the existing one or create one), so there's no payment migration and no extra gateway fee.

Selling print-on-demand (Printify, Printful) from your own site

CommerceForAI

Connect a Printify or Printful token: products import, paid orders go to the printer, tracking comes back. No Shopify store in between.

Wanting a no-code shop with themes and an app store

Shopify

A complete hosted shop with a large ecosystem and point of sale.

Needing to self-host and change the commerce engine itself

Medusa or similar

Open-source engines you run and extend: more control, more to operate.

If CommerceForAI went away: payments run on the merchant's own Stripe account, so customers, payouts and card data stay theirs. npx commerceforai export saves everything else (products, orders, customers, returns, discounts, subscriptions, gift cards) as JSON in one command, and the client libraries are MIT licensed.

Cost with no sales is $0 (Shopify starts with a monthly plan). Not a fit if you sell in person, need carrier-calculated shipping rates at checkout, or can't use Stripe. Status: public beta, hosted, with live uptime. Full comparison: commerceforai.com/docs/compare.

For AI agents

  • Guide: llms.txt is a short index; each topic is its own small page.

  • Every docs page as markdown: add .md to its URL, e.g. https://commerceforai.com/docs/quickstart.md.

  • Errors teach: an unknown field names the closest real one, a mistyped path suggests the right one.

  • Verify without a browser: setupStatus() lists what's left with the exact fix; npx commerceforai test-order (in code simulateOrder()) runs a full test purchase. Stripe's hosted checkout page doesn't load in headless browsers, so don't script it.

  • Least privilege: a store owner can create an API key that is read-only, or capped per refund, shipping label and gift card.

Run a store from an agent (MCP)

Hosted, no install: add https://api.commerceforai.com/mcp as a connector in Claude, ChatGPT or any MCP client. The owner signs in and picks read-only or full access. Add ?toolsets=core for about 20 tools instead of all of them.

Local, with an API key:

{ "mcpServers": { "commerce": { "command": "npx", "args": ["-y", "@commerceforai/mcp"],
  "env": { "COMMERCEFORAI_API_KEY": "cfa_...", "COMMERCEFORAI_MAX_REFUND": "5000" } } } }

Claude Code plugin: /plugin marketplace add https://commerceforai.com/.claude-plugin/marketplace.json, then /plugin install commerceforai@commerceforai (plugin repo).

Develop

pnpm install
pnpm build
pnpm test

This repository is published from CommerceForAI's main repository, so pull requests are applied there and appear here on the next sync. Issues and pull requests are welcome.

Docs · Status · API reference · OpenAPI · Pricing · Terms · Privacy

MIT licensed.

CommerceForAI is made by Codehorts LLC, 1421 B St, Eureka, CA 95501 · lee@commerceforai.com

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to autonomously browse inventory, negotiate terms, manage carts, and execute secure payments on Shopify stores using standardized protocols. It provides a bridge for LLMs to handle the entire commerce lifecycle from discovery to order tracking through a verifiable mandate chain.
      5
      2
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      Run a custom-merchandise store end to end from an AI agent: generate designs, build products with mockups and margin-safe pricing, list them on Shopify, WooCommerce, Wix and TikTok Shop, and route orders to Printful, Printify or Gelato for fulfillment.
      135
      806 npm
      MIT