Skip to main content
Glama

moodle-mcp connects Claude to your Moodle account. From the chat you can ask what's due, have Claude open a reading or pull the text out of lecture slides, or check a grade.

It's about 950 lines of Python running on your own laptop. It signs in with the personal token Moodle gives its phone app and calls the same web-service API the app uses, so Claude sees what you'd see in the app and nothing more. It doesn't scrape pages or ask for your password.

NOTE

It defaults tomoodle.trincoll.edu, but it works with any Moodle site that allows the Moodle mobile app. See Other schools.

Things to ask

What's due in the next two weeks? Include anything overdue.
Summarize this week's reading for my chemistry class.
What did my professors post in announcements this week?
Pull the text out of the latest lecture slides and quiz me on it.
What's my current grade in each class?
Find every file in my courses that mentions "midterm".

Related MCP server: moodle-mcp

Quick start

You need uv, a fast Python installer. Skip this if you already have it.

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

1. Install

uv tool install git+https://github.com/ralstonraphael/moodle-mcp

This installs two commands, moodle for you and moodle-mcp for Claude. If your shell then says command not found, run uv tool update-shell and open a new terminal.

2. Sign in

moodle auth

moodle auth explains where to find your token and then asks for it in a hidden prompt. In Moodle, click your avatar and go to Preferences > Security keys, press Reset on the Moodle mobile web service row, and copy the key it shows you. docs/getting-your-token.md has the full walkthrough and a second method for schools where that page is missing.

moodle whoami    # prints your name if it worked
moodle due       # what's coming up

3. Connect Claude

claude mcp add -s user moodle -- moodle-mcp

Start a new Claude Code session and ask "what's due this week?".

Open Settings > Developer > Edit Config and add the server:

{
  "mcpServers": {
    "moodle": {
      "command": "/Users/YOUR-NAME/.local/bin/moodle-mcp"
    }
  }
}

Put in the full path that which moodle-mcp prints (on Windows, where moodle-mcp, with each \ written as \\ in the JSON). Desktop apps don't always inherit your terminal's PATH, so a bare moodle-mcp may not be found. Quit and reopen Claude Desktop afterwards.

moodle-mcp is a standard stdio MCP server. Any client that can launch a local server can run it if you point it at the moodle-mcp command with no arguments.

Tools

Tool

What it does

moodle_deadlines

Upcoming and overdue assignments and quizzes from your timeline

moodle_courses

Your courses and their ids

moodle_course_contents

Every section, activity, file and link in a course, with the section notes

moodle_search

Find activities, files and section text that mention a word

moodle_assignments

All assignments, sorted by due date, with submission status and grade

moodle_assignment

One assignment in full: instructions, attachments, time left, feedback

moodle_read

Open any page, file, folder, link, forum or quiz by its id

moodle_file_text

Text out of a PDF, Word, PowerPoint, Excel, HTML or plain-text file

moodle_download

Save a course file to ~/Downloads/Moodle

moodle_grades

Grade items for one course, or totals for all of them

moodle_announcements

Latest posts in each course's Announcements forum

moodle_discussion

Every post in one forum thread

moodle_notifications

The bell-icon notifications: grades, feedback, reminders

moodle_whoami

Check the connection

moodle_functions

List the raw API functions your token is allowed to call

moodle_call

Call any of those functions directly (the escape hatch)

moodle_submit_assignment ⚠️

Save a submission. Stays a draft unless you say to finalise

The moodle command

The moodle command covers most of the same ground from a terminal, though submitting and forum threads are Claude-only. Put --json before any command for raw output.

moodle due [--days 14] [--back 14]    upcoming + overdue
moodle courses [inprogress|future|past|all]
moodle assignments [COURSE_ID]        with submission status and grade
moodle contents COURSE_ID             sections + activities
moodle read CMID                      open any activity by its id
moodle grades [COURSE_ID]
moodle file FILEURL                   print a file's text
moodle download FILEURL [--to DIR]
moodle news | notifications | search QUERY
moodle functions [FILTER]             what your token can call
moodle call WSFUNCTION '{"json": "params"}'
moodle logout                         delete the saved token

Sample output, with made-up courses:

$ moodle due --days 7
Thu Oct 22 2026 11:59 PM   CHEM 111             Lab 5 report
                           https://moodle.example.edu/mod/assign/view.php?id=4821
Fri Oct 23 2026 5:00 PM    ENGL 205             Essay draft 2
                           https://moodle.example.edu/mod/assign/view.php?id=4907
Sun Oct 25 2026 11:00 PM   MATH 131             Quiz 4
                           https://moodle.example.edu/mod/quiz/view.php?id=5012
