Skip to main content
Glama
hwqlet

MCP Product Search Server

by hwqlet

Servidor de búsqueda de productos MCP

Un servidor de búsqueda de productos basado en el Model Context Protocol (MCP), que permite a Claude buscar en el catálogo de productos mediante palabras clave y devolver datos estructurados.

Funcionalidades

Proporciona tres herramientas para que Claude las invoque:

Herramienta

Descripción

search

Busca productos por palabra clave, admite filtros por categoría, precio y calificación

list_categories

Lista todas las categorías de productos y sus cantidades

get_product

Consulta la información completa de un producto individual por ID

Related MCP server: MCP Merchant Scout

Inicio rápido

1. Clonar el proyecto

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

2. Crear un entorno virtual e instalar dependencias

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

Requiere Python 3.10 o superior. Puede verificarlo con python3 --version.

3. Probar en el navegador

mcp dev server.py

El navegador abrirá automáticamente el MCP Inspector. Si no se abre automáticamente, acceda manualmente a la dirección que aparece en la terminal (normalmente http://localhost:6274).

Pasos para conectar:

  1. Cambie el Command de la izquierda por la ruta absoluta al ejecutable de Python en su entorno virtual:

    • macOS/Linux: /ruta/absoluta/mcp-product-search/.venv/bin/python

    • Windows: C:\ruta\absoluta\mcp-product-search\.venv\Scripts\python.exe

  2. En Arguments escriba server.py

  3. Haga clic en Connect; si aparece Connected en la esquina inferior izquierda, la conexión fue exitosa

  4. Haga clic en la pestaña Tools en la parte superior, seleccione la herramienta, rellene los parámetros y haga clic en Run Tool

Diagrama de conexión exitosa de MCP Inspector

4. Integrar con Claude Desktop

Localice el archivo de configuración:

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

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

Añada el siguiente contenido (reemplazando con la ruta absoluta real):

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

Para ver la ruta absoluta del directorio actual:

# macOS / Linux
pwd

# Windows
cd

Después de guardar el archivo de configuración, cierre completamente y reinicie Claude Desktop.

5. Integrar con Claude Code (línea de comandos)

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

Ejemplo de uso

Una vez integrado con Claude, puede hacer preguntas como:

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

Claude determinará automáticamente qué herramienta invocar y proporcionará una respuesta basada en los datos estructurados devueltos.

Descripción de los parámetros de las herramientas

Parámetro

Tipo

Obligatorio

Valor predeterminado

Descripción

keyword

string

Sí

—

Coincide con el nombre del producto, descripción, marca, categoría y etiquetas

category

string

No

—

Filtrar por categoría, ej. "Laptops", "Headphones"

max_price

float

No

—

Precio máximo (USD)

min_rating

float

No

—

Calificación mínima (0–5)

limit

int

No

10

Límite de resultados devueltos (máximo 50)

Los resultados se ordenan por calificación de mayor a menor y por precio de menor a mayor.

Ejemplo de respuesta:

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

Sin parámetros. Devuelve todos los nombres de categorías y la cantidad de productos correspondiente.

get_product

Parámetro

Tipo

Obligatorio

Descripción

product_id

string

Sí

ID del producto, ej. "P001" (no distingue entre mayúsculas y minúsculas)

Estructura del proyecto

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

Ampliación de datos de productos

El catálogo de productos actual contiene 12 datos de ejemplo escritos en products.py. Para reemplazarlo con datos reales, solo necesita modificar la función search_products(); no es necesario cambiar server.py.

Fuente de datos

Método de modificación

JSON/CSV local

Leer el archivo al iniciar para rellenar CATALOG

SQLite / PostgreSQL

Reemplazar la lógica de iteración con consultas SQL

API de comercio electrónico

Realizar peticiones HTTP dentro de la función

Elasticsearch

Invocar la interfaz de búsqueda de texto completo de ES

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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedget_product
    • First observedlist_categories
    • First observedsearch

TDQS

A4.1/5.0

Scored across 3 tools

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
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    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.
    21 npm
    54
    MIT
  • 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
    D
    maintenance
    Enables product comparison and analysis for any MCP-compatible AI assistant, with tools like compare_products and list_products.
    -