Skip to main content
Glama
README.md
# mcp-precios-ar

[![CI](https://github.com/isidoromendez/mcp-precios-ar/actions/workflows/ci.yml/badge.svg)](https://github.com/isidoromendez/mcp-precios-ar/actions/workflows/ci.yml)

An [MCP](https://modelcontextprotocol.io) server that gives AI assistants access to **Argentine supermarket prices**, from [Precios Claros](https://www.preciosclaros.gob.ar) (SEPA), the dataset that large chains must report every day to the Secretaría de Comercio.

Ask your assistant things like:

> *¿Dónde está más barata la yerba Playadito cerca de Plaza Mitre, en Mar del Plata?*
>
> *Tengo que comprar 2 leches descremadas, 1 kg de yerba y aceite de girasol. ¿En qué súper me sale menos?*

It runs locally with `npx`. There is no server to host and no API key.

## Tools

| Tool | What it does |
|---|---|
| `find_stores` | Supermarkets that report to Precios Claros near a location, closest first. |
| `search_products` | Searches products by name near a location, returning barcodes and price range. |
| `get_product_prices` | One product (by barcode) in every nearby store: cheapest, median, best promo, and whether each price was updated today. |
| `compare_basket` | Totals a shopping list in each nearby store, ranks them, and also gives the total if you buy each item where it is cheapest. |

Every tool takes a location (`lat`, `lng`) and a `radius_km` (default 10). Assistants usually know the coordinates of a city or neighborhood, or you can paste them from a map.

## Setup

Requires Node.js 20 or later.

**Claude Desktop**: add this to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "precios-ar": {
      "command": "npx",
      "args": ["-y", "mcp-precios-ar"]
    }
  }
}
```

**Claude Code**:

```sh
claude mcp add precios-ar -- npx -y mcp-precios-ar
```

Any other MCP client works the same way: the server speaks MCP over stdio.

## Important limitations

- **It only works from Argentina.** The Precios Claros service rejects requests from foreign IP addresses (the server reports this as an HTTP 403 with a clear message).
- **The service is not an official, documented API.** It is the backend of preciosclaros.gob.ar, and its responses can change without notice. The response shapes this server relies on are pinned by recorded responses in `test/fixtures`, so a change shows up as a failing test.
- **Coverage is what SEPA covers:** large chains that are required to report. Small stores and neighborhood shops are not included.
- Prices are **list prices** reported by each store. Promotions are shown separately, and `updatedToday: false` flags prices that may be stale.
- The free-text search endpoint (`/productos`) was not recorded yet; its test fixture follows the product object of the recorded product response.

## How it works

```
src/
  api.ts      HTTP client for Precios Claros (injectable fetch, timeout, clear errors)
  prices.ts   Pure functions: clean the raw data, compare prices, total a basket
  server.ts   MCP tool definitions (zod input schemas, read-only annotations)
  index.ts    stdio entry point
```

All the logic lives in pure functions that are tested against recorded API responses. The MCP layer is tested end to end with the SDK's in-memory transport and a fake `fetch`. CI also starts the built server and checks that it lists its tools over stdio.

The basket comparison is sequential on purpose (one request per product) to be gentle with a free public service.

## Development

```sh
npm install
npm test              # unit + MCP integration tests
npm run build
npm run inspect       # open the MCP Inspector against the built server
```

Set `PRECIOS_CLAROS_BASE_URL` to point the server at a different backend (for example, a local mock).

## Data and license

Price data: Precios Claros, Secretaría de Comercio de la Nación, published under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/). This project is not affiliated with the Argentine government.

Code: MIT.

TDQS

A4.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool maps to a distinct step in a clear workflow: discover stores, find a barcode, get prices for one barcode, then total a basket. Descriptions explicitly state the relationship between tools (e.g. search_products says to use it before requesting detailed prices), leaving no overlap.

Naming Consistency5/5

All four names follow a consistent snake_case verb_noun pattern: find_stores, search_products, get_product_prices, compare_basket. Verbs are distinct and predictable (find/search/get/compare) with matching resource nouns.

Tool Count5/5

Four tools are well-scoped for a focused price-comparison domain, and each covers a necessary stage of the workflow with no filler. The surface is lean without being trivial.

Completeness4/5

The surface covers the full core flow: store discovery, product lookup by name, per-barcode prices, and basket comparison. Minor gaps exist, such as no direct category/browse listing or barcode-to-product reverse lookup, but agents can work around these via search_products.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues