Skip to main content
Glama
comprasal-mcp

comprasal-mcp

by glassbit

COMPRASAL MCP

Query El Salvador's public procurement data straight from your AI assistant.

This is a Model Context Protocol server that wraps the public COMPRASAL API (comprasal.gob.sv) — the country's electronic public-purchasing system — so you can ask Claude (or any MCP client) things like:

"What did the Ministry of Health award in 2025, and for how much?" "Show me the latest public contracts and their suppliers." "Pull the full detail and stage calendar for process 83743."

All data is public information published by the State under the LACAP procurement law. This server is read-only.


What you can ask

Once connected, your assistant gains these tools:

Tool

What it does

search_procurement

Search awarded processes by institution, year, modality, or free text. Returns supplier, amount, dates, code.

get_process_detail

Full detail of one process: amounts, dates, and the complete stage calendar.

get_award_report

Richest view: bidders, planned vs certified amounts, budget codes, signature date.

get_supplier_contracts

A supplier's public-sector track record: contracts won, by company name (bounded recent scan).

list_institutions

Resolve an institution name (e.g. "salud") into its id.

list_modalities / list_states / list_years

Catalogs for building precise filters.


Related MCP server: mcp-colombia-secop

Install

Requires Node.js 18+.

git clone https://github.com/glassbit/comprasal-mcp.git
cd comprasal-mcp
npm install
npm run build
npm test

Connect to Cursor

This repo ships a project-level MCP config at .cursor/mcp.json. After npm run build:

  1. Open this folder in Cursor.

  2. Go to Settings → MCP and enable the comprasal server (or restart Cursor).

  3. The assistant can call the COMPRASAL tools in Agent mode.

The config runs node dist/index.js against the live COMPRASAL API (cache off by default). To override globally, add the same block to your user MCP settings.

Connect to Claude Desktop

Add this to your claude_desktop_config.json:

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

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

{
  "mcpServers": {
    "comprasal": {
      "command": "node",
      "args": ["/absolute/path/to/comprasal-mcp/dist/index.js"]
    }
  }
}

Restart Claude Desktop. You'll see the COMPRASAL tools available. Ask it about El Salvador's public spending.


Local cache (opt-in)

By default every request goes to the live COMPRASAL API — a fresh clone behaves identically for everyone. You may opt in to a local, per-user response cache to speed up repeated queries within a session:

Variable

Default

Description

COMPRASAL_CACHE_ENABLED

false

Set to true to cache raw API responses on disk

COMPRASAL_CACHE_DIR

.comprasal-cache

Cache directory (gitignored, never committed)

COMPRASAL_CACHE_TTL_MS

3600000 (1 hour)

Entry lifetime; expired entries are deleted on read

The cache is not a shared or committed database — it is created at runtime on your machine only. After TTL expiry, the next request fetches live data again. Disable it anytime with COMPRASAL_CACHE_ENABLED=false.


Tests

npm test              # unit + mocked integration only (no network)
npm run test:live     # optional smoke test against real COMPRASAL API (~7s)

Tests cover client-side filters, Zod argument validation, file cache behaviour, and mocked HTTP flows.


Notes & caveats

The upstream government API only filters reliably by institution. This is the single most important thing to understand about this tool:

  • id_institucion is the only server-side filter that works. Year, free-text search, and date range are silently ignored by the COMPRASAL backend.

  • This server compensates by filtering client-side (over the real award date fecha_adjudicacion and text fields), scanning newest-first pages up to a bounded limit.

  • Consequence: deep historical queries are not practical. Asking for "all contracts from supplier X since January 2025" or "institution Y in 2024" can require scanning thousands of records at ~7s/page — so those tools return a bounded recent window and clearly say so in a coverage / filtering block. A bounded result is never presented as exhaustive.

  • Backend latency is ~7s per request (this is the government server, not the MCP). Tools make one request per page and cap how many pages they scan, so a call may take 10-50s.

  • get_supplier_contracts cannot filter by supplier upstream, so it scans the most-recent global records and matches locally. Pass id_institucion when you know it — the scan becomes far faster and deeper.

  • Date filters apply to the award date (fecha_adjudicacion) in this server, even though the raw upstream API filters on the process start date.

  • get_award_report uses a different id than the other endpoints (a known upstream quirk). Prefer get_process_detail unless you specifically need the bidder/budget breakdown.

  • The dataset holds ~100k+ awarded processes, current through 2026. Each process may appear as several rows (one per lot/supplier).

  • Tool arguments are validated with Zod before any upstream call; invalid inputs return a clear error without hitting the API.

Why no local database / committed cache?

This server queries the live public API so that anyone who clones it gets identical results with zero setup — no pre-scraped dataset, no shared state in the repo. A committed database would mean either hosting a central server (defeating the "run it yourself" model) or asking every user to scrape COMPRASAL first (hours of work).

