Moodle MCP Server
This MCP server lets an AI assistant act as a teacher on Moodle via the web services API, mainly to review assignments and grade submissions.
Identify the logged-in user and Moodle site/version, and check available API permissions.
List your courses and their assignments, including due dates, grading details, and submission types.
Review assignment participants and submission statuses, including what needs grading.
Open a participant’s full submission: attempt/status, online text, attached files, current grade, and feedback.
Download submission files or assignment attachments to local disk.
Save grades and feedback for a participant, with options for attempt number, workflow state, and group assignments.
From the full tool set: inspect course materials, feedback summaries, participant progress, compare submission attempts and course copies, preview/apply material edits, add submission comments, grant extensions, return submissions for rework, and revert submissions to draft.
Integrates with the Moodle web services REST API, enabling teachers to view courses, assignments, and student submissions, download submission files, and save grades with feedback after confirmation.
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 Server show me the submissions for my Moodle assignment"
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 Server
An MCP server for AI assistants (Claude Code, Cursor, Codex and other stdio clients) on top of the Moodle web services REST API. It is built for teachers: the assistant can see courses, assignments and student submissions, download submission files, and save a grade with feedback, acting as the teacher and only after the teacher confirms. Unlike student-oriented Moodle MCP servers, the focus here is reviewing assignments and grading.
The server works with any Moodle site that has the mobile web service
(moodle_mobile_app) enabled: the token is issued the same way as for the Moodle
mobile app, so login through an external OAuth provider with a captcha works too.
Prerequisites
Node.js ≥ 22.
Google Chrome or Chromium, for the
moodle-mcp-logincommand.Mobile app access enabled on the Moodle site (Site administration → Mobile app). To check:
<site>/admin/tool/mobile/launch.phpshould open rather than return an error.
Related MCP server: mcp-moodle
Quick start
The example below uses https://moodle.example.org; replace it with your Moodle
address exactly as it appears in the browser (scheme, host, path; a trailing
slash does not matter).
Log in, once per machine and again whenever a tool returns a login error (Moodle login and server token, in Russian):
MOODLE_URL=https://moodle.example.org npx -y -p @av-leschinskiy/moodle-mcp moodle-mcp-loginA Chrome window opens: log in to the site as usual and solve the captcha yourself. The command prints
Logged in as <name> on <site>and closes the window. Without-p, npx would start the server instead of the login command. Chrome is looked up in PATH; on macOS and Windows, set its path inMOODLE_CHROME.Add the server to your client. Claude Code:
claude mcp add moodle -e MOODLE_URL=https://moodle.example.org -- npx -y @av-leschinskiy/moodle-mcpAdd
-s userto enable it for all projects; without it, only for the current one.Codex, with a command or a block in
~/.codex/config.toml:codex mcp add moodle --env MOODLE_URL=https://moodle.example.org -- npx -y @av-leschinskiy/moodle-mcp[mcp_servers.moodle] command = "npx" args = ["-y", "@av-leschinskiy/moodle-mcp"] env = { MOODLE_URL = "https://moodle.example.org" }Cursor and other clients: a stdio server with the command
npx -y @av-leschinskiy/moodle-mcpand theMOODLE_URLvariable:{ "mcpServers": { "moodle": { "command": "npx", "args": ["-y", "@av-leschinskiy/moodle-mcp"], "env": { "MOODLE_URL": "https://moodle.example.org" } } } }Check: ask the assistant "show my Moodle courses".
From a repository clone, use node <clone>/dist/index.js and
node <clone>/dist/cli/login.js instead of npx: dist/ is committed, no build
is needed.
What's inside
24 tools in total; 6 of them require user confirmation.
Category | Tools | Confirmation | Covers |
Site | 3 | — | who I am, Moodle version, available functions, my courses |
Assignments and submissions | 5 | — | course assignments, participants and submission statuses, what needs the teacher across a course, full submission |
Course materials | 3 | — | ordered course outline, pages and feedback survey aggregates |
Submission history | 1 | — | compare two attempts, online text, previous feedback and attachments |
Course copies | 1 | — | compare material titles, dates and link targets across two courses |
Material editing | 2 | 1 | preview and apply changes through signed-in Chrome |
Participant progress | 1 | — | course gradebook and passing thresholds |
Files | 2 | — | downloading submission files to disk |
Grading | 6 | 5 | grade and feedback, submission comment, returning a submission for rework |
Site
moodle_list_coursesmoodle_search_participantsmoodle_site_info
Assignments and submissions
moodle_get_assignmentmoodle_get_submissionmoodle_list_assignmentsmoodle_list_pending_submissionsmoodle_list_submissions
Course materials
moodle_get_course_contentsmoodle_get_feedback_summarymoodle_get_page
Submission history
moodle_compare_submission_attempts
Course copies
moodle_compare_course_materials
Material editing
moodle_apply_material_edit— confirmationmoodle_preview_material_edit
Participant progress
moodle_get_participant_progress
Files
moodle_download_filemoodle_download_submission_files
Grading
moodle_add_submission_comment— confirmationmoodle_get_resubmission_windowmoodle_grant_extension— confirmationmoodle_return_submission_with_reason— confirmationmoodle_revert_submission_to_draft— confirmationmoodle_save_grade— confirmation
Moodle checks the token's service functions and your permissions for the selected course or activity. To edit course materials, open a dedicated Chrome profile with remote debugging on the local port from Configuration and sign in as the same Moodle user. Review the proposed title, HTML, files and upload hashes before confirming the edit. If the preview expires or the material changes, request a fresh preview. Student-visible writes are marked in the tool table above.
When grading, keep the gradingState returned by moodle_get_submission with the
work being reviewed. Pass that original value as expectedState to
moodle_save_grade after teacher approval. A conflict identifies which part
changed. Review the updated submission and obtain approval for the revised
decision. This check and the write are separate Moodle requests. The write
targets the specific attempt the teacher reviewed.
Responses are trimmed for the model context: HTML in descriptions and submissions
is converted to plain text, times to ISO, a grade that is not set to null, and
participant emails are never returned.
Configuration
Variable | Required | Default | Description |
| yes | — | Moodle site address (wwwroot), e.g. |
| — |
| Where |
| — | — | Web service token override (CI / smoke tests) |
| — |
| Timeout of a single API request (ms) |
| — |
| Loopback debugging port of the dedicated, signed-in Chrome for material editing |
| — | — | Chrome/Chromium binary for |
| — |
|
|
The token file has 0600 permissions and stores the site address it was issued
for: if it does not match MOODLE_URL, the server asks you to run
moodle-mcp-login. The server reads the file on every request, so there is no
need to restart the host after logging in again. The token is scrubbed from error
messages, logs and tool responses (including file URLs).
The Chrome profile used for login is kept separate from your main one
(~/.config/mcp-moodle/chrome-profile): site cookies persist, so logging in again
often works without a password.
Development
npm install # also enables the git hooks (.githooks)
npm run dev # tsx, no compilation
npm run build # native TypeScript 7 → dist/
npm run verify # typecheck + lint + tests + docs check
MOODLE_URL=… npm run smoke # read-only tool chain against a live MoodleBuild only with npm run build: devDependencies contain two compiler versions,
details. dist/ is committed; the pre-commit hook builds
and stages it, bumps the patch version and regenerates the tables above.
Architecture and rules are in AGENTS.md (in Russian).
Available Tools
7 toolsmoodle_download_fileA
Downloads a submission file (or an assignment attachment) to the local disk and returns its path. fileUrl is the url field from moodle_get_submission or moodle_list_assignments. An existing file is not overwritten: " (1)" is appended to the name.
Inputs: destDir (required), fileUrl (required).
moodle_get_submissionARead-onlyIdempotent
Full submission of one participant: status and attempt number, time, online text (as plain text), attached files (name, size, url for moodle_download_file), current grade and teacher feedback.
Inputs: userId (required), assignmentId (required).
moodle_list_assignmentsARead-onlyIdempotent
Assignments of a course (Assignment activity, mod_assign): assignment id (needed by the other tools), cmid (the number from the mod/assign/view.php?id=… URL), name, allow submissions from / due / cut-off dates, grading (points with maximum or scale, grade to pass), submission types and assignment description.
Inputs: courseId (required).
moodle_list_coursesARead-onlyIdempotent
My courses on the Moodle site (where I am enrolled, including as a teacher): id, short and full name, dates, visibility. The course id is needed for moodle_list_assignments.
Inputs: no named parameters.
moodle_list_submissionsARead-onlyIdempotent
Assignment participants and their submission state: status (new: not submitted, draft: draft, submitted: submitted, reopened: new attempt opened), submission time, whether it needs grading, current grade. The status filter narrows the list; counts summarizes all participants. moodle_get_submission returns one participant's full submission.
Inputs: assignmentId (required), status.
moodle_save_gradeADestructive
Saves a participant's grade for an assignment and writes feedback comments. THE STUDENT WILL SEE the grade and feedback (immediately, or after release if marking workflow is enabled) and may receive a notification. Call only after the teacher has explicitly confirmed the grade and the text. The grade is checked against the assignment maximum. If feedback is omitted, the existing feedback is kept unchanged.
Inputs: grade (required), userId (required), assignmentId (required), feedback, +5 more.
moodle_site_infoARead-onlyIdempotent
Who I am on the Moodle site and what the site is: user name and id, site name and Moodle version, version of this MCP server. missingFunctions lists API functions the token does not grant (tools that need them will fail). Start here if it is unclear whether the connection works.
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 7 tools
Each tool has a distinct purpose: site info, listing courses/assignments/submissions, retrieving one submission, downloading files, and saving grades. moodle_list_submissions vs moodle_get_submission is clearly separated as summary list vs full single participant. No overlapping or ambiguous tool roles.
All tools share the moodle_ prefix and snake_case, but moodle_site_info breaks the verb_noun pattern by using a noun phrase rather than an action. The rest follow list_/get_/download_/save_ consistently. Minor deviation only.
Seven tools is well within the ideal range and matches the focused scope of an assignment-grading MCP server. Each tool covers a necessary step and no tool feels redundant.
The surface covers the main teacher workflow: identify site/user, list courses, list assignments, inspect submissions, download files, and save grades/feedback. Minor gaps exist around broader Moodle operations (e.g., course content beyond assignments, bulk grade operations), but the core lifecycle is complete.
Maintenance
Related MCP Connectors
Manage your GatheredMind classes and assignments from your own AI assistant.
Create, edit, translate, and export SCORM eLearning modules from a connected AI assistant.
Read and write your own Microsoft To Do, Google Tasks or Todoist tasks from any AI agent.
Run live classroom quizzes, polls and anonymous Q&A from AI chat: LaTeX, closed-book exams, Moodle.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Moodle learning management systems through the Moodle REST API. Supports course management, user enrollment, assignments, forums, quizzes, and file operations through natural language.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Moodle via web services, allowing tasks like listing courses, assignments, events, and downloading files.1066 PyPI5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Moodle LMS via the Moodle REST API, supporting management of courses, users, enrollments, grades, and content.1GPL 3.0
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to query and manage Moodle LMS data, including assignment deadlines, unread messages, unfinished quizzes, and enrolled courses, using natural language via OpenAI or local LLMs.-