Skip to main content
Glama
Basket Scout Pi MCP Server

Basket Scout Pi MCP Server

by cesarfong
README.md
# Basket Scout Pi

Servidor agnóstico (funciona igual en **Windows** y **Linux / Raspberry Pi 5 ARM64**) para analizar partidos de básquet juvenil/amateur:

- **MCP Server (`/mcp`)**: Recibe el link de YouTube + jugadores por analizar (`analyze_game`), reporta el progreso en vivo (`get_job_status`) y entrega el resumen verificado sin cargar videos ni imágenes en el chat (`get_game_summary`).
- **FastAPI Web Dashboard (`/games/{job_id}`)**: Interfaz web con reproductor HTML5 para ver cada clip MP4 anotado (títulos, flecha de seguimiento, aro en el piso), filtro multi-jugador y descarga directa para WhatsApp.

---

## 1. Configuración rápida (Windows y Linux / Raspberry Pi 5)

Copia `.env.example` a `.env` y coloca tu API key de Gemini:

```bash
cp .env.example .env
```

Edita `.env`:
```env
GEMINI_API_KEY=tu_api_key_aqui
GEMINI_SCAN_MODEL=gemini-2.5-flash
GEMINI_AUDIT_MODEL=gemini-2.5-pro
HOST=0.0.0.0
PORT=8080
PUBLIC_BASE_URL=http://localhost:8080
```
*(En tu Raspberry Pi 5 cambia `PUBLIC_BASE_URL=http://gateway-host.local:8080` o su IP local).*

---

## 2. Instalación y ejecución

### En Windows (PowerShell)
```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python -m app.main
```

### En Raspberry Pi 5 / Linux
```bash
sudo apt update && sudo apt install -y ffmpeg python3-venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m app.main
```

Abre en tu navegador: `http://localhost:8080` (o `http://gateway-host.local:8080`).

---

## 3. Conectar por MCP (Claude Desktop / Antigravity / Gateway)

El servidor expone MCP Streamable HTTP en:
`http://localhost:8080/mcp` (o `http://gateway-host.local:8080/mcp`).

Tools disponibles:
- `analyze_game`: Encola un partido (YouTube o MP4 local) y devuelve `job_id` + `dashboard_url`.
- `get_job_status`: Consulta el avance (`downloading`, `storyboards`, `auditing`, `rendering`, `completed`).
- `get_game_summary`: Devuelve el resumen completo (puntos, asistencias, jugadas, tips) + links a los MP4 en FastAPI.
- `list_games`: Lista todos los partidos procesados.

---

## 4. Pruebas automáticas

```bash
pytest -v
```

## Licencia

El código de Basket Scout Pi se distribuye bajo la [licencia MIT](LICENSE).
Esta licencia no otorga derechos sobre las grabaciones de los partidos.