MCP Commerce Server Starter

io.github.NewPlanetWW由 GitHub 账号 NewPlanetWW 发布v1.0.0更新于 Oct 24, 2026

FastMCP commerce server starter: product catalog, search, and checkout. Deploy to Vercel in 5 min.

已验证Streamable HTTP可网页运行开发者工具商业与电商

概览

AI 生成的概览

一个商务类 MCP 服务器起步模板,提供商品目录资源以及搜索和结账工具,供智能体完成购物流程。

可以做什么
这是一个基于 FastMCP 和 FastAPI 的克隆即部署商务服务器模板。它提供智能体可读取的商品目录资源、支持关键词、分类和最高价格筛选的 search_products 工具,以及返回订单摘要和结账链接的 initiate_checkout 工具。它还提供健康检查端点,可在本地运行或部署到 Vercel。
适用场景
当你需要一个可运行的、面向智能体的商务后端示例,或想把自己的商品目录和结账流程接入 Claude、ChatGPT、Gemini、Cursor 等 MCP 客户端时,可以使用它。它是模板而非成品商店,需要自行替换示例数据和结账占位实现。
运行要求
可作为远程端点使用,也可在本地运行,需要 Python 及通过 pip 安装的依赖;使用 Vercel CLI 部署需要 Node 18+。可选的 API 密钥认证使用 X-API-Key 请求头,由 API_KEY 和 REQUIRE_AUTH 环境变量控制。清单中未声明任何凭据。
安装前请注意
API_KEY 的默认值是占位值,上线前应更换;除非设置 REQUIRE_AUTH,否则认证处于关闭状态。结账工具在接入 Stripe 等真实支付服务前只是占位实现,届时会涉及 STRIPE_SECRET_KEY 和真实扣款。商品数据在替换前只是源码中的示例数据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCP Commerce Server Starter,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.NewPlanetWW%2Fmcp-commerce-starter/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "commerce-starter": {
      "type": "http",
      "url": "https://mcp-commerce-starter.vercel.app/mcp"
    }
  }
}

README

MCP Commerce Server Starter

Clone-and-deploy boilerplate for a commerce MCP server. Live on Vercel in five minutes. Reachable by Claude, ChatGPT, Gemini, Cursor, and every other MCP-compatible client.

Full build guide (with the why behind every line): How to Build an MCP Server in 2026


What you get

  • Product catalog Resource — agents read the full catalog before acting
  • search_products Tool — keyword + category + max-price filter
  • initiate_checkout Tool — returns order summary + checkout URL
  • Optional API-key auth — X-API-Key header, toggle with REQUIRE_AUTH=true
  • Health endpoint at /health
  • Vercel-ready — one command deploy, free Hobby tier

Stack: Python · FastMCP · FastAPI · Vercel


Quick start (local)

bash
git clone https://github.com/NewPlanetWW/mcp-commerce-startercd mcp-commerce-starter
python -m venv .venv && source .venv/bin/activatepip install -r requirements.txt
python server.py# Server running at http://localhost:8000# MCP endpoint: http://localhost:8000/mcp# Health check: http://localhost:8000/health

Test the health endpoint:

bash
curl http://localhost:8000/health# {"status":"ok","server":"Commerce MCP Server","version":"1.0.0"}

Deploy to Vercel (free)

Requires Node 18+ for the Vercel CLI. No GitHub required — the CLI uploads directly.

bash
npm i -g vercelvercel loginvercel --prod

The CLI prints your production URL. Your MCP endpoint is at:

https://your-project.vercel.app/mcp

Set environment variables in the Vercel dashboard (Settings → Environment Variables):

VariableDefaultNotes
API_KEYdev-secret-keyChange before going live
REQUIRE_AUTHfalseSet true to enforce the key

Wire into Claude Desktop

Option A — Local stdio (fast iteration while building):

Edit ~/Library/Application Support/Claude/claude_desktop_config.json on macOS (see full guide for Windows/Linux paths):

json
{  "mcpServers": {    "commerce-catalog": {      "command": "uvicorn",      "args": ["server:app", "--host", "127.0.0.1", "--port", "8001"],      "env": {        "REQUIRE_AUTH": "false"      },      "cwd": "/path/to/mcp-commerce-starter"    }  }}

Option B — Remote (after Vercel deploy) using mcp-remote:

json
{  "mcpServers": {    "commerce-catalog-remote": {      "command": "npx",      "args": [        "-y", "mcp-remote@latest",        "https://your-project.vercel.app/mcp",        "--header", "Authorization: Bearer ${MCP_API_KEY}"      ],      "env": { "MCP_API_KEY": "your-secret-key" }    }  }}

Fully quit and relaunch Claude Desktop. Ask: "What products do you have under $100?" — Claude calls search_products and responds with your catalog.


Customize

Replace the sample products

Edit the PRODUCTS list in server.py. Each product needs: sku, name, price, description, availability, category, image_url.

For real inventory, replace the list with a database call:

python
# server.py — swap PRODUCTS for a live queryimport psycopg2  # or SQLAlchemy, Supabase, etc.
def get_products():    # your DB query here    return [...]
PRODUCTS = get_products()

Add Stripe checkout

Replace the stub in initiate_checkout with a real Stripe session:

python
import stripestripe.api_key = os.getenv("STRIPE_SECRET_KEY")
session = stripe.checkout.Session.create(    line_items=[{"price": price_id, "quantity": quantity}],    mode="payment",    success_url="https://yourstore.com/success",    cancel_url="https://yourstore.com/cancel",)return {"success": True, "checkout_url": session.url, ...}

The 5 errors you'll hit (and how to fix them)

Covered in the full guide: 30daypivot.com/agentmall_spoke_mcp

  1. MCP error -32600 — initialization order violation
  2. 422 Unprocessable Entity — Pydantic model vs plain args mismatch
  3. 405 Method Not Allowed — missing DELETE in CORS allowed methods
  4. stateless_http not set — serverless Vercel requires stateless_http=True
  5. ModuleNotFoundError: mcp — wrong package name (mcp[cli], not fastmcp)

Project structure

mcp-commerce-starter/├── server.py          # FastMCP app — resource, tools, middleware, FastAPI mount├── requirements.txt   # Pinned dependencies├── vercel.json        # Vercel deployment config├── mcp.json           # MCP server manifest├── .env.example       # Environment variable template└── README.md

Go deeper

This starter is the code companion to the AgentMall spoke series on 30DayPivot:


License

MIT

来源:README.md,提交 d9ec6db

工具

0
SourceWeft 尚未读取此服务器的工具。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 75%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。