Skip to main content
Glama
zkak0
by zkak0

chilean-legal-mcp

Chilean legal research MCP server — 15 tools, verifiable official sources, no registration or credits. Better than Trifolia: local, unlimited, with body FTS, hybrid semantics and Word/PDF export.

What it does (15 tools)

Tool

Source

What it returns

buscar_normas

BCN SPARQL 748k + local FTS + body

Laws with filters fecha_desde/hasta DD-MM-AAAA, tipo, materia + citation

citar_norma / citar_json

BCN

Citation text and JSON {numero, fecha DD-MM-AAAA, titulo, url}

obtener_texto_norma

leychile.cl/Consulta/obtxml?opt=7 official cached XML

Full text 14k

exportar_norma

local

Word .docx (python-docx) / PDF .pdf (reportlab/weasyprint) in /tmp

buscar_semantico

Hybrid FTS + MiniLM embeddings + synonyms

acoso ≈ maltrato

buscar_dictamenes

CGR Domino + BCN + FTS

Rulings with URL

buscar_jurisprudencia

BCN + CGR + public PJUD

Case law + links

buscar_doctrina

BCN Article 30k + fallback

Articles

historial_norma

BCN hasVersion/modifiesTo

Validity and relationships

buscar_scielo / buscar_dt / buscar_diario_oficial

SciELO, DT, Diario Oficial

Doctrine and sectoral regulations

buscar_todo

Real parallel ThreadPoolExecutor(4)

Multi-source in 1 call

ayuda_acceso_abogado

6 official links

All responses include citation and link to the official source. Chilean dates DD-MM-AAAA in input and output.

Related MCP server: LeyChile MCP

Installation

git clone <repo>
cd chilean-legal-mcp
pip install -e .                    # base: httpx, mcp, python-docx, reportlab
pip install -e ".[semantic]"        # opcional: sentence-transformers para embeddings reales
pip install -e ".[pdf]"             # opcional: weasyprint (requiere libgobject)
python -m chilean_legal_mcp.ingest          # 545 normas iniciales
python -m chilean_legal_mcp.ingest --bulk   # 360k completo (~2h, 150MB)

Usage — any MCP client (stdio)

python -m chilean_legal_mcp.server          # stdio (default)
python -m chilean_legal_mcp.server --http   # HTTP streamable :8000

Claude Code: claude mcp add chilean-legal -- python -m chilean_legal_mcp.server Claude Desktop / OpenCode / Cursor / VS Code / Antigravity: mcpServers: {"chilean-legal": {"command":"python","args":["-m","chilean_legal_mcp.server"]}}

Structure

src/chilean_legal_mcp/
  sparql_client.py  # BCN SPARQL + filtros fecha/tipo
  db.py             # SQLite FTS5 (normas, textos, dictamenes) + check_same_thread=False
  texto.py          # LeyChile obtxml XML
  contraloria.py    # CGR Domino POST
  fuentes_externas.py # SciELO, DT, Diario Oficial
  exportar.py       # docx/pdf
  ingest.py         # incremental + bulk OFFSET
  server.py         # FastMCP 15 tools, paralelo real
data/
  normas.db (545)
  jpl/README.md     # reservado Ley 18.287

Sources (100% public, no registration)

  • BCN datos.bcn.cl/sparql (Virtuoso)

  • LeyChile leychile.cl/Consulta/obtxml?opt=7&idNorma=...

  • CGR contraloria.cl/appinf/... + BCN Oficio

  • PJUD pjud.cl/portal-unificado-sentencias (Playwright verified, without api.pjud.cl)

  • SciELO, DT, Diario Oficial — public search engines

License

MIT

Related MCP Connectors

Related MCP Servers