moodle-cli
Terminal-first CLI for Moodle LMS that reuses an authenticated browser session.
Features
- No API token setup required
- Reuses
MoodleSessionfromokta-auth, your browser, orMOODLE_SESSION - Works with Moodle AJAX APIs and falls back to authenticated page scraping when needed
- Upcoming timeline items for student-facing deadlines and actions
- Terminal output plus
--jsonand--yaml
Requirements
- Python 3.10+
uv- One of:
okta-auth-cliconfigured for your Moodle site- An active Moodle browser session
- A
MOODLE_SESSIONenvironment variable
Install
# Recommended: uv tool
uv tool install moodle-cli
# Optional: automatic Okta login and session reuse
uv tool install okta-auth-cli
okta config
# Alternative: pipx
pipx install moodle-cli
Agent Skill
Install the agent skill with the shared skills CLI spec:
npx skills add https://github.com/bunizao/moodle-cli
If you already installed moodle, the CLI exposes the same thing as a thin alias:
moodle skills add
If npx is not available, the alias falls back to npm exec.
Install from source:
git clone https://github.com/bunizao/moodle-cli.git
cd moodle-cli
uv sync
Usage
moodle --help
moodle user
moodle alerts
moodle todo
moodle overview
moodle courses
moodle grades 34637
moodle activities 34637
moodle https://school.example.edu/course/view.php?id=34637
moodle https://school.example.edu/mod/forum/discuss.php?d=9001#p9101 --json
moodle skills
moodle skills add
moodle update
moodle update --check-only
You can also paste supported Moodle page URLs directly as the first argument. The CLI routes forum discussion, forum view, assignment, quiz, resource, link, page, folder, course, and grade report URLs to the shortest matching command.
To check without applying an upgrade:
moodle update --check-only
moodle update now tries to upgrade directly with uv tool upgrade moodle-cli and falls back to pipx upgrade moodle-cli when needed.
To upgrade manually after an update is available:
uv tool upgrade moodle-cli
# or
pipx upgrade moodle-cli
Configuration
On first run, if no base_url is configured, the CLI will prompt you and write it to config.yaml in the project directory or in ~/.config/moodle-cli/:
base_url: https://school.example.edu
Required format:
- Use a full root URL such as
https://school.example.edu - Do not include paths, query strings, or fragments
- Do not use URLs like
/login/index.phpor/my/ - The CLI validates the URL against Moodle's token endpoint and asks again if it does not look valid
You can also set MOODLE_BASE_URL instead of using the interactive prompt.
You can copy from config.example.yaml.
Environment overrides:
MOODLE_BASE_URLMOODLE_SESSION
Development
uv run python -m compileall moodle_cli
uv build
Metadata
Release files for moodle-cli 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moodle_cli-0.4.2.tar.gz | 104.5 kB | With provenance | Details for moodle_cli-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moodle_cli-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for moodle_cli-0.4.2-py3-none-any.whl |
Total release size: 151.8 kB
Release files / moodle_cli-0.4.2.tar.gz
| Download URL | moodle_cli-0.4.2.tar.gz |
|---|---|
| Size | 104.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a7efc23c1d13e01f22f841106399c4e97bd7cdd1b2122bbe1025b422a7020c3
|
|
BLAKE2b-256 checksum How to use checksums |
416dc2a632042a1e4b9877c1f736893ab4a4328d922a7fff42a0af806a7af5be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logRelease files / moodle_cli-0.4.2-py3-none-any.whl
| Download URL | moodle_cli-0.4.2-py3-none-any.whl |
|---|---|
| Size | 47.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc4165e91480fb6b726b51d395865573934fb2f6a7a1e2f7018a7a2fbbb5ff62
|
|
BLAKE2b-256 checksum How to use checksums |
c55b4999cc3d217e3a79048517db761281406501f4084f338b1de8581ce5c2cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logSecurity for moodle-cli 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for moodle_cli-0.4.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.