Skip to main content
Glama
README.md
# june-calendar-mcp

MCP de Google Calendar **single-user** (`primary`) sobre **Streamable HTTP** con autenticación por
**Service Account** (JWT, sin caducidad OAuth). Pensado para un asistente personal.

## Tools
`create_event` · `move_event` · `update_event` · `delete_event` · `list_events` · `get_freebusy`
· `find_free_slots` · `create_focus_block` · `get_agenda_today` · `get_next_event`.

- Las fechas entran como **ISO-8601** (el cliente/LLM las resuelve; el MCP no interpreta lenguaje natural).
- Los solapamientos se **bloquean** salvo `allow_overlap: true` (devuelve `EVENT_CONFLICT`).
- Idempotencia opcional con `client_request_id`.

## Requisitos
1. Una **Service Account** de Google con la **Calendar API** habilitada; descarga su key JSON.
2. **Comparte** el calendario `primary` con el `client_email` de la SA (permiso *"hacer cambios en eventos"*).

## Variables de entorno
Ver [`.env.example`](./.env.example). Clave: `MCP_AUTH_TOKEN` (Bearer del endpoint),
`GOOGLE_APPLICATION_CREDENTIALS_JSON` (JSON de la SA, inline), `CALENDAR_ID`, `TIMEZONE`,
`ACTIVE_HOURS_WEEKDAY`, `ACTIVE_HOURS_WEEKEND`, `FOCUS_COLOR_ID`.

## Correr
```bash
npm install
PORT=8080 MCP_AUTH_TOKEN=... GOOGLE_APPLICATION_CREDENTIALS_JSON='{...}' node src/server.js
curl localhost:8080/health
node test/smoke.mjs     # lista tools por Streamable HTTP
```

## Docker
```bash
docker build -t june-calendar-mcp .
docker run -p 8080:8080 --env-file .env june-calendar-mcp
```

El endpoint MCP queda en `POST /mcp` (requiere `Authorization: Bearer <MCP_AUTH_TOKEN>`); `GET /health` es abierto.