An optional, opt-in file cache is available for convenience: it lives in .comprasal-cache/ on your machine only (gitignored), expires after 1 hour, and is off by default. It does not change what a fresh clone returns on first run. A full local-database variant for deep historical analysis remains a possible separate, opt-in project.

Data, source & legality

Data comes from the public COMPRASAL portal (comprasal.gob.sv), accessed through its public, unauthenticated REST API. Public procurement acts are public by law under the LACAP (Ley de Adquisiciones y Contrataciones de la Administración Pública). Public registries are excluded from the scope of El Salvador's Personal Data Protection Law (Decreto 144, 2024, art. 3). This project redistributes already-public information for transparency and research purposes and performs no scraping of authenticated areas.

License

MIT. Not affiliated with or endorsed by the Government of El Salvador.

Available Tools

8 tools
get_award_reportA

Get the richest award report for a process: contract name, contracting form, contractual term, planned vs certified amounts, signature date, budget codes (cifrados presupuestarios), and the list of bidders (oferentes). CAVEAT: this endpoint's id is NOT the proceso_compra.id used elsewhere; it lives in a different id space. Obtain the correct id from a process detail payload. If you pass the wrong id you will get a different contract. When unsure, prefer get_process_detail.

Inputs: id (required).

get_process_detailA

Get full detail of one procurement process by its proceso_compra id: code, internal code, publication/award dates, awarded amount, contracting form, follow-up state, and the full stage calendar (reception of offers, evaluation, etc.). The id comes from the 'proceso_compra.id' field of a search_procurement result.

Inputs: id_proceso_compra (required).

get_supplier_contractsA

Find the public contracts won by a specific SUPPLIER (company), by name, across institutions. Useful to build a supplier's public-sector track record ('what has company X been awarded?'). CRITICAL LIMITATION: the upstream government API cannot filter by supplier, and only sorts newest-first, so this performs a BOUNDED scan of the most-recent records — it does NOT return a supplier's full multi-year history. The response includes a 'coverage' block stating exactly what was scanned and warning when the result is bounded. Always relay that limitation to the user; never present a bounded scan as exhaustive. If you know which institution to look within, pass id_institucion to make the scan far faster and deeper. Each page is ~7s; raising max_pages increases coverage but also wait time.

Inputs: supplier (required), anio, max_pages, id_institucion.

list_institutionsA

List/search government institutions registered in COMPRASAL, to resolve a name into the numeric id_institucion used by search_procurement. Pass 'search' with a partial name (e.g. 'salud', 'hacienda').

Inputs: page, search, per_page.

list_modalitiesA

List contracting modalities (formas de contratación: Licitación competitiva, Libre Gestión, Contratación Directa, Comparación de precios, etc.) with their ids, to use as id_modalidad filters.

Inputs: no named parameters.

list_statesA

List procurement process states with their ids, to use as id_estado filters.

Inputs: no named parameters.

list_yearsA

List the fiscal years (ejercicios) available in COMPRASAL.

Inputs: no named parameters.

search_procurementA

Search awarded public procurement processes from El Salvador's COMPRASAL system. Returns matched awards, each with institution, supplier, awarded amount, dates, and process code. Use list_institutions first to turn an institution name into id_institucion. HOW FILTERING WORKS: the upstream government API only filters server-side by id_institucion. Year, free-text and date-range are applied CLIENT-SIDE by this server over the award date (fecha_adjudicacion) and text fields, by scanning newest-first pages. Because of that, prefer always passing id_institucion to keep the scan focused. The response includes a 'filtering' block: if window_fully_covered is false, increase 'page' to keep scanning older records. fecha_inicio/fecha_fin here DO filter on the actual award date. Each upstream record may represent one lot/supplier line of a larger process. One call scans a bounded number of pages (~7s each upstream), so it may take 10-40s.

Inputs: anio, page, search, per_page, +6 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools have distinct purposes, but get_award_report and get_process_detail could be confused since both provide process details. The caveat about different IDs and the distinct focus (richest award vs full detail) help clarify, but there is potential for misselection.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (get_, list_, search_), making the set predictable for an agent.

    Tool Count5/5

    8 tools is well-scoped for a procurement data retrieval system, covering search, detail views, supplier lookup, and listing of reference entities without unnecessary bloat.

    Completeness4/5

    The tool set covers the main read operations (search, detail, supplier contracts, reference lists). A minor gap is the lack of a straightforward 'list all processes' tool, but search can be used broadly. Overall, the surface is adequate for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables access to Chile's government procurement data (Mercado Público / ChileCompra) via MCP, allowing AI agents to query public procurement information.
      65 npm
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to query and analyze Costa Rica's public procurement (SICOP) data, including supplier profiles, market trends, product price histories, and bid comparisons, through a suite of MCP tools.
      -