使用说明
MCP商店
一种模型上下文协议(MCP)服务器,用于从商店API检索客户和订单信息。
概述
该项目实现了一个模型上下文协议服务器,该服务器提供了与商店的客户和订单数据交互的工具。它允许克劳德:
- 获取所有客户的列表
- 按名称搜索客户
- 检索特定客户的所有订单
先决条件
- Node.js(推荐最新LTS版本)
- 上运行的本地API服务器http://localhost:3000提供客户和订单数据
安装
# Clone the repository
git clone <repository-url>
cd mcp-store
# Install dependencies
npm install
# Build the project
npm run build
用法
MCP服务器提供以下工具:
获得所有客户
返回商店数据库中所有客户的列表。
按名称获取客户
按姓名搜索客户并返回所有匹配的结果。
参数:
customerName:要搜索的名称
按客户获取所有订单
检索特定客户下达的所有订单。
参数:
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;
}
发展
要完成此项目,请执行以下操作:
- 对中的源文件进行更改
src目录 - 用以下方式构建项目
npm run build
许可证
国际协调委员会
