Enables loading datasets from Google Drive files and exporting analysis reports back to Drive folders with support for various file formats and permissions management
Allows direct loading and analysis of data from Google Sheets spreadsheets using spreadsheet IDs with configurable header options
Provides comprehensive data analysis capabilities including schema inference, missing data reports, statistical profiling, correlation analysis, outlier detection, and groupby operations on datasets
dataframe-analyst-mcp
Servidor MCP (Model Context Protocol) y CLI para análisis exploratorio de datos (CSV/XLS/XLSX/Google Sheets/Google Drive) y exporte de reportes (md/json/html) a disco local o Google Drive.
Implementado con FastMCP (autogenera los inputSchema
a partir de type hints / Pydantic).
Características (no triviales)
Carga de datos desde:
Local (
path
a CSV/XLS/XLSX).Google Drive (fileId).
Google Sheets (spreadsheetId + range/sheet opcional).
Herramientas MCP expuestas:
load_data
– carga dataset y deja una vista previa en sesión.infer_schema
– tipos por columna y metainformación básica.missing_report
– %/conteo de faltantes por columna.profile
– estadísticas descriptivas con percentiles configurables.correlation
– matriz de correlación (pearson/spearman/kendall).detect_outliers
– detección por IQR o Z-score.groupby
– agregaciones por clave(s) con métricas parametrizables.export_report
– exporta reporte md/json/html a local o Drive (carpeta).
CLI fallback incluida (útil para depuración/uso directo).
Requisitos
Python 3.10+ (recomendado 3.11).
pip
,setuptools
,wheel
actualizados.
Instalación
Nota:
xlrd==1.2.0
se requiere solo para .xls antiguos. Para .xlsx se usaopenpyxl
.
Credenciales Google (opcional)
Service Account (SA) – acceso de lectura a Drive/Sheets
Crea una Service Account en Google Cloud y habilita Drive API y Sheets API.
Descarga la clave JSON a
secrets/sa.json
(no subir a git).Exporta:
export GOOGLE_APPLICATION_CREDENTIALS="$PWD/secrets/sa.json"Comparte el Sheet y/o la carpeta de Drive con el correo de la SA.
OAuth Desktop (para subir a Mi unidad o cuando SA no tiene permisos)
Configura OAuth consent screen (External) y agrega tu correo como Test user.
Crea un OAuth Client ID tipo Desktop y guarda
secrets/client_secret.json
.(Opcional, para ruta explícita de token)
export GOOGLE_OAUTH_CLIENT_SECRETS="secrets/client_secret.json" export GOOGLE_OAUTH_TOKEN="secrets/token.json"
Uso como CLI
Ejecuta el modo consola:
Comandos de ejemplo:
Uso como MCP Server (STDIO)
Arranque directo:
Integración con clientes MCP (config ejemplo)
mcpServers.json
:
Smoke test (cliente Python mínimo)
Estructura del proyecto
Solución de problemas
No se encuentra el módulo: ejecuta
python -m pip install -e .
en la raíz del repo y verifica quesrc/
contengadataframe_analyst_mcp/
.Importa pero no conecta por STDIO: prueba
PYTHONPATH=src python -m dataframe_analyst_mcp.server --mcp
.403/404 en Drive/Sheets: comparte recursos con el correo de la Service Account o usa OAuth Desktop (ver arriba).
xlrd
: solo es compatiblexlrd==1.2.0
. Para.xlsx
usaopenpyxl
.Correlación con 0s: las columnas no numéricas se muestran como 0; limita a numéricas si lo deseas en tu reporte.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables analysis of datasets from CSV/Excel files, Google Sheets, and Google Drive with comprehensive data profiling tools including schema inference, missing value reports, correlation analysis, and outlier detection. Supports exporting analytical reports in multiple formats to local storage or Google Drive.