Skip to main content
Glama
README.md
# watt-moodle-mcp

An open-source [MCP](https://modelcontextprotocol.io) server that lets an AI model, including a **local** model in LM Studio, do Moodle admin work **safely**. It grows one admin workflow per episode of the Watt Engineworks YouTube series.

**Episode 1:** turn an SIS export CSV into verified, hidden course shells, organized in term and department categories.

## Safety by design

- **Plan, then do, then verify.** Nothing is created until a validated plan exists. Every run can be previewed with the read-only `preview_term_shells`, and the result is verified by re-reading Moodle.
- **Hard allowlist.** The server can call only the Moodle functions listed in `moodle_client.py`. It has no delete function and no "call anything" tool.
- **The model never touches your data.** CSVs are read by the server from an inbox folder, not retyped by the model.
- **Audit log.** Every Moodle write is logged in `logs/audit.jsonl`. The token is never logged.

## IMPORTANT: put a human between the model and Moodle

A preview is not a gate. In testing, a small local model (Qwen 3.5 9B) previewed a plan, decided "no errors, I will now execute", and created 32 courses without asking. The server cannot stop that; only your client can.

So the server has exactly **one tool that writes to Moodle: `create_term_shells`**, and it has no `dry_run` flag. Preview is a separate read-only tool, `preview_term_shells`.

**In LM Studio, set `create_term_shells` to Ask and leave the other six tools on Allow.** (Right-hand Integrations panel, open `mcp/watt-moodle`, then Tools.) Now every approval prompt you ever see means "this will write to Moodle". Read the plan ID, then Proceed or Deny. Do not use "Allow all" with this server.

| Tool | Setting |
|---|---|
| `get_site_info`, `find_course`, `list_inbox`, `plan_term_shells`, `preview_term_shells`, `verify_term_shells` | Allow |
| `create_term_shells` | **Ask** |

## Install

Needs [uv](https://docs.astral.sh/uv/). Create your work folder (Windows example):