--- name: init-jupyter description: Inicializa o inicia Jupyter Lab via MCP. Detecta notebooks existentes automáticamente. argument-hint: [ruta-proyecto] disable-model-invocation: true user-invocable: true allowed-tools: Bash, Read, Write, Edit, Glob --- # Inicializar/Iniciar Proyecto Jupyter via MCP Este skill gestiona entornos Jupyter Lab integrados con Claude via MCP. Detecta automáticamente si ya existe un proyecto configurado. ## Flujo de decisión ### 1. Detectar notebooks existentes Buscar archivos `.ipynb` en: - Raíz del proyecto - Carpeta `notebooks/` - Cualquier subcarpeta ```bash find [ruta] -name "*.ipynb" -type f 2>/dev/null | head -5 ``` ### 2. Si HAY notebooks existentes → Iniciar directamente **2a. Verificar que MCP está configurado** - Comprobar si existe `.claude/settings.local.json` con configuración de jupyter - Si no existe, crearlo (ver paso 6 del flujo de inicialización) **2b. Verificar que jupyter-mcp-server está instalado** ```bash which jupyter-mcp-server || uv tool install jupyter-mcp-server ``` **2c. Iniciar Jupyter via MCP** ```bash source .venv/bin/activate 2>/dev/null || true jupyter lab --no-browser --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.disable_check_xsrf=True ``` **2d. Informar al usuario** que Jupyter está corriendo y puede usar las herramientas MCP de Jupyter desde Claude. ### 3. Si NO hay notebooks → Inicializar proyecto completo Seguir estos pasos: **3a. Validar ubicación** - Si se proporciona `$1`, usar esa ruta - Si no, usar el directorio actual **3b. Inicializar proyecto con uv** (si no existe pyproject.toml) ```bash cd [ruta] && uv init ``` **3c. Crear entorno virtual** ```bash uv venv ``` **3d. Instalar dependencias** ```bash uv add jupyter jupyter-collaboration ``` **3e. Instalar jupyter-mcp-server** ```bash uv tool install jupyter-mcp-server ``` **3f. Configurar MCP para Claude** Crear o actualizar `.claude/settings.local.json`: ```json { "mcpServers": { "jupyter": { "command": "jupyter-mcp-server", "args": [] } } } ``` **3g. Crear carpeta notebooks** (opcional) ```bash mkdir -p notebooks ``` **3h. Iniciar Jupyter via MCP** ```bash source .venv/bin/activate jupyter lab --no-browser --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.disable_check_xsrf=True ``` ## Ejemplos de uso **Iniciar/inicializar en directorio actual:** ```bash /init-jupyter ``` **Iniciar/inicializar en ruta específica:** ```bash /init-jupyter ~/proyectos/mi-analisis ``` ## Notas importantes - **Siempre usa MCP**: Jupyter se ejecuta siempre de forma que Claude pueda interactuar via MCP - Si detecta notebooks existentes, NO reinicializa el proyecto, solo inicia Jupyter - Si el proyecto ya tiene `pyproject.toml`, no ejecuta `uv init` - La configuración MCP se guarda en `.claude/settings.local.json` del proyecto - El servidor MCP permite a Claude crear, editar y ejecutar celdas de notebooks