Skip to main content
Glama
eneidyscastellano

smart-retail-mcp

README.md
# 🤖 Smart Retail MCP Server

Servidor de herramientas basado en [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) que provee capacidades de análisis predictivo de inventario a agentes de IA.

## Herramientas Disponibles

| Herramienta | Descripción |
|-------------|-------------|
| `get_current_stock` | Obtiene el inventario actual de todos los productos junto con los tiempos de entrega del proveedor |
| `get_sales_velocity` | Calcula la velocidad promedio de ventas diarias por producto en los últimos N días |
| `create_ai_recommendation` | Crea alertas de reabastecimiento cuando el stock se agotará antes de la próxima entrega |

## Arquitectura

```
src/
├── index.ts   → Definición e implementación de herramientas MCP (stdio transport)
├── db.ts      → Pool de conexión a PostgreSQL
└── seed.ts    → Script para insertar datos de prueba
```

## Configuración

### Variables de entorno (.env)

```env
DATABASE_URL=postgresql://usuario:password@localhost:5432/smart_retail
```

## Scripts

```bash
npm start      # Ejecutar el servidor MCP
npm run dev    # Desarrollo con hot-reload (tsx watch)
npm run seed   # Insertar datos de prueba
npm run build  # Compilar TypeScript
```

## Dependencias

- `@modelcontextprotocol/sdk` — SDK oficial de MCP
- `pg` — Cliente PostgreSQL
- `dotenv` — Variables de entorno

## Comunicación

El servidor se comunica vía **stdio** (stdin/stdout). El frontend Next.js lo levanta como proceso hijo usando `StdioClientTransport` del SDK MCP. No expone puertos HTTP.

## Licencia

ISC

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct inventory concern: current stock and lead times, sales velocity, and creating restock alerts. There is no meaningful overlap, so an agent can select the correct tool without ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: get_current_stock, get_sales_velocity, create_ai_recommendation. The naming is predictable and clear.

Tool Count4/5

Three tools is at the low end, but each tool has a clear role in the inventory-alerting workflow. The count feels appropriate for a narrow purpose, though the broad server name could imply more coverage.

Completeness2/5

The set covers the input side well, but create_ai_recommendation is a create-only operation with no way to list, update, or delete existing recommendations. This leaves agents with a dead end for managing alert state.

Maintenance

ActivitySlowing
ResponsivenessNo issues