mcp-moodle
An MCP server that exposes Moodle Web Services to any MCP-compatible AI assistant — Claude Code, Claude Desktop, Cursor, Codex, and others.
Ask your assistant things like "what's due this week?", "list my courses", "download the slides from CS101 week 3" — without leaving the chat.
Features
site_info— verify the token and get the authenticated userlist_my_courses— courses you're enrolled inget_course_contents— sections, modules, file URLssearch_courses— search the public cataloglist_assignments— assignments across one or all courseslist_quizzes— quizzes/QCMs in one or all visible coursesget_quiz_qcm_content— rendered QCM questions, readable text, and imagesupcoming_events— calendar deadlines and sessionsget_user_grades— your grades for a coursedownload_file— save any Moodle file locally (token appended automatically)
Works with any Moodle 3.5+ instance that has Web Services enabled.
Install
The recommended way is uv — no virtualenv to manage:
# One-off run (no install)
uvx mcp-moodle
# Or persist as a tool
uv tool install mcp-moodle
Plain pip works too:
pip install mcp-moodle
Update
If you installed with uv tool install, upgrade to the latest published
version with:
uv tool upgrade mcp-moodle
If you run it one-off with uvx, force a fresh fetch with:
uvx --refresh mcp-moodle
For pip installs:
pip install -U mcp-moodle
Get a token
Moodle Web Services require a personal token. The package ships a helper that handles every common login flow — native accounts, SSO (Microsoft, Google, SAML, OAuth), or manual paste:
# Default: opens a Chromium window, you complete SSO, token is captured
uvx --from "mcp-moodle[token]" mcp-moodle-token https://moodle.example.org
# Native (non-SSO) account
uvx --from "mcp-moodle[token]" mcp-moodle-token https://moodle.example.org \
--method local --user jdoe
# Headless server fallback (paste the moodlemobile:// URL by hand)
uvx --from "mcp-moodle[token]" mcp-moodle-token https://moodle.example.org \
--method manual-mobile
The token is written to ./.env (chmod 600) as MOODLE_URL and MOODLE_TOKEN.
Pass --stdout to print it to stdout instead.
The
[token]extra pulls in Playwright. First run downloads Chromium (~150 MB, one-time). Skip the extra if you only ever use--method local,--method web, or--method manual-mobile.
Configure your MCP client
Claude Code
claude mcp add moodle \
--env MOODLE_URL=https://moodle.example.org \
--env MOODLE_TOKEN=your_token_here \
-- uvx mcp-moodle
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"moodle": {
"command": "uvx",
"args": ["mcp-moodle"],
"env": {
"MOODLE_URL": "https://moodle.example.org",
"MOODLE_TOKEN": "your_token_here"
}
}
}
}
Cursor / other clients
Any MCP client that supports stdio servers works the same way: command
uvx, args ["mcp-moodle"], env MOODLE_URL and MOODLE_TOKEN.
Verify it works
In your MCP client, ask: "call the moodle site_info tool". You should see your name, username, and the site URL.
Quiz / QCM content
Use list_quizzes to find quiz instance ids, then call get_quiz_qcm_content
with the quiz id. The tool reuses the latest unfinished attempt when one
exists. If no unfinished attempt exists, it returns
requires_attempt_creation: true instead of starting an attempt silently; ask
the user for permission, then call again with start_if_needed: true.
Each returned question keeps Moodle's raw html and also includes:
text— cleaned readable text with formula/image labels fromalt/titleimages— image metadata with the originalurland a token-freedownload_urlthat can be passed todownload_file
download_file automatically converts Moodle pluginfile.php URLs to the
token-aware webservice/pluginfile.php form before downloading.
Development
git clone git@github.com:Snaw80/moodle-mcp.git
cd moodle-mcp
uv sync --all-extras
uv run mcp-moodle
Security notes
- Your token is the equivalent of a password for Moodle Web Services — keep
.envout of version control (the included.gitignorealready does this). - The server reads
MOODLE_TOKENfrom the environment and never logs it. download_fileappends the token to the URL; that URL is not logged either, but be mindful if your client echoes tool arguments.
License
MIT — see LICENSE.
Metadata
Release files for mcp-moodle 0.1.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 | |
|---|---|---|---|---|
| mcp_moodle-0.1.2.tar.gz | 14.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_moodle-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.3 kB
Release files / mcp_moodle-0.1.2.tar.gz
| Download URL | mcp_moodle-0.1.2.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b220572afb0a5f32f6a2034b32cda2d7b3350603d76b6e15f8305ff884469c82
|
|
BLAKE2b-256 checksum How to use checksums |
046301181ac2f98a1745d36de771ec735327142872ebd34c245f50a14d85ba32
|
| 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 Jun 13, 2026.
Transparency logRelease files / mcp_moodle-0.1.2-py3-none-any.whl
| Download URL | mcp_moodle-0.1.2-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5fe512a7035a040c03ff5e7a3d67cfdc5adf0b9a851965f2cc63f8529d96fa3
|
|
BLAKE2b-256 checksum How to use checksums |
7a2727478ff241f299a91432d7f84fd4996cbc59367e1155dbc0b4407abccf04
|
| 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 Jun 13, 2026.
Transparency logSecurity for mcp-moodle 0.1.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 mcp_moodle-0.1.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 Jun 13, 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.