moodle-student-bridge 0.0.0-stage → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ ## 1.2.0 — 2026-11-20
4
+
5
+ Estudiar mejor. / Study tools.
6
+
7
+ - `revisar_intento`: revisión de cuestionarios **terminados** (respuesta marcada, puntaje y la
8
+ retroalimentación que el profesor permita; avisa qué oculta). Nunca abre ni modifica intentos.
9
+ - `ver_actividad`: páginas, libros (todos o un capítulo), carpetas, enlaces, etiquetas y archivos.
10
+ - `novedades`: cambios desde hace N horas, agrupados por curso, más notificaciones nuevas.
11
+ - `descargar_materiales`: baja los archivos de un curso o sección a
12
+ `Descargas/moodle-student-bridge/<curso>/<sección>/`, sin repetir; nombres saneados y límites de tamaño.
13
+ - `buscar`: en secciones, actividades, archivos y foros; con `en_archivos` también dentro de
14
+ PDF/Word/PowerPoint/Excel. Prioriza la frase exacta e ignora tildes.
15
+ - `leer_archivo` lee Excel (`.xlsx`).
16
+ - Seguridad: el token solo se envía a `pluginfile.php` del propio Moodle (nunca a enlaces externos).
17
+
18
+ ## 1.1.0 — 2026-11-20
19
+
20
+ Seguridad. / Security hardening.
21
+
22
+ - Las entregas rechazan archivos sensibles: carpetas ocultas (`.ssh`, `.config`, `.git`…), `.env`,
23
+ claves y certificados, credenciales, perfiles de navegador, `AppData` y los datos del propio MCP.
24
+ Se resuelven enlaces simbólicos y no se revela si un archivo protegido existe.
25
+ - Lista cerrada de funciones de Moodle por modo: en solo lectura ninguna función de escritura puede
26
+ enviarse, ni siquiera por error; nunca se llaman funciones `view_*`.
27
+ - El token se oculta en todas las salidas, errores y registros (también `wstoken=` y enlaces
28
+ `moodlemobile://`).
29
+ - Nueva herramienta `estado_conexion` (diagnóstico) y mensajes de error con instrucciones.
30
+ - `docs/ROADMAP.md` con las próximas fases.
31
+
32
+ ## 1.0.0 — 2026-11-20
33
+
34
+ Primera versión estable. / First stable release.
35
+
36
+ ### Lectura
37
+ - `resumen_semanal`, `proximos_vencimientos`, `listar_cursos`, `listar_tareas`, `ver_tarea`,
38
+ `cuestionarios`, `ver_curso`, `leer_archivo` (PDF, DOCX, PPTX, HTML, imágenes), `anuncios`,
39
+ `ver_discusion`, `notificaciones`, `mensajes`, `calificaciones`, `participantes`, `mis_grupos`,
40
+ `quien_soy`.
41
+ - `ver_tarea` muestra la disponibilidad real de la tarea (incluidas las que no aceptan entrega en
42
+ línea) y lee la entrega del grupo en tareas grupales.
43
+
44
+ ### Modo escritura (opcional, `MOODLE_ESCRITURA=1`)
45
+ - Entregar, editar (reemplazar/agregar) y borrar entregas; mensajes privados; publicar, editar y
46
+ borrar en foros.
47
+ - Confirmación en dos pasos con código de un solo uso (10 min) y revalidación antes de ejecutar.
48
+ - Comprobaciones: entrega en línea, apertura, corte, bloqueo, estado, calificada, tardía, grupal,
49
+ borradores, intentos, tiempo límite, declaración, cantidad/tamaño/tipo de archivos.
50
+ - Historial local de acciones sin el token.
51
+
52
+ ### Otros
53
+ - Asistente de token (`npx moodle-student-bridge-token`) para usuario/contraseña y SSO.
54
+ - Recordatorios push con ntfy (24 h y 3 h antes, notas nuevas, resumen diario) y workflow de
55
+ GitHub Actions con registros sin datos personales.
56
+ - Extensión `.mcpb` para Claude Desktop, construida en CI en cada versión.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MattSeb15
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.es.md ADDED
@@ -0,0 +1,198 @@
1
+ # Moodle Student Bridge
2
+
3
+ 🇬🇧 [Read in English](README.md)
4
+
5
+ **Conecta a Claude con tu Moodle como estudiante**: entregas, cuestionarios, enunciados, rúbricas,
6
+ archivos, anuncios, notificaciones y calificaciones. Y recordatorios en tu celular.
7
+
8
+ Está pensado para estudiantes cuya universidad **no les da un token de API**: usa el mismo token que
9
+ la **app móvil oficial de Moodle** (servicio `moodle_mobile_app`), que cualquier alumno puede obtener
10
+ con su propia cuenta. Funciona con cualquier Moodle que tenga la app móvil habilitada.
11
+
12
+ > Proyecto independiente; no está afiliado a Moodle Pty Ltd. **Por defecto solo lee.** El
13
+ > [modo escritura](#modo-escritura-opcional) (entregar, editar y borrar entregas, mensajes, foros)
14
+ > hay que activarlo a propósito y siempre pide confirmación.
15
+
16
+ ## Herramientas MCP
17
+
18
+ | Herramienta | Qué hace |
19
+ |---|---|
20
+ | `resumen_semanal` | Todo lo pendiente y lo nuevo en una sola llamada |
21
+ | `proximos_vencimientos` | Línea de tiempo: lo que vence en los próximos N días (y lo vencido) |
22
+ | `listar_cursos` | Cursos en los que estás matriculado |
23
+ | `listar_tareas` | Tareas por curso con fechas |
24
+ | `ver_tarea` | Enunciado, rúbricas, adjuntos, estado de tu entrega y retroalimentación |
25
+ | `cuestionarios` | Cuándo abren/cierran, tiempo límite, intentos usados y mejor nota |
26
+ | `ver_curso` | Secciones, recursos, archivos y enlaces de un curso |
27
+ | `leer_archivo` | Extrae el texto de PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx) y HTML; devuelve imágenes |
28
+ | `anuncios` / `ver_discusion` | Avisos de profesores y foros |
29
+ | `notificaciones` | La campana: notas publicadas, retroalimentación, cambios (no las marca como leídas) |
30
+ | `mensajes` | Conversaciones de mensajería |
31
+ | `calificaciones` | Tu libro de calificaciones por curso |
32
+ | `revisar_intento` | Revisa un intento **terminado** de un cuestionario: tus respuestas, puntaje y la retroalimentación que el profe permita |
33
+ | `ver_actividad` | Lee una actividad: páginas, libros (por capítulo), carpetas, enlaces, etiquetas y archivos |
34
+ | `novedades` | Qué cambió en las últimas N horas: materiales nuevos o actualizados, tareas, notas, foros |
35
+ | `descargar_materiales` | Descarga los archivos de un curso o sección a Descargas, sin repetir lo que ya tienes |
36
+ | `buscar` | Busca un tema en secciones, actividades, archivos y foros; opcionalmente dentro de los PDF y documentos |
37
+ | `participantes` | Profesores y compañeros del curso con rol y último acceso; filtra por tu grupo, nombre o rol |
38
+ | `mis_grupos` | Tus grupos en cada curso con sus integrantes (Moodle no muestra a estudiantes los integrantes de grupos ajenos) |
39
+ | `quien_soy` | Comprueba con qué cuenta estás conectado |
40
+ | `estado_conexion` | Diagnóstico: token, versión, modo y qué funciones admite tu Moodle |
41
+
42
+ Cursos y tareas se pueden indicar por id o por parte del nombre (`"fisica"`, `"segundo parcial"`).
43
+
44
+ 📖 **[Casos de uso con ejemplos](docs/CASOS_DE_USO.md)**: organizar la semana, entender rúbricas, estudiar con los PDFs del curso, revisar tu trabajo antes de entregar, grupos y más.
45
+
46
+ Ejemplos rápidos: *"¿Qué tengo pendiente esta semana?"*, *"Revisa la tarea del proyecto de Física y hazme
47
+ un plan según la rúbrica"*, *"Lee el PDF de Leyes de Kepler y resúmelo"*, *"¿Cómo voy en Física?"*, *"¿Con quién me tocó el grupo de Cálculo?"*.
48
+
49
+ ## 1. Obtener tu token
50
+
51
+ ```bash
52
+ npx moodle-student-bridge-token
53
+ ```
54
+
55
+ El asistente te pregunta cómo inicias sesión:
56
+
57
+ - **Usuario y contraseña de Moodle** → obtiene el token directamente.
58
+ - **Microsoft / Google / SSO** → te da un enlace `launch.php`. Ábrelo con tu sesión iniciada y las
59
+ DevTools abiertas (F12 → Network), copia la redirección `moodlemobile://token=...` y pégala.
60
+
61
+ Comprueba el token y lo guarda en `.env`:
62
+
63
+ ```
64
+ MOODLE_URL=https://moodle.tu-universidad.edu
65
+ MOODLE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
66
+ MOODLE_TZ=America/Guayaquil # opcional
67
+ ```
68
+
69
+ ## 2. Conectarlo a Claude
70
+
71
+ **Claude Desktop (lo más fácil):** descarga `moodle-student-bridge.mcpb` de la
72
+ [última versión](https://github.com/MattSeb15/moodle-student-bridge/releases/latest), ábrelo con
73
+ doble clic y pega tu URL y token en el formulario.
74
+
75
+ **Claude Code:**
76
+
77
+ ```bash
78
+ claude mcp add moodle-student --scope user \
79
+ -e MOODLE_URL=https://moodle.tu-universidad.edu -e MOODLE_TOKEN=tu_token \
80
+ -- npx -y moodle-student-bridge
81
+ ```
82
+
83
+ **Desde el código fuente:**
84
+
85
+ ```bash
86
+ git clone https://github.com/MattSeb15/moodle-student-bridge.git
87
+ cd moodle-student-bridge && npm install
88
+ npm run token # crea el .env
89
+ npm run probar # prueba: tu usuario y lo que vence esta semana
90
+ claude mcp add moodle-student --scope user -- node /ruta/a/moodle-student-bridge/src/index.js
91
+ ```
92
+
93
+ ## Modo escritura (opcional)
94
+
95
+ Con `MOODLE_ESCRITURA=1` (o la casilla *Enable write mode* en Claude Desktop) aparecen herramientas
96
+ para **modificar** tu Moodle:
97
+
98
+ | Herramienta | Qué prepara |
99
+ |---|---|
100
+ | `preparar_entrega` | Entregar o **editar** una tarea: archivos locales y/o texto en línea, modo `reemplazar` o `agregar` |
101
+ | `preparar_borrado_entrega` | **Eliminar** tu entrega |
102
+ | `preparar_mensaje` | Mensaje privado (`"yo"` = tus notas personales, un id de conversación o un nombre) |
103
+ | `preparar_publicacion_foro` | Responder en una discusión o abrir una nueva |
104
+ | `preparar_edicion_foro` / `preparar_borrado_foro` | Editar o borrar un mensaje tuyo |
105
+ | `confirmar` | Ejecuta lo preparado con su código |
106
+ | `historial_acciones` | Lo que se ejecutó desde tu equipo |
107
+
108
+ **Siempre en dos pasos:**
109
+
110
+ 1. `preparar_*` **solo lee y comprueba**, sin cambiar nada. Devuelve un resumen de lo que va a pasar
111
+ y un código de confirmación (6 caracteres, un solo uso, caduca en 10 min). Si algo lo impide, no
112
+ hay código.
113
+ 2. `confirmar` con ese código **vuelve a comprobar todo con datos frescos** y recién entonces ejecuta.
114
+ Si la situación cambió (p. ej. la tarea cerró), cancela sin enviar nada.
115
+
116
+ **Qué comprueba antes de una entrega:**
117
+
118
+ - Si la tarea **admite entrega en línea** (algunas están "abiertas" pero se entregan en clase).
119
+ - Si **ya abrió**, si pasó la **fecha límite de corte**, si el profesor la **bloqueó**, o si Moodle ya
120
+ **no permite editarla** (p. ej. enviada para calificar en tareas con borradores).
121
+ - **Estado actual** (sin entregar / borrador / enviada / reabierta) y si **ya fue calificada**.
122
+ - **Entrega tardía**: avisa si la fecha de entrega ya pasó.
123
+ - **Entrega grupal**: avisa que afecta a todo el grupo; bloquea si exige grupo y no tienes.
124
+ - **Borradores**: si al guardar queda enviada directamente o si después ya no podrás editar.
125
+ - **Intentos**: intento actual, máximo y cómo se reabre.
126
+ - **Tiempo límite**: avisa que se inicia el temporizador.
127
+ - **Declaración de entrega**: la muestra y exige aceptarla.
128
+ - **Archivos**: cantidad máxima, tamaño, tipos permitidos (incluye grupos como `archive` o
129
+ `document`), archivos vacíos o con nombre repetido, y qué archivos actuales se **eliminarán**.
130
+
131
+ El historial se guarda en `~/.moodle-student-bridge/historial.jsonl` (configurable con
132
+ `MOODLE_HISTORIAL`) y nunca incluye el token.
133
+
134
+ ## 3. Recordatorios en el celular (opcional)
135
+
136
+ Usa [ntfy](https://ntfy.sh): gratis y sin cuenta.
137
+
138
+ 1. Instala la app **ntfy** (Android/iOS) y suscríbete a un tema con un nombre **largo y difícil de
139
+ adivinar** (ej. `moodle-ana-8f3k2q9z`). Cualquiera que conozca el nombre puede leer los avisos.
140
+ 2. Elige dónde se ejecuta:
141
+ - **En la nube con GitHub Actions** (funciona con la PC apagada): haz un fork de este repo y
142
+ añade en *Settings → Secrets and variables → Actions* los secretos `MOODLE_URL`,
143
+ `MOODLE_TOKEN` y `NTFY_TOPIC`. Luego activa los workflows en la pestaña *Actions* (en los
144
+ forks vienen desactivados). `recordatorios.yml` corre cada hora y manda el resumen del día a
145
+ las 07:00 (hora de Ecuador; cámbialo en el `cron`). Los secretos van cifrados y los
146
+ registros solo muestran cuántos avisos se enviaron, nunca su contenido, así que el fork
147
+ puede ser público.
148
+ - **En tu PC**: programa `node src/recordar.js` cada hora y `node src/recordar.js --resumen` una
149
+ vez al día (Programador de tareas de Windows o `cron`).
150
+ 3. Prueba sin enviar nada: `npm run recordar -- --prueba`.
151
+
152
+ Qué recibes:
153
+
154
+ - ⏰ Un aviso **24 h** y otro **3 h** antes de cada entrega pendiente (`RECORDAR_HORAS=24,3`).
155
+ - 📝 Aviso cuando publican una **calificación o retroalimentación**.
156
+ - 📚 Un **resumen diario** con lo que vence en la semana.
157
+
158
+ Ya entregaste algo → deja de avisarte (Moodle ya no lo marca como pendiente).
159
+
160
+ Privacidad: los avisos (nombre de la tarea y curso) pasan por el servidor de ntfy. Si prefieres,
161
+ usa tu propio servidor con `NTFY_SERVER` y `NTFY_TOKEN`.
162
+
163
+ ## Variables de entorno
164
+
165
+ | Variable | Uso |
166
+ |---|---|
167
+ | `MOODLE_URL`, `MOODLE_TOKEN` | Obligatorias |
168
+ | `MOODLE_TZ` | Zona horaria para fechas (por defecto la del sistema) |
169
+ | `MOODLE_DESCARGAS` | Carpeta para archivos descargados (por defecto `~/Downloads/moodle-student-bridge`) |
170
+ | `NTFY_TOPIC`, `NTFY_SERVER`, `NTFY_TOKEN` | Recordatorios |
171
+ | `RECORDAR_HORAS`, `INTERVALO_MIN` | Cuándo avisar (por defecto `24,3` y `60`) |
172
+ | `MOODLE_ESCRITURA` | `1` para activar el modo escritura (por defecto desactivado) |
173
+ | `MOODLE_HISTORIAL` | Archivo del historial de acciones de escritura |
174
+
175
+ Las variables de entorno tienen prioridad sobre el `.env`.
176
+
177
+ ## Seguridad
178
+
179
+ - El token da acceso a tu cuenta casi como tu contraseña. **No subas el `.env`** (está en
180
+ `.gitignore` y `.mcpbignore`) ni lo pegues en chats.
181
+ - Para revocarlo: Moodle → Preferencias → **Claves de seguridad** → restablecer la del servicio móvil.
182
+ Si tu Moodle no muestra esa página, **cambia tu contraseña** dejando marcada la casilla "Cerrar
183
+ sesión en todas las aplicaciones web", o pide a soporte que revoquen tus tokens.
184
+ - `leer_archivo` solo descarga archivos del Moodle configurado.
185
+ - Las entregas rechazan archivos sensibles (carpetas ocultas, `.env`, claves, credenciales, perfiles
186
+ de navegador, datos de aplicaciones y del propio MCP), aunque un documento malicioso engañe a Claude.
187
+ - Lista cerrada de funciones de Moodle: en solo lectura no se puede enviar ninguna de escritura.
188
+ - El token se oculta en todas las salidas, errores y registros.
189
+
190
+ ## Desarrollo
191
+
192
+ ```bash
193
+ npm test # tests (sin red)
194
+ npm run probar -- ver_tarea '{"tarea":"proyecto"}' # llama una herramienta contra tu Moodle
195
+ npm run mcpb # genera moodle-student-bridge.mcpb para Claude Desktop
196
+ ```
197
+
198
+ ¿Quieres colaborar? Lee [CONTRIBUTING.md](CONTRIBUTING.md). Licencia MIT.
package/README.md CHANGED
@@ -1,3 +1,211 @@
1
- # Temporary Holding Version
1
+ # Moodle Student Bridge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 🇪🇸 [Leer en español](README.es.md)
4
+
5
+ [![CI](https://github.com/MattSeb15/moodle-student-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/MattSeb15/moodle-student-bridge/actions/workflows/ci.yml)
6
+ [![npm](https://img.shields.io/npm/v/moodle-student-bridge)](https://www.npmjs.com/package/moodle-student-bridge)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
+
9
+ **Connect Claude to your Moodle as a student**: deadlines, assignments, rubrics, quizzes, course
10
+ files, announcements, notifications, grades, classmates and groups. Optional reminders on your phone.
11
+
12
+ Built for students whose university **doesn't give them an API token**. It uses the same token as the
13
+ **official Moodle mobile app** (service `moodle_mobile_app`), which any student can get with their own
14
+ account. It works with any Moodle site that has the mobile app enabled.
15
+
16
+ > Independent project, not affiliated with Moodle Pty Ltd. **Read-only by default.**
17
+ > [Write mode](#write-mode-optional) (submit, edit and delete submissions; messages; forums) must
18
+ > be enabled on purpose and always asks for confirmation.
19
+
20
+ ## What you can ask
21
+
22
+ - *"What do I have due this week?"*
23
+ - *"Explain the physics project and turn the rubric into a checklist."*
24
+ - *"Read the Kepler's laws PDF from the course and summarize it."*
25
+ - *"Check my report against the rubric before I submit it."*
26
+ - *"How am I doing in Calculus? What do I need on the final?"*
27
+ - *"Who's in my group for the Calculus project?"*
28
+ - *"Submit `guide6.zip` to Guide 6."* (write mode: preview first, then confirm)
29
+
30
+ 📖 **[Use cases with examples](docs/CASOS_DE_USO.md)** (Spanish).
31
+
32
+ The tool names are in Spanish, but Claude understands requests in any language.
33
+
34
+ ## Tools
35
+
36
+ | Tool | What it does |
37
+ |---|---|
38
+ | `resumen_semanal` | Everything pending and new in one call |
39
+ | `proximos_vencimientos` | Timeline of upcoming (and overdue) deadlines |
40
+ | `listar_cursos` | Courses you're enrolled in |
41
+ | `listar_tareas` | Assignments per course with due dates |
42
+ | `ver_tarea` | Brief, rubrics, attachments, submission status, rules and feedback |
43
+ | `cuestionarios` | Quiz open/close dates, time limit, attempts used and best grade |
44
+ | `ver_curso` | Course sections, resources, files and links |
45
+ | `leer_archivo` | Extracts text from PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx) and HTML; returns images |
46
+ | `anuncios` / `ver_discusion` | Teacher announcements and forum discussions |
47
+ | `notificaciones` | The notification bell: new grades, feedback, changes (never marks them as read) |
48
+ | `mensajes` | Messaging conversations |
49
+ | `calificaciones` | Your gradebook for a course |
50
+ | `revisar_intento` | Review a finished quiz attempt: your answers, marks and the feedback the teacher allows |
51
+ | `ver_actividad` | Read an activity: pages, books (by chapter), folders, links, labels, files |
52
+ | `novedades` | What changed since N hours ago: new/updated materials, assignments, grades, forums |
53
+ | `descargar_materiales` | Download a course's (or section's) files to Downloads, skipping what you already have |
54
+ | `buscar` | Search a course's sections, activities, files and forums; optionally inside PDFs/Office files |
55
+ | `participantes` | Teachers and classmates with role and last access; filter by your group, name or role |
56
+ | `mis_grupos` | Your groups in each course and their members |
57
+ | `quien_soy` | Shows which account is connected |
58
+ | `estado_conexion` | Diagnostics: token, Moodle version, mode and which features your Moodle supports |
59
+
60
+ Courses and assignments can be referenced by id or by part of their name (`"physics"`, `"guide 6"`).
61
+
62
+ ## 1. Get your token
63
+
64
+ ```bash
65
+ npx moodle-student-bridge-token
66
+ ```
67
+
68
+ The assistant asks how you sign in to Moodle:
69
+
70
+ - **Moodle username and password**: it gets the token directly.
71
+ - **Microsoft / Google / SSO**: it gives you a `launch.php` link. Open it while signed in, with
72
+ DevTools open (F12 → Network), copy the `moodlemobile://token=...` redirect and paste it.
73
+
74
+ It checks the token and saves it to `.env`:
75
+
76
+ ```
77
+ MOODLE_URL=https://moodle.your-university.edu
78
+ MOODLE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
79
+ MOODLE_TZ=America/Guayaquil # optional
80
+ ```
81
+
82
+ ## 2. Connect it to Claude
83
+
84
+ **Claude Desktop (easiest):** download `moodle-student-bridge.mcpb` from the
85
+ [latest release](https://github.com/MattSeb15/moodle-student-bridge/releases/latest), double-click it
86
+ and paste your URL and token into the form.
87
+
88
+ **Claude Code:**
89
+
90
+ ```bash
91
+ claude mcp add moodle-student --scope user \
92
+ -e MOODLE_URL=https://moodle.your-university.edu -e MOODLE_TOKEN=your_token \
93
+ -- npx -y moodle-student-bridge
94
+ ```
95
+
96
+ **From source:**
97
+
98
+ ```bash
99
+ git clone https://github.com/MattSeb15/moodle-student-bridge.git
100
+ cd moodle-student-bridge && npm install
101
+ npm run token # creates .env
102
+ npm run probar # smoke test: your user and what's due this week
103
+ claude mcp add moodle-student --scope user -- node /path/to/moodle-student-bridge/src/index.js
104
+ ```
105
+
106
+ ## Write mode (optional)
107
+
108
+ Set `MOODLE_ESCRITURA=1` (or tick *Enable write mode* in Claude Desktop) to get tools that **change**
109
+ your Moodle:
110
+
111
+ | Tool | Prepares |
112
+ |---|---|
113
+ | `preparar_entrega` | Submit or **edit** an assignment: local files and/or online text, `reemplazar` (replace) or `agregar` (add) |
114
+ | `preparar_borrado_entrega` | **Delete** your submission |
115
+ | `preparar_mensaje` | Private message (`"yo"` = your personal notes, a conversation id or a name) |
116
+ | `preparar_publicacion_foro` | Reply to a discussion or start a new one |
117
+ | `preparar_edicion_foro` / `preparar_borrado_foro` | Edit or delete one of your forum posts |
118
+ | `confirmar` | Runs a prepared action using its code |
119
+ | `historial_acciones` | Log of what was executed from your machine |
120
+
121
+ **Always two steps:**
122
+
123
+ 1. `preparar_*` **only reads and checks**. It returns a summary of exactly what will happen and a
124
+ confirmation code (6 characters, single use, expires in 10 minutes). If something blocks the
125
+ action, no code is issued.
126
+ 2. `confirmar` **re-checks everything with fresh data** and only then executes. If anything changed
127
+ (for example, the assignment closed), it cancels without sending anything.
128
+
129
+ **Checks before a submission:**
130
+
131
+ - Whether the assignment **accepts online submissions** at all (some are "open" but handed in class).
132
+ - Whether it has **opened yet**, passed the **cut-off date**, was **locked** by the teacher, or Moodle
133
+ no longer **allows editing** (e.g. already submitted for grading with drafts enabled).
134
+ - **Current status** (not submitted / draft / submitted / reopened) and whether it's **already graded**.
135
+ - **Late submission** warning if the due date has passed.
136
+ - **Group submission**: warns that it affects the whole group; blocks if a group is required and you have none.
137
+ - **Drafts**: whether saving submits right away, and that you can't edit after submitting for grading.
138
+ - **Attempts**: current attempt, maximum and how attempts are reopened.
139
+ - **Time limit**: warns that confirming starts the timer.
140
+ - **Submission statement**: shows it and requires acceptance.
141
+ - **Files**: maximum count, size, allowed types (including groups like `archive` or `document`),
142
+ empty or duplicate files, and which current files will be **removed**.
143
+
144
+ The log is stored in `~/.moodle-student-bridge/historial.jsonl` (configurable with `MOODLE_HISTORIAL`)
145
+ and never contains the token.
146
+
147
+ ## 3. Phone reminders (optional)
148
+
149
+ Uses [ntfy](https://ntfy.sh): free, no account needed.
150
+
151
+ 1. Install the **ntfy** app (Android/iOS) and subscribe to a topic with a **long, hard-to-guess** name
152
+ (e.g. `moodle-ana-8f3k2q9z`). Anyone who knows the name can read the notifications.
153
+ 2. Choose where it runs:
154
+ - **In the cloud with GitHub Actions** (works with your PC off): fork this repo, add the secrets
155
+ `MOODLE_URL`, `MOODLE_TOKEN` and `NTFY_TOPIC` under *Settings → Secrets and variables → Actions*,
156
+ then enable workflows in the *Actions* tab (they're disabled on forks). `recordatorios.yml` runs
157
+ hourly and sends a daily summary at 07:00 Ecuador time (change the `cron`). Secrets are
158
+ encrypted and logs only show how many reminders were sent, never their content, so the fork can
159
+ be public.
160
+ - **On your PC**: schedule `node src/recordar.js` hourly and `node src/recordar.js --resumen` once
161
+ a day (Windows Task Scheduler or `cron`).
162
+ 3. Dry run without sending: `npm run recordar -- --prueba`.
163
+
164
+ You get:
165
+
166
+ - ⏰ A reminder **24 h** and another **3 h** before each pending deadline (`RECORDAR_HORAS=24,3`).
167
+ - 📝 A notification when a **grade or feedback** is published.
168
+ - 📚 A **daily summary** of the week's deadlines.
169
+
170
+ Once you submit something, it stops reminding you.
171
+
172
+ Privacy: reminder contents (assignment and course names) go through the ntfy server. You can use your
173
+ own server with `NTFY_SERVER` and `NTFY_TOKEN`.
174
+
175
+ ## Environment variables
176
+
177
+ | Variable | Purpose |
178
+ |---|---|
179
+ | `MOODLE_URL`, `MOODLE_TOKEN` | Required |
180
+ | `MOODLE_TZ` | Time zone for dates (defaults to the system's) |
181
+ | `MOODLE_DESCARGAS` | Download folder (default `~/Downloads/moodle-student-bridge`) |
182
+ | `MOODLE_ESCRITURA` | `1` to enable write mode (off by default) |
183
+ | `MOODLE_HISTORIAL` | Write-action log file |
184
+ | `NTFY_TOPIC`, `NTFY_SERVER`, `NTFY_TOKEN` | Reminders |
185
+ | `RECORDAR_HORAS`, `INTERVALO_MIN` | When to remind (default `24,3` and `60`) |
186
+
187
+ Environment variables take precedence over `.env`.
188
+
189
+ ## Security
190
+
191
+ - The token grants access to your account almost like your password. **Never commit `.env`** (it's in
192
+ `.gitignore` and `.mcpbignore`) and never paste the token in chats or issues.
193
+ - To revoke it: Moodle → Preferences → **Security keys** → reset the mobile service key. If your Moodle
194
+ doesn't show that page, **change your password** with "Log out of all web apps" checked, or ask
195
+ support to revoke your tokens.
196
+ - `leer_archivo` only downloads files from the configured Moodle site.
197
+ - Submissions refuse sensitive local files (hidden folders, `.env`, keys, credentials, browser
198
+ profiles, app data, the MCP's own files), even if Claude is tricked by a malicious document.
199
+ - A closed allowlist of Moodle functions: in read-only mode no write function can be sent at all.
200
+ - The token is scrubbed from every tool output, error and log.
201
+ - See [SECURITY.md](SECURITY.md).
202
+
203
+ ## Development
204
+
205
+ ```bash
206
+ npm test # tests (no network, mocked Moodle)
207
+ npm run probar -- ver_tarea '{"tarea":"project"}' # call one tool against your Moodle
208
+ npm run mcpb # build moodle-student-bridge.mcpb for Claude Desktop
209
+ ```
210
+
211
+ Contributions are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). MIT license.