Back to MCP directory
publicPublicdnsLocal runtime

Store (E-Commerce)

一个通过MCP协议提供商店客户和订单数据查询服务的项目

article

README

🚀 MCP 商店

一个用于从商店 API 获取客户和订单信息的 Model Context Protocol(MCP)服务器,为商店数据交互提供便捷工具。

🚀 快速开始

MCP 商店项目实现了一个 Model Context Protocol 服务器,可与商店数据进行交互。Claude 能借助该服务器获取所有客户列表、按名称搜索客户以及根据特定客户 ID 获取所有订单。

✨ 主要特性

  • 能够获取商店数据库中所有客户列表。
  • 支持按名称搜索客户,并返回所有匹配结果。
  • 可根据特定客户 ID 获取该客户的所有订单信息。

📦 安装指南

先决条件

  • Node.js(推荐使用最新 LTS 版本)
  • 运行在 http://localhost:3000 的本地 API 服务器,提供客户和订单数据

安装步骤

# 克隆仓库
git clone <仓库地址>
cd mcp-store

# 安装依赖项
npm install

# 构建项目
npm run build

💻 使用示例

基础用法

MCP 服务器提供了以下实用工具:

get-all-customers

返回商店数据库中所有客户列表。

get-customer-by-name

按名称搜索客户并返回所有匹配结果。 参数:

  • customerName:要搜索的客户姓名

get-all-orders-by-customer

根据特定客户 ID 获取所有订单信息。 参数:

  • customerId:客户的唯一标识符

📚 详细文档

数据模型

服务器使用以下数据模型:

客户

interface ICustomer {
  name: string;
  email: string;
  phone?: string;
  address?: {
    street?: string;
    city?: string;
    state?: string;
    zip?: string;
    country?: string;
  };
  createdAt?: Date;
}

订单

interface IOrder {
  customer: string;
  items: IOrderItem[];
  totalAmount: number;
  status?: "pending" | "processing" | "shipped" | "delivered" | "cancelled";
  paymentMethod?: "credit_card" | "debit_card" | "paypal" | "cash";
  createdAt?: Date;
}

interface IOrderItem {
  product: string;
  quantity: number;
  price: number;
}

产品

interface IProduct {
  name: string;
  description?: string;
  price: number;
  category?: string;
  inStock?: boolean;
  createdAt?: Date;
}

开发说明

要修改该项目,可按以下步骤操作:

  1. 修改src目录下的源文件。
  2. 使用npm run build构建项目。

📄 许可证

本项目采用 ISC 许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client