TIP

A course id is the number incourse/view.php?id=…, and a cmid is the number in any mod/<type>/view.php?id=… link. Claude looks these up on its own, so you only need them for the CLI.

How it works

flowchart LR
    claude["Claude<br/>(Code, Desktop, …)"] -- "MCP over stdio" --> server["server.py<br/>17 tools"]
    you["You in a terminal"] --> cli["cli.py<br/>moodle command"]
    server --> client["client.py<br/>Moodle client"]
    cli --> client
    client -- "HTTPS + your token" --> moodle[("Your school's Moodle<br/>webservice/rest/server.php")]
    config["~/.config/moodle-mcp/config.json"] -. "token, mode 600" .-> client

Each request is a POST to Moodle's web-service API carrying your token and a function name, such as mod_assign_get_assignments.

File

Job

client.py

One call() that POSTs to Moodle's REST endpoint, plus helpers that cut each response down to the fields worth reading (a single calendar event comes back with about 50). It also turns HTML into text and pulls text out of PDF, DOCX, PPTX and XLSX files.

server.py

Wraps those helpers as MCP tools with FastMCP. Claude reads each tool's docstring to decide when to call it, so the docstrings do real work.

cli.py

The moodle command, built on the same client, for testing without Claude.

Make it your own

To add a tool, clone the repo and install it in editable mode so your commands run the code you're changing:

git clone https://github.com/ralstonraphael/moodle-mcp && cd moodle-mcp
uv tool install --force --editable .

moodle functions calendar                # 1. find an API function
moodle call core_calendar_get_calendar_upcoming_view '{}'   # 2. see what it returns
  1. Add a method to client.py that calls it and keeps the useful fields.

  2. Add a @mcp.tool function in server.py with a clear docstring.

  3. Restart your Claude session and try it.

docs/extending.md walks through that calendar example line by line and ends with a list of ideas to build next. In Claude Code, the repo's CLAUDE.md describes the layout, so you can open the folder and ask for something like "add a tool that lists my upcoming calendar events".

uv run pytest                                          # offline tests, no Moodle needed
uvx ruff check .                                       # lint
npx @modelcontextprotocol/inspector moodle-mcp         # click through the tools in a browser

Privacy and safety

  • Your token sits in ~/.config/moodle-mcp/config.json, readable only by your user account, and goes nowhere except your school's Moodle. moodle logout deletes it.

  • The token can do anything the Moodle app can do as you, so keep it out of chats, group messages and repos. If it leaks, press Reset on the Security keys page and the old one stops working.

  • Anything a tool returns becomes part of your conversation with Claude, the same as text you paste in yourself.

  • Three tools can change things. moodle_download saves a file to your computer, while moodle_submit_assignment and moodle_call can write to Moodle. The other fourteen only read.

  • moodle_submit_assignment saves a draft unless you tell it to finalise, and its instructions tell Claude to show you the exact content before sending it.

  • Check your course's AI policy before you use this on graded work.

Troubleshooting

Problem

Fix

invalidtoken, or "the token is missing or expired"

Press Reset on the Security keys page and run moodle auth again

No Moodle mobile web service row on Security keys

Sign in to the Moodle phone app once, then refresh the page

moodle: command not found

Run uv tool update-shell and open a new terminal

Claude doesn't list the tools

Start a new session after adding the server. In Claude Desktop, use the full path to moodle-mcp

accessexception on one tool

Your school has switched that function off. moodle functions shows what's allowed

A file says it can't extract text

Use moodle download and open the file instead

Other schools

moodle auth --url https://moodle.yourschool.edu

Your school's Moodle has to allow the mobile app, so if the Moodle phone app signs you in, this will work too. Setting the MOODLE_URL and MOODLE_TOKEN environment variables works in place of moodle auth.

License

MIT. Not affiliated with Moodle Pty Ltd or any school.

Available Tools

17 tools
moodle_announcementsB
Read-only

Latest posts in each course's Announcements forum, newest first.

Inputs: course_ids, per_course.

moodle_assignmentA
Read-only

One assignment in full: instructions, attachment files, dates, time remaining, accepted submission types, what's already submitted, grade and feedback. Pass assign_id or cmid.

Inputs: cmid, assign_id.

moodle_assignmentsB
Read-only

All assignments in current courses (or the given ones), sorted by due date, with submission status (new/draft/submitted/nosubmission) and grade when include_status is true.

Inputs: only_open, course_ids, include_status.

moodle_callA
Destructive

