Datyra MCP
Enables AI assistants to perform data analysis on local datasets through natural language, orchestrating Python, R, SQL, Spark, Jupyter, Power BI, and Tableau engines for statistics, machine learning, dashboard generation, and batch processing.
README
◈ Datyra MCP — Mediador de Contexto IA
Autor: Nakano-04 — Mercenary Company “Mercenario del rojo” · Software Engineer (Cybersecurity · AI · Systems · ERP) · Building security tools, AI systems, ERP modules & research · ✉️ nakano.04.2025@gmail.com · 🔗 https://github.com/Nakano-04
Orquestador inteligente + MCP Server real universal que entiende lenguaje natural y enruta automáticamente: Python · R · SQL · Spark · Jupyter · Power BI · Tableau — compatible con toda IA que hable MCP.
1. ¿Qué es?
Mediador CLI + HTML MOD + MCP Server que analiza cualquier archivo en Recursos/ sin código. Tú dices:
"analiza las ventas"
"genera dashboard con gráficos"
"predice moroso con machine learning"
"haz analisis estadistico correlacion"
Para humanos → CLI. Para IAs → MCP tools (Claude, Devin, Codex, opencode, Cursor, Windsurf, Copilot, Gemini, ChatGPT y cualquier otra con MCP — protocolo abierto).
2. MCP Server — 10 herramientas (universal)
mcp_server.py (FastMCP, stdio + http) expone ciclo 1-6 completo — universal para toda IA:
| Herramienta | Descripción | Ejemplo |
|---|---|---|
analyze_data |
Lenguaje natural → motor correcto | analiza ciberseguridad |
list_datasets |
Inventario Recursos/ |
— |
run_statistics |
Pearson/Spearman/Shapiro/IQR | correlacion monto vs score |
train_model |
RF regresión/clasificación + KMeans | predice moroso |
generate_dashboard |
4 PNGs MOD 180dpi + HTML | dashboard mineria |
batch_process |
Todos los CSVs batch | todos batch |
profile_data |
Preview + describe | finanzas_masivo.csv |
query_sql |
SQL sobre sqlite/duckdb | SELECT region, SUM(ingreso)... |
get_tool_status |
Motores disponibles | — |
author_info |
Info Nakano-04 / Mercenary Company | — |
Beneficios universales (cualquier IA con MCP):
- Devin: análisis directo, reportes en workflow, logs/métricas auto
- Claude: stats complejos, dashboards, Spark masivo
- Codex/opencode/Cursor/Windsurf/Copilot: sugerencias por patrones, autocompletado, genera código DS
- Gemini/ChatGPT/otras: mismo
mcp.json— protocolo estándar, no vendor lock-in
Configuración universal
Cualquier IA con MCP — Claude Desktop, opencode, Cursor, Windsurf, VS Code, Windsurf, Copilot, Gemini CLI, etc. (%APPDATA%\Claude\claude_desktop_config.json / mcp.json / .cursor/mcp.json):
{
"mcpServers": {
"datyra-mcp": {
"command": "py",
"args": ["C:/ruta/a/Mediador-Analisis-de-Datos/mcp_server.py"]
}
}
}
Ver mcp.json y .opencode.json.example incluidos.
py mcp_server.py # stdio (Claude/opencode)
py -m mcp dev mcp_server.py # inspector
Extra: profile_data + query_sql + get_tool_status como características plus.
3. Demo visual

