Skip to main content
Glama
hwqlet

MCP Product Search Server

by hwqlet

MCP Product Search Server

A product search server based on the Model Context Protocol (MCP), allowing Claude to retrieve product catalogs based on keywords and return structured data.

Features

Provides three tools for Claude to call:

Tool

Description

search

Search for products by keyword, supports filtering by category, price, and rating

list_categories

List all product categories and their counts

get_product

Query full information for a single product by ID

Related MCP server: commerce-mcp-server

Quick Start

1. Clone the project

git clone <your-repo-url>
cd mcp-product-search

2. Create a virtual environment and install dependencies

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]"

Requires Python 3.10 or higher. You can check with python3 --version.

3. Test in the browser

mcp dev server.py

The browser will automatically open the MCP Inspector. If it does not open automatically, manually visit the address output in the terminal (usually http://localhost:6274).

Connection Steps:

  1. Change the Command on the left to the absolute path of the Python executable in your virtual environment:

    • macOS/Linux: /absolute/path/to/mcp-product-search/.venv/bin/python

    • Windows: C:\absolute\path\to\mcp-product-search\.venv\Scripts\python.exe

  2. Fill in server.py for Arguments

  3. Click Connect. If the bottom left shows Connected, it is successful

  4. Click the Tools tab at the top, select a tool, fill in the parameters, and click Run Tool

MCP Inspector connection success illustration

4. Integrate with Claude Desktop

Locate the configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the following content (replace with the actual absolute path):

{
  "mcpServers": {
    "product-search": {
      "command": "/绝对路径/mcp-product-search/.venv/bin/python",
      "args": ["/绝对路径/mcp-product-search/server.py"]
    }
  }
}

To view the absolute path of the current directory:

# macOS / Linux
pwd

# Windows
cd

After saving the configuration file, completely exit and restart Claude Desktop.

5. Integrate with Claude Code (CLI)

claude mcp add product-search \
  /绝对路径/mcp-product-search/.venv/bin/python \
  /绝对路径/mcp-product-search/server.py

Usage Examples

After connecting to Claude, you can ask questions like:

帮我搜索苹果品牌的笔记本电脑
找一款评分 4.8 以上、价格不超过 300 美元的耳机
列出所有产品分类
查询产品 P003 的详细信息

Claude will automatically determine which tool to call and provide an answer based on the returned structured data.

Tool Parameter Description

Parameter

Type

Required

Default

Description

keyword

string

Yes

Matches product name, description, brand, category, and tags

category

string

No

Filter by category, e.g., "Laptops", "Headphones"

max_price

float

No

Maximum price (USD)

min_rating

float

No

Minimum rating (0–5)

limit

int

No

10

Maximum number of results (up to 50)

Results are sorted by rating (descending) and price (ascending).

Return Example:

{
  "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

No parameters. Returns all category names and their corresponding product counts.

get_product

Parameter

Type

Required

Description

product_id

string

Yes

Product ID, e.g., "P001" (case-insensitive)

Project Structure

mcp-product-search/
├── server.py        # MCP 服务器,定义工具
├── products.py      # 产品目录与搜索逻辑
├── pyproject.toml   # 项目依赖
└── README.md

Extending Product Data

The current product catalog consists of 12 sample items written in products.py. To replace it with real data, simply modify the search_products() function; server.py does not need to be changed.

Data Source

How to modify

Local JSON/CSV

Read the file and populate CATALOG at startup

SQLite / PostgreSQL

Replace the traversal logic with SQL queries

E-commerce API

Send HTTP requests inside the function

Elasticsearch

Call the ES full-text search interface

Available Tools

3 tools
get_productA

Retrieve full details for a single product by its ID (e.g. "P001").

Args: product_id: The product's unique identifier.

ParametersJSON Schema
NameRequiredDescriptionDefault
product_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

TDQS

A4.1/5.0
Disambiguation5/5

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.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (get_product, list_categories, search) using snake_case, making them predictable.

Tool Count5/5

With 3 tools, the server is well-scoped for a search-focused service. Each tool earns its place without bloat or deficiency.

Completeness4/5

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

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    11
    47
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables e-commerce operations such as product search, price updates, and order notes via MCP tools, with secure credential handling.
  • A
    license
    A
    quality
    D
    maintenance
    An 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.
    4
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables product comparison and analysis for any MCP-compatible AI assistant, with tools like compare_products and list_products.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hwqlet/mcp-product-search'

If you have feedback or need assistance with the MCP directory API, please join our Discord server