在线精品AI助手MCP服务器
](https://badge.fury.io/py/ai-boutique-assit-mcp)   ](https://pepy.tech/project/ai-boutique-assit-mcp)
用于在线精品AI助手的模型上下文协议(MCP)服务器
通过标准化的模型上下文协议公开微服务,使任何MCP客户端都能访问完整的电子商务功能。
📦 在PyPI上可用
目录
特性
- 完整的电子商务:18个微服务功能,用于产品、购物车、结账、支付、配送
- 标准MCP协议:适用于任何MCP客户端(Claude、ChatGPT、自定义工具)
- 谷歌ADK集成:使用Google Agent开发工具包模式构建
- 动态配置:基于环境变量的配置
- 生产就绪:全面的日志记录和错误处理
建筑
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ MCP Client │────│ MCP Server │────│ Microservices │
│ (Any LLM/Agent) │ │ (This Package) │ │ (Online Boutique) │
└─────────────────┘ └──────────────────┘ └─────────────────────┘安装
从PyPI安装:
pip install ai-boutique-assit-mcp或者从源代码安装:
git clone https://github.com/arjunprabhulal/ai-boutique-assit-mcp.git
cd ai-boutique-assit-mcp
pip install -e .用法
1.启动MCP服务器
服务器支持两种操作模式:
HTTP模式(Web/API访问)
# Standalone HTTP server (default)
boutique-mcp-server --port 8080
# Or explicitly force HTTP mode
boutique-mcp-server --http --port 8081标准模式(ADK集成)
# Force stdio mode for direct ADK integration
boutique-mcp-server --stdio
# ADK will automatically launch in stdio mode when using StdioConnectionParams可用选项
boutique-mcp-server --help
# Options:
# --port PORT Port for HTTP mode (default: 8080)
# --stdio Force stdio mode (for ADK integration)
# --http Force HTTP mode (for web/API access)2.连接ADK代理
HTTP连接(手动启动服务器)
from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset, SseConnectionParams
agent = Agent(
name="boutique_assistant",
model="gemini-2.0-flash",
instruction="You are a helpful e-commerce assistant.",
tools=[
McpToolset(
connection_params=SseConnectionParams(
url="http://localhost:8081/mcp"
)
)
]
)Stdio连接(自动启动服务器)
from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset, StdioConnectionParams, StdioServerParameters
agent = Agent(
name="boutique_assistant",
model="gemini-2.0-flash",
instruction="You are a helpful e-commerce assistant.",
tools=[
McpToolset(
connection_params=StdioConnectionParams(
server_params=StdioServerParameters(
command="boutique-mcp-server",
args=["--stdio"],
env={
"PRODUCT_CATALOG_SERVICE": "localhost:3550",
"CART_SERVICE": "localhost:7070",
# Add other service endpoints as needed
}
)
)
)
]
)可用功能
MCP服务器公开了18个电子商务功能:
产品与目录
list_products()-浏览所有产品search_products(query)-搜索产品目录get_product(product_id)-获取产品详细信息get_product_with_image(product_id)-带图片的产品filter_products_by_price(max_price_usd)-价格过滤
购物车
add_item_to_cart(user_id, product_id, quantity)-加入购物车get_cart(user_id)-查看购物车内容empty_cart(user_id)-清空购物车
结账和订单
place_order(user_id, currency, address, email, credit_card)-完成购买initiate_checkout()-开始结账流程
航运与物流
get_shipping_quote(address, items)-计算运费ship_order(address, items)-安排发货
付款和货币
charge_card(amount, credit_card)-处理付款get_supported_currencies()-可用货币convert_currency(from_amount, to_currency)-货币兑换
沟通
send_order_confirmation(email, order)-电子邮件确认
营销
get_ads(context_keys)-宣传内容list_recommendations(user_id, product_ids)-产品建议
配置
环境变量
服务器通过以下方式连接到Online Boutique微服务 默认端点 (Kubernetes服务名称):
# Default endpoints (production/GKE environment)
PRODUCT_CATALOG_SERVICE="productcatalogservice:3550"
CART_SERVICE="cartservice:7070"
RECOMMENDATION_SERVICE="recommendationservice:8080"
SHIPPING_SERVICE="shippingservice:50051"
CURRENCY_SERVICE="currencyservice:7000"
PAYMENT_SERVICE="paymentservice:50051"
EMAIL_SERVICE="emailservice:5000"
CHECKOUT_SERVICE="checkoutservice:5050"
AD_SERVICE="adservice:9555"用于本地测试,用localhost端点覆盖:
export PRODUCT_CATALOG_SERVICE="localhost:3550"
export CART_SERVICE="localhost:7070"
export RECOMMENDATION_SERVICE="localhost:8080"
export SHIPPING_SERVICE="localhost:50051"
export CURRENCY_SERVICE="localhost:7000"
export PAYMENT_SERVICE="localhost:50052"
export EMAIL_SERVICE="localhost:5000"
export CHECKOUT_SERVICE="localhost:5050"
export AD_SERVICE="localhost:9555"发展
地方发展
# 1. Clone the repository
git clone https://github.com/arjunprabhulal/ai-boutique-assit-mcp.git
cd ai-boutique-assit-mcp
# 2. Install dependencies
pip install -r requirements.txt
# 3. Start MCP server
boutique-mcp-server --port 8081
# Or use Python module directly
python -m ai_boutique_assit_mcp.mcp_server --port 8081
# 4. Test with ADK (stdio mode)
adk run your_agent.py
# 5. Test with ADK (HTTP mode - start server first)
boutique-mcp-server --http --port 8081
# Then in another terminal: adk run your_agent.py构建和发布
# Build package
python -m build
# Publish to PyPI
python -m twine upload dist/*需求
- python:3.9或更高
- 谷歌ADK:用于MCP集成
- gRPC:用于微服务通信
- 目标微服务:兼容的gRPC服务
用例
- AI智能体:将任何LLM连接到电子商务微服务
- API网关:统一访问分布式服务
- 测试:模拟或测试电子商务工作流程
- 整合:微服务访问的标准协议
- 多平台:从Python、Node.js、任何MCP客户端使用
贡献
欢迎投稿!请随时提交拉取请求。
仓库:
- 复刻仓库
- 创建功能分支
- 提交您的更改
- 推到分支
- 创建拉取请求
许可证
MIT许可证-有关详细信息,请参阅许可证文件。
