mef_subnational_efficiency_mcp

mef_subnational_efficiency_mcp

Provides 10 tools over the CKAN API to audit and analyze Peruvian public spending, including budget execution data for 2025 and digitized historical records from 1964.

Category
Visit Server

README

mef_subnational_efficiency_mcp

Sistema multi-agente local para auditar el gasto público del Perú usando Claude Code Skills, un servidor MCP local y PaddleOCR: analiza la ejecución presupuestal 2025 del MEF y digitaliza registros históricos de 1964.

Tarea HW_05 — Auditoría del Gasto Público vía Sistemas Multi-Agente, Claude Code Skills y MCP Local.


Arquitectura

Capa Tecnología Rol
Servidor MCP FastMCP (SDK oficial) + httpx 10 herramientas sobre la API CKAN del portal
Ingesta / datos DuckDB + pandas → Parquet Procesa sin saturar memoria (anti-flooding)
OCR histórico PaddleOCR + PyMuPDF Digitaliza 15+ páginas de 1964
Dashboard Streamlit + Plotly 4 pestañas (2025 + 1964)
Agentes 2 Claude Code Skills Executor (construye) + Evaluator (audita/pule)

Fuentes de datos

  • 2025: dataset “Presupuesto y Ejecución de Gasto – Devengado Mensual” del portal datosabiertos.gob.pe (CSV 2025-Gasto-Devengado-Mensual.csv, con MONTO_PIM, MONTO_DEVENGADO_ANUAL, departamento, pliego, etc.).
  • 1964: PDF de la Cuenta General de la República (1964) → data/raw_pdfs/cuenta_general_1964.pdf (descarga manual).
  • Geo: peru_departamental_simple.geojson (repo juaneladio/peru-geojson).

Métricas

  • Avance de ejecución = (Devengado / PIM) × 100
  • Saldo No Devengado = PIM − Devengado

Estructura del proyecto

mef_subnational_efficiency_mcp/
├── app.py                    # Dashboard Streamlit (4 tabs)
├── requirements.txt
├── .streamlit/config.toml
├── .claude/skills/           # Skills Executor y Evaluator (.json + SKILL.md)
├── src/
│   ├── mcp_server.py         # Servidor MCP + 10 herramientas
│   ├── data_pipeline.py      # Ingesta 2025 (DuckDB → Parquet)
│   ├── ocr_engine.py         # OCR de 1964 (PaddleOCR + PyMuPDF)
│   ├── analytical_engine.py  # Métricas (Avance, Saldo No Devengado)
│   └── utils.py              # Cliente CKAN + helpers
├── data/
│   ├── raw_pdfs/             # PDF crudo de 1964 (no versionado)
│   ├── snapshots/            # Muestras de esquema (5–10 filas)
│   └── processed/            # Salidas Parquet "microscópicas"
└── video/link.txt            # Enlace del video de presentación

Requisitos e instalación

⚠️ Usar Python 3.12 (PaddleOCR no soporta 3.14).

# Crear entorno virtual con Python 3.12
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1

# Instalar dependencias
pip install -r requirements.txt

Uso

# 1) Servidor MCP (transporte stdio, sin auth)
py -3.12 src/mcp_server.py

# 2) Dashboard
py -3.12 -m streamlit run app.py

Flujo de desarrollo (Git)

El proyecto se construye por componentes en branches feature/* y se integra a main mediante Pull Requests (nunca commits directos a main):

feature/mcp-server-core · feature/data-snapshot-pipeline · feature/historical-1964-paddle-ocr · feature/executor-dashboard-draft · feature/evaluator-qa-refinement


Notas de ejecución

  • Los Parquet procesados (data/processed/) ya están versionados, así que el dashboard funciona tras clonar sin reprocesar los GB de origen.
  • El CSV crudo del MEF (~2.66 GB) se descarga a una carpeta temporal del sistema (fuera del repo) cuando se ejecuta el pipeline.
  • PaddleOCR/CPU: el código fija FLAGS_use_mkldnn=0 automáticamente para evitar un fallo de oneDNN en PaddlePaddle 3.x (no requiere acción manual).
  • El reporte de auditoría del Evaluator está en docs/evaluator_report.md y se muestra en el Tab 4 del dashboard.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured