moodle-mcp
Connects to a Moodle account using the Moodle mobile web-service API to retrieve courses, deadlines, assignments, grades, announcements, notifications, and course files. It can also read and search course content, extract text from course files, view discussions, and save or finalize assignment submissions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@moodle-mcp What's due in the next two weeks? Include anything overdue."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
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-mcpThis 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 authmoodle 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 up3. Connect Claude
claude mcp add -s user moodle -- moodle-mcpStart 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 |
| Upcoming and overdue assignments and quizzes from your timeline |
| Your courses and their ids |
| Every section, activity, file and link in a course, with the section notes |
| Find activities, files and section text that mention a word |
| All assignments, sorted by due date, with submission status and grade |
| One assignment in full: instructions, attachments, time left, feedback |
| Open any page, file, folder, link, forum or quiz by its id |
| Text out of a PDF, Word, PowerPoint, Excel, HTML or plain-text file |
| Save a course file to |
| Grade items for one course, or totals for all of them |
| Latest posts in each course's Announcements forum |
| Every post in one forum thread |
| The bell-icon notifications: grades, feedback, reminders |
| Check the connection |
| List the raw API functions your token is allowed to call |
| Call any of those functions directly (the escape hatch) |
| 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 tokenSample 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=5012A 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" .-> clientEach 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 |
One | |
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. | |
The |
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 returnsAdd a method to
client.pythat calls it and keeps the useful fields.Add a
@mcp.toolfunction inserver.pywith a clear docstring.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 browserPrivacy 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 logoutdeletes 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_downloadsaves a file to your computer, whilemoodle_submit_assignmentandmoodle_callcan write to Moodle. The other fourteen only read.moodle_submit_assignmentsaves 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 |
| Press Reset on the Security keys page and run |
No Moodle mobile web service row on Security keys | Sign in to the Moodle phone app once, then refresh the page |
| Run |
Claude doesn't list the tools | Start a new session after adding the server. In Claude Desktop, use the full path to |
| Your school has switched that function off. |
A file says it can't extract text | Use |
Other schools
moodle auth --url https://moodle.yourschool.eduYour 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 toolsmoodle_announcementsBRead-only
Latest posts in each course's Announcements forum, newest first.
Inputs: course_ids, per_course.
moodle_assignmentARead-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_assignmentsBRead-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_callADestructive
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_contentsBRead-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_coursesARead-only
List enrolled courses with their ids. which: inprogress (default) | future | past | all.
Inputs: which.
moodle_deadlinesARead-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_discussionARead-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_textARead-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_functionsARead-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_gradesARead-only
Grade items for one course (grade, max, %, weight, feedback). Without course_id: course totals for all courses.
Inputs: course_id.
moodle_notificationsCRead-only
The bell-icon notifications: new grades, feedback, forum posts, due-date reminders.
Inputs: limit, unread_only.
moodle_readARead-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_searchBRead-only
Find activities, files and section text mentioning query across current courses (or the given ones).
Inputs: query (required), course_ids.
moodle_submit_assignmentADestructive
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_whoamiARead-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
Scored across 17 tools
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.
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.
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.
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
Related MCP Connectors
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
- platform7nDeprecatedtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides 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 npm18MIT
- AlicenseNot gradedqualityCmaintenanceConnects Claude to a student's Moodle account so it can retrieve courses, pending assignments, grades, notices, materials, forums, and submission status, and can publish forum posts or upload assignments after confirmation.MIT
- AlicenseBqualityBmaintenanceConnects 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.34ISC
- AlicenseNot gradedqualityBmaintenanceConnects 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.7MIT