Escape hatch: call any Moodle web-service function the token allows, e.g. wsfunction='mod_quiz_get_quizzes_by_courses', params={'courseids': [123]}. Nested params are fine. Treat any function that writes (save/submit/update/delete/send) like a submission: confirm first.

Inputs: wsfunction (required), params.

moodle_course_contentsB
Read-only

Every section of a course with its activities/resources (cmid, type, name, dates, files, links) and the section text (where teachers often put weekly readings and 'for next class' notes).

Inputs: course_id (required), include_descriptions.

moodle_coursesA
Read-only

List enrolled courses with their ids. which: inprogress (default) | future | past | all.

Inputs: which.

moodle_deadlinesA
Read-only

Unfinished assignment/quiz deadlines from the Moodle timeline. days_back > 0 also returns overdue items. Dates here can lag edits teachers make; confirm critical ones with moodle_assignment.

Inputs: course_id, days_back, days_ahead.

moodle_discussionA
Read-only

All posts in one forum discussion (ids come from moodle_announcements / moodle_read on a forum).

Inputs: discussion_id (required).

moodle_downloadB

Save a Moodle file to disk (default ~/Downloads/Moodle) and return the local path.

Inputs: fileurl (required), dest_dir.

moodle_file_textA
Read-only

Text of a Moodle file (PDF, DOCX, PPTX, XLSX strings, HTML, plain text) from a fileurl returned by another tool. Long files come back in slices: call again with offset to continue.

Inputs: fileurl (required), offset, max_chars.

moodle_functionsA
Read-only

Names of the Moodle web-service functions this token can call (filter with match, e.g. 'calendar'). Use it to find a function for moodle_call when no dedicated tool fits.

Inputs: match.

moodle_gradesA
Read-only

Grade items for one course (grade, max, %, weight, feedback). Without course_id: course totals for all courses.

Inputs: course_id.

moodle_notificationsC
Read-only

The bell-icon notifications: new grades, feedback, forum posts, due-date reminders.

Inputs: limit, unread_only.

moodle_readA
Read-only

Open any activity/resource by cmid and return its readable content: page text, file list for resources/folders, link target for URLs, assignment detail, forum discussions, quiz dates/attempts.

Inputs: cmid (required).

moodle_submit_assignmentA
Destructive

Save the user's submission for an assignment: online text (HTML) and/or local files. This REPLACES the current submission's text/files. Leaves it as a draft unless submit_for_grading=true, which finalises it (and accepts the submission statement). Only call after the user has approved the exact content.

Inputs: assign_id (required), text_html, file_paths, submit_for_grading.

moodle_whoamiA
Read-only

Check the connection: site name, Moodle version, and the logged-in user.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 17 tools

    Disambiguation3/5

    Most tools target distinct resources, but moodle_read is a broad catch-all that overlaps with moodle_assignment, moodle_course_contents, moodle_discussion, and moodle_file_text. The three deadline/assignment tools (moodle_assignment, moodle_assignments, moodle_deadlines) also share territory, though descriptions mostly disambiguate them.

    Naming Consistency4/5

    All tools share a clean moodle_ prefix and snake_case, which makes them easy to scan. There is a minor mix of noun phrases (moodle_courses, moodle_grades) and verbs (moodle_read, moodle_search, moodle_submit_assignment), but the pattern stays predictable.

    Tool Count4/5

    17 tools is slightly heavy but justified for an LMS surface spanning courses, assignments, grades, files, forums, and notifications. Each tool covers a meaningful slice of the domain rather than redundant trivia.

    Completeness4/5

    Read/lifecycle coverage is strong (courses, contents, assignments, grades, files, forums, announcements, notifications) plus submission. Write operations beyond submit are thin, but moodle_functions and moodle_call provide an escape hatch for any missing web-service function.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude with full access to Moodle learning management systems, enabling interaction with courses, files, assignments, grades, and calendar events. It also supports building Obsidian study vaults from course materials through automated knowledge graph creation.
      176 npm
      18
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Connects AI assistants to any Moodle site through the official mobile web service, with a limited browser-session fallback, enabling access to courses, grades, deadlines, assignments, quizzes, forums, and course files. It also supports reading and downloading files and uploading or submitting assignment work under explicit confirmation.
      34
      ISC
    • A
      license
      Not graded
      quality
      B
      maintenance
      Connects a student's own Moodle account to Claude Code, Codex, ChatGPT and other AI clients, exposing courses, deadlines, assignments, quizzes, grades, attendance, materials, forums and groups through 55 tools. Supports reading materials and submitting assignments, with per-user tokens and write actions kept as separate, confirmable tools.
      7
      MIT