Skip to main content

MCP server exposing Moodle Web Services to AI assistants (Claude, Cursor, etc.)

Project description

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 user
  • list_my_courses — courses you're enrolled in
  • get_course_contents — sections, modules, file URLs
  • search_courses — search the public catalog
  • list_assignments — assignments across one or all courses
  • upcoming_events — calendar deadlines and sessions
  • get_user_grades — your grades for a course
  • download_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

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.

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 .env out of version control (the included .gitignore already does this).
  • The server reads MOODLE_TOKEN from the environment and never logs it.
  • download_file appends the token to the URL; that URL is not logged either, but be mindful if your client echoes tool arguments.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_moodle-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_moodle-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_moodle-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_moodle-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_moodle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9a3dadd750a35a7b502a1a781adbef9b7c7b23561fa9b44ee2f26d48317a0c6
MD5 afbe79852837e43c8844b2837206c12f
BLAKE2b-256 a0e5213d75d0b50a2f5d3ab838a81966b442c9a4ea616761e3ba7f9fef33c5d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_moodle-0.1.0.tar.gz:

Publisher: release.yml on Snaw80/moodle-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_moodle-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_moodle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_moodle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 719dee679d1b90c2d5be6f862a6a021b7b9ecb871c3cac8851de8a9260a01edd
MD5 3774464a0a6685d1b8d162501ff76d3a
BLAKE2b-256 7ceba7e55080e16d1a52f9bef16009baf7c34e63b5de08b0498bba746a859fbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_moodle-0.1.0-py3-none-any.whl:

Publisher: release.yml on Snaw80/moodle-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page