MCP Product Search Server
MCP Product Search Server
一个基于 Model Context Protocol (MCP) 的产品搜索服务器,让 Claude 能够根据关键词检索产品目录并返回结构化数据。
功能
提供三个工具供 Claude 调用:
工具 | 说明 |
| 按关键词搜索产品,支持分类、价格、评分过滤 |
| 列出所有产品分类及数量 |
| 按 ID 查询单个产品的完整信息 |
Related MCP server: MCP Merchant Scout
快速开始
1. 克隆项目
git clone <your-repo-url>
cd mcp-product-search2. 创建虚拟环境并安装依赖
macOS / Linux:
python3 -m venv .venv
source .venv/bin/activate
pip install "mcp[cli]"Windows:
python -m venv .venv
.venv\Scripts\activate
pip install "mcp[cli]"需要 Python 3.10 及以上版本。可用
python3 --version检查。
3. 在浏览器中测试
mcp dev server.py浏览器会自动打开 MCP Inspector。如果没有自动打开,手动访问终端输出的地址(通常是 http://localhost:6274)。
连接步骤:
将左侧 Command 改为虚拟环境中 Python 的绝对路径:
macOS/Linux:
/绝对路径/mcp-product-search/.venv/bin/pythonWindows:
C:\绝对路径\mcp-product-search\.venv\Scripts\python.exe
Arguments 填
server.py点击 Connect,左下角显示 Connected 即成功
点击顶部 Tools 标签,选择工具,填写参数,点击 Run Tool

4. 接入 Claude Desktop
找到配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
添加以下内容(替换为实际的绝对路径):
{
"mcpServers": {
"product-search": {
"command": "/绝对路径/mcp-product-search/.venv/bin/python",
"args": ["/绝对路径/mcp-product-search/server.py"]
}
}
}查看当前目录的绝对路径:
# macOS / Linux
pwd
# Windows
cd保存配置文件后,完全退出并重启 Claude Desktop。
5. 接入 Claude Code(命令行)
claude mcp add product-search \
/绝对路径/mcp-product-search/.venv/bin/python \
/绝对路径/mcp-product-search/server.py使用示例
接入 Claude 后,可以这样提问:
帮我搜索苹果品牌的笔记本电脑
找一款评分 4.8 以上、价格不超过 300 美元的耳机
列出所有产品分类
查询产品 P003 的详细信息Claude 会自动判断调用哪个工具,并基于返回的结构化数据给出回答。
工具参数说明
search
参数 | 类型 | 必填 | 默认值 | 说明 |
| string | 是 | — | 匹配产品名称、描述、品牌、分类和标签 |
| string | 否 | — | 按分类过滤,如 |
| float | 否 | — | 最高价格(USD) |
| float | 否 | — | 最低评分(0–5) |
| int | 否 |
| 返回结果数量上限(最多 50) |
返回结果按评分从高到低、价格从低到高排序。
返回示例:
{
"keyword": "apple",
"filters": { "category": "Laptops", "max_price": null, "min_rating": null },
"total_results": 1,
"products": [
{
"id": "P001",
"name": "Apple MacBook Pro 14-inch M3",
"category": "Laptops",
"brand": "Apple",
"price": 1999.0,
"currency": "USD",
"stock": 42,
"rating": 4.8,
"description": "14-inch Liquid Retina XDR display, M3 chip, 18GB RAM, 512GB SSD.",
"tags": ["laptop", "apple", "macbook", "m3", "professional", "portable"]
}
]
}list_categories
无参数。返回所有分类名称及对应产品数量。
get_product
参数 | 类型 | 必填 | 说明 |
| string | 是 | 产品 ID,如 |
项目结构
mcp-product-search/
├── server.py # MCP 服务器,定义工具
├── products.py # 产品目录与搜索逻辑
├── pyproject.toml # 项目依赖
└── README.md扩展产品数据
当前产品目录是写在 products.py 中的 12 条示例数据,替换为真实数据只需修改 search_products() 函数,server.py 无需改动。
数据来源 | 改法 |
本地 JSON/CSV | 启动时读文件填充 |
SQLite / PostgreSQL | 用 SQL 查询替换遍历逻辑 |
电商 API | 函数内部发 HTTP 请求 |
Elasticsearch | 调用 ES 全文搜索接口 |
Available Tools
3 toolsget_productA
Retrieve full details for a single product by its ID (e.g. "P001").
Args: product_id: The product's unique identifier.
| Name | Required | Description | Default |
|---|---|---|---|
| product_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist; description implies read-only but fails to disclose any behavioral details beyond 'retrieve'.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise, front-loading the core purpose and listing the parameter clearly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple single-parameter input and presence of an output schema, the description is sufficiently complete for the task.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaning to the product_id parameter with an example and context, compensating for 0% schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it retrieves full details for a single product by ID, distinguishing it from siblings like list_categories and search.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings like search or list_categories is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_categoriesA
Return all available product categories and their item counts.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description only states the basic return value, omitting additional behavioral details such as ordering, limits, or side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, clear sentence with no unnecessary words, perfectly front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read operation with no parameters and an output schema present, the description sufficiently covers what the tool returns.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Since there are no parameters, the description does not need to add parameter information. Baseline 4 for 0 parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states the verb 'Return' and resource 'all available product categories and their item counts', distinguishing it from sibling tools like 'get_product' and 'search'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'search' or 'get_product', leaving the agent to infer context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
searchA
Search products by keyword with optional filters.
Args: keyword: Search term matched against name, description, brand, category, and tags. category: Filter by exact category name (e.g. "Laptops", "Headphones"). max_price: Upper price limit in USD. min_rating: Minimum rating (0–5). limit: Maximum number of results to return (default 10, max 50).
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | ||
| category | No | ||
| max_price | No | ||
| min_rating | No | ||
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses that keyword matches multiple fields (name, description, brand, category, tags) and explains filters, but does not mention that the operation is read-only, result ordering, or error behavior. Adequate but missing some context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, with a clear introductory sentence followed by structured 'Args' bullet points. It front-loads the purpose and efficiently details parameters without unnecessary text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 5 parameters and existence of an output schema, the description covers input well but omits output format details. It could mention response structure or behavior like empty results. Acceptable but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so description must compensate. It fully explains each parameter beyond the schema: keyword matches specific fields, category is exact name, max_price is in USD, min_rating is 0-5, limit has default and max. This adds significant meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Search products by keyword with optional filters.' It specifies the verb 'search' and the resource 'products', distinguishing it from sibling tools 'get_product' (retrieves a single product) and 'list_categories' (lists categories).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for searching products but does not explicitly contrast with siblings or provide when-not-to-use guidance. The context is clear from names, but the description lacks explicit exclusions or alternative recommendations.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
get_product - First observed
list_categories - First observed
search
TDQS
Scored across 3 tools
Each tool has a distinct purpose: get_product retrieves by ID, list_categories returns category overview, search does keyword-based filtering. No ambiguity in their roles.
All tool names follow a consistent verb_noun pattern (get_product, list_categories, search) using snake_case, making them predictable.
With 3 tools, the server is well-scoped for a search-focused service. Each tool earns its place without bloat or deficiency.
The tool set covers core search and retrieval operations (get by ID, list categories, keyword search). Missing a general 'list all products' operation, but search likely covers this with an empty keyword, though not documented; minor gap.
Maintenance
Related MCP Connectors
AMZScout Skill + MCP gives AI agents live access to real Amazon marketplace data across 14 Amazon marketplaces. Analyze any ASIN, validate product ideas, research niches, compare competitors, discover profitable keywords, and build data-driven PPC strategies using trusted Amazon insights instead of AI assumptions. Works with Claude, ChatGPT, Cursor, and any other MCP-compatible AI client. To connect, you'll need an AMZScout API plan and authorize your account. Get access and view pricing here: https://learn.amzscout.net/amazon-product-api-for-ai-agents
Search multi-merchant supply, checkout, and track orders via MCP.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Connect Amazon Seller Central to Claude or ChatGPT via MCP. Orders, inventory, pricing, fees, FBA.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables users to search for products, retrieve details, and manage their shopping cart on Amazon through the MCP framework. It also supports viewing order history and provides a demonstration of ordering capabilities within AI interfaces.21 npm54MIT
- AlicenseAqualityDmaintenanceAn MCP server that wraps the Universal Commerce Protocol (UCP) Discovery and Catalog capabilities, letting you search and compare products across UCP merchants directly from Claude.4MIT
- FlicenseNot gradedqualityDmaintenanceEnables product comparison and analysis for any MCP-compatible AI assistant, with tools like compare_products and list_products.-
- FlicenseNot gradedqualityDmaintenanceEnables e-commerce shopping assistant capabilities including product search, cart management, payment processing, and order fulfillment via MCP tools.-