Moodle MCP Server
Provides read-only access to Moodle courses, assignments, deadlines, course structures, and files. It can list courses, inspect course modules and assignment details, list and download course files, and mirror an entire course to disk.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
moodle-mcp
MCP server and CLI for Moodle: read courses, assignments, deadlines and files from the terminal or straight from an AI agent — no browser automation, no scraping of interactive pages in the common case.
It talks to the official Moodle Web Services API (core_course_get_contents,
mod_assign_get_assignments, …), falls back to the session-cookie HTML flow when a site restricts
the mobile service, and works around two network problems that break naive clients.
$ node cli.mjs courses
12241 Big Data Warehousing and Technologies
11190 English for Information Technologies. Part 4
$ node cli.mjs cm 365961
Module 365961: Pig - Hive practical task
type: assign
course: 12241
due: —
max grade: 5Why this exists
Two things go wrong on the network this was written for, and both are handled automatically:
A full-tunnel VPN kills TLS, not TCP. The tunnel completes the TCP handshake and then silently drops the
ClientHello, so every request ends inETIMEDOUTeven thoughncsays the port is open. The client binds its sockets to the physical interface (en0/en1on macOS, overridable withMOODLE_LOCAL_ADDR) instead of the tunnel and the site answers in ~400 ms. Browsers are usually unaffected because their traffic is shaped differently — so "it works in my browser" does not mean a script can reach it.The server sends an incomplete certificate chain. Only the leaf is returned, signed by an intermediate that is not in Node's bundled root store (
UNABLE_TO_VERIFY_LEAF_SIGNATURE), while curl and browsers quietly fetch the missing link. The client reads the AIA "CA Issuers" URL from the leaf, downloads that intermediate, caches it in.secrets/tls-chain.pemand keeps validating against the real system roots — noNODE_TLS_REJECT_UNAUTHORIZED=0anywhere.
Both workarounds are no-ops on a normal network: binding falls back to a plain connection, and the chain is only fetched when Node actually complains about it.
Related MCP server: moodle-mcp
Requirements
Node.js 18 or newer
An account on a Moodle site with Web Services enabled (the standard
moodle_mobile_appservice — most universities have it for the mobile app) and, preferably, the Moodle mobile service enabled for your role.
Install
git clone https://github.com/d1zcipline/moodle-mcp.git
cd moodle-mcp
npm ci # or: npm installConfigure
Credentials live in .secrets/moodle.json (mode 600):
{
"username": "your-login",
"password": "your-password",
"baseUrl": "https://online.mospolytech.ru"
}The easy way:
bash setup-credentials.sh # prompts, hides the password, writes the filebaseUrl is optional; without it the client uses MOODLE_BASE_URL and falls back to the default
site. Environment variables:
Variable | Default | Meaning |
|
| Moodle site root, no trailing slash |
|
| Where |
|
| Where downloaded course material goes |
| auto ( | Source address to bypass a VPN tunnel |
| unset | Set to |
|
| Web Services shortname used for the token |
| unset | Set to |
CLI
node cli.mjs probe # is the site reachable at all, with and without the bind
node cli.mjs login # sign in, print name and available API functions
node cli.mjs courses # my courses
node cli.mjs tree <courseid> # course outline as markdown
node cli.mjs cm <cmid> # one module by id= from a Moodle URL
node cli.mjs assign <cmid> # assignment JSON incl. submission status
node cli.mjs files <courseid> # every downloadable file
node cli.mjs dump <courseid> # mirror the whole course into ./moodle-data/<courseid>dump writes structure.md, course.json, summary.json, every course file under files/, and
one folder per assignment with its description and attachments. Re-running it skips files whose
size already matches, so it is cheap to repeat. Flags: --json, --no-download, --out DIR.
MCP
The server speaks stdio and exposes eight read-only tools.
DeepSeek Harness (~/.dsh/profiles/desktop/cordis.patch.yml):
- insert:
- id: mcp-moodle
name: '@deepseek-ai/dsh-mcp-client'
config:
serverName: moodle
transport: stdio
command: node
args: [/absolute/path/to/moodle-mcp/mcp-server.mjs]
cwd: /absolute/path/to/moodle-mcp
failOnStartupError: falseClaude Desktop (claude_desktop_config.json) and most other clients:
{
"mcpServers": {
"moodle": {
"command": "node",
"args": ["/absolute/path/to/moodle-mcp/mcp-server.mjs"],
"env": { "MOODLE_BASE_URL": "https://online.mospolytech.ru" }
}
}
}Ready-to-copy files are in examples/.
Tools
Tool | Arguments | Returns |
| — | name, user id, site release, number of API functions |
| — |
|
|
| markdown outline with due dates and files |
|
| module name/type/course, assignment due date and description |
|
| description, dates, grade, attachments, submission status |
|
| file list with sizes and |
|
| saved path and size |
|
| mirror of the whole course on disk |
There are deliberately no submission or upload tools: an agent can read everything and change nothing in Moodle.
What it stores
moodle-data/<courseid>/
structure.md human-readable course outline
course.json raw sections/modules from the API
summary.json what was downloaded into this folder
files/<section>/<file> course files
assignments/<cmid>-<name>/
intro.md description, dates, grade, attachments
assignment.json raw assignment + submission status
files/<file> attachments.secrets/ holds the credentials, the Web Services token and the cached TLS intermediate — all of
it is git-ignored and never written into moodle-data/.
Troubleshooting
Symptom | Cause and fix |
| VPN tunnel drops TLS. |
| The AIA fetch failed (offline / blocked). Delete |
| Create |
| Moodle rejected the form or |
| The mobile Web Services service is disabled — ask the Moodle admin, or the client falls back to cookie mode. |
Tools return data but file downloads 403 | The |
Empty | The course may only contain pages, links and forums — check |
Run MOODLE_DEBUG=1 node cli.mjs probe for request-level detail.
How it works
File | Role |
| HTTPS client: source-address binding, AIA chain repair, cookies, redirects, retries |
| form login ( |
| REST wrappers ( |
| HTML→text, course outline rendering, mirroring to disk |
| command line on top of the same library |
| stdio MCP server, eight read-only tools |
The token is cached; when Moodle invalidates it the client re-authenticates once and retries the call, so a long-running MCP server survives password rotations and session timeouts.
Security
The password is only read from
.secrets/moodle.json(mode600) and is never logged, printed or written into course dumps.The Web Services token is stored next to it with the same permissions; delete the file to revoke local access, and revoke the token itself in Moodle → Preferences → Security → Keys.
The client never disables certificate verification and never follows links outside the configured Moodle host for authentication.
Downloads are plain HTTP GETs against
pluginfile.phpwith the token embedded by Moodle.
License
MIT — see LICENSE.
Not affiliated with Moodle Pty Ltd or any university. Use it on accounts you are allowed to use.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only access to Epivo's live course catalogue for AI agents.
Search university course materials, your flashcards, quizzes, streak and quota. All tools read-only.
PLATO (Pusan National University LMS) MCP server via Moodle Web Service API + ubboard scraping
Web search and page reading for AI agents, including JSON APIs, RSS feeds and YouTube.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables Claude to interact with Moodle via the official REST API for read-only tasks like listing courses, materials, assignments, submissions, and grades. Uses token-based authentication and emphasizes safe, no-write operations.2MIT
- AlicenseAqualityCmaintenanceEnables AI agents to access a student's EPFL Moodle data—deadlines, course files, assignments, forums, and grades—through read-only tools.12MIT
- AlicenseAqualityAmaintenanceEnables AI apps to read a student's Moodle courses, upcoming and overdue due dates, assignment submission statuses, course grades, gradebook items and announcements. It is strictly read only, so it can never submit, edit or delete anything.12910 npmMIT
- AlicenseAqualityBmaintenanceProvides read-only access to a university's Moodle virtual campus, letting an AI assistant browse courses, sections and files, check upcoming deadlines, view assignment status and grades, and read forum announcements and threads. Authentication uses a Moodle token stored locally, with support for both undergraduate and postgraduate campus URLs.8MIT