CLI con Rich: tablas cyan/magenta, panels, spinner dots12.
Informe HTML MOD salida/informe_*.html: header gradiente #0a0e14→#1a1033, badges neon, galería base64.
Gráficos MOD visual_motor.py: histograma KDE, barras horizontales, heatmap anotado, serie temporal — 180dpi, seaborn, fondo #151a23, paleta neon.
4. Arquitectura
mediador_ia.py → mediador/nucleo.py → clasificar() → MOTOR_POR_CLAVE → motor.ejecutar() → informe.py → HTML+TXT
mcp_server.py → FastMCP 9 tools → nucleo/contexto (mismo core)
motores/: python_motor (1-6), r_motor, sql_motor, spark_motor, jupyter_motor, visual_motor MOD
contexto.py: rglob Recursos/, tipos, filas
herramientas.py: detección binarios
estilos.py: PALETA_MOD, CSS_MOD
Clasificación nucleo.py:22 por keywords + ORDEN_PRECEDENCIA: ml > big_data > sql > jupyter > visual > estadistica > r > python.
5. Instalación
5.1 Requisitos
Python 3.10+ + pip
5.2 Instalación base (CLI)
cd Mediador-Analisis-de-Datos
py -m venv .venv; .venv\Scripts\activate # Windows
# Linux/Mac: python3 -m venv .venv; source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-extra.txt # opcional: jupyter/pyspark
py mediador_ia.py -t; py mediador_ia.py -l
py mediador_ia.py "analiza las ventas" # test rapido
requirements.txt: pandas, openpyxl, matplotlib, seaborn, scipy, scikit-learn, rich, jinja2, mcp, anyio, httpx, uvicorn, starlette
5.3 Instalación con opencode (MCP)
npm install -g opencode-ai@latest
opencode --version # verificar 1.18.22+
Configurar MCP — crea opencode.json en tu proyecto o global ~/.config/opencode/opencode.jsonc:
{
"mcp": {
"datyra-mcp": {
"type": "local",
"command": ["py", "C:/ruta/a/Mediador-Analisis-de-Datos/mcp_server.py"],
"enabled": true
}
}
}
Ver .opencode.json.example y mcp.json incluidos. Luego:
opencode mcp list # debe salir ✓ datyra-mcp connected
Solo sesion: crea
opencode.jsonsolo enC:\ruta\proyecto\opencode.jsony borralo al terminar.
6. Uso
6.1 CLI directo
py mediador_ia.py "analiza las ventas"
py mediador_ia.py "genera dashboard de mineria con graficos"
py mediador_ia.py "predice moroso con machine learning en finanzas"
py mediador_ia.py "analisis estadistico correlacion"
py mediador_ia.py "analiza todos batch" # batch todos los CSVs
py mediador_ia.py # REPL: -l, -t, !cmd, salir
# flags: -l lista datasets, -t test motores, -o salida/, -v verbose
6.2 Con opencode (MCP vivo)
opencode # abre TUI
# dentro de opencode escribe:
"analiza finanzas_masivo 20k filas: limpia IQR/nulos, EDA skew+Pearson, RF150 moroso, dashboard 4 graficos"
# o headless:
opencode run "analiza ventas con dashboard 4 graficos"
Flujo MCP: opencode → datyra-mcp → nucleo.clasificar() → MOTOR_POR_CLAVE → visual_motor MOD → salida/informe_*.html
Luego abre salida/informe_*.html en Edge/Chrome (--app sin tabs) y salida/*.png 180dpi.
6.3 Herramientas MCP (desde cualquier IA)
analyze_data, list_datasets, run_statistics, train_model, generate_dashboard, batch_process, profile_data, query_sql, get_tool_status, author_info
7. Datasets masivos incluidos (test)
| Dataset | Filas | Archivo |
|---|---|---|
| Minería | 15k | Recursos/mineria_masivo.csv |
| Ciberseguridad | 20k | Recursos/ciberseguridad_masivo.csv |
| Finanzas | 20k | Recursos/finanzas_masivo.csv |
| Ventas | 25 | Recursos/ventas_ejemplo.csv |
Formatos soportados: csv/tsv/csv.gz, xlsx/xls, json, parquet, db/sqlite/duckdb, ipynb, pbix, twb/twbx, r/rds, sql, pkl. Prioridad csv>excel>parquet>json o match por nombre.
8. Motores
Python (1-6): duplicados, nulos %, IQR, skew, train_test_split, RF 150 MAE/RMSE/R2/CV, KMeans k=3/4/5, Pearson/Spearman/Shapiro.
Visual MOD: KDE, barras h, heatmap, serie temporal.
R: dplyr, summary, cor, shapiro, kmeans. SQL/Spark/Jupyter/PBI/Tableau: detectan binario o fallback.
9. Salida salida/
analisis_*.py, graficos_*.py, *.png (180dpi), informe_*.txt, informe_*.html (dark, base64)
10. Ciencia de Datos 1-6 (sin transversal)
| Etapa | Cubierto |
|---|---|
| 1 Definición | Clasificación automática |
| 2 Recopilación | Inventario multi-formato |
| 3 Limpieza | duplicados, nulos, IQR, datetime |
| 4 EDA | describe+skew+cor+4 gráficos MOD |
| 5 Modelado | RF+KMeans+Pearson/Spearman/Shapiro |
| 6 Evaluación | métricas, train/test, HTML |
Sin bloque transversal (gobernanza/ética) a petición.
11. Roadmap
- [x] CLI Rich + HTML MOD + 180dpi
- [x] Limpieza IQR + ML evaluado + KMeans + Shapiro
- [x] Batch + MCP Server 10 tools
- [x] Demo GIF 35s vivo opencode + docs
- [ ] Streamlit drag&drop
- [ ] ARIMA/Prophet
12. Autor
Nakano-04 — Mercenary Company “Mercenario del rojo” Software Engineer (Cybersecurity · AI · Systems · ERP) Building security tools, AI systems, ERP modules & research 📧 nakano.04.2025@gmail.com · 🔗 https://github.com/Nakano-04
13. Licencia
Apache 2.0 — ver LICENSE.
Hecho con pandas · seaborn · rich · jinja2 · mcp estilo MOD dark — Datyra MCP by Nakano-04.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.