Moodle MCP Server
Read-only access to a Moodle instance, exposing courses, assignments (with due dates, status, and submission URLs), calendar events, announcements, course materials, and participant lists through browser automation with persistent CAS-authenticated sessions.
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 Serverwhat assignments are due this week?"
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
๐ Overview
Moodle MCP Server empowers AI assistants (like Claude Code, Claude Desktop, Cursor, and custom MCP clients) to seamlessly query course syllabi, assignment deadlines, calendar events, lecture materials, announcements, and participants from IIIT Hyderabad's Moodle LMS.
Built with a hybrid HTTP-first engine, it delivers sub-50ms query latency via persisted session cookies while maintaining a resilient Playwright fallback for dynamic JavaScript rendering.
โโโโโโโโโโโโโโโโโโโ MCP (stdio / SSE) โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Claude Code โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ โ Moodle MCP Server โ
โ Claude Desktop โ โ (FastMCP Engine) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
โก Fast HTTP (httpx) ๐ญ Playwright Browser
โข Cached Cookie Transport โข Dynamic JS Fallback
โข Latency < 50ms โข Interactive CAS SSO
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
๐๏ธ IIIT Moodle Instance
(courses.iiit.ac.in)Related MCP server: dutic-mcp
โจ Key Features
โก Sub-50ms Latency (Hybrid Engine) โ Requests hit a fast async HTTP transport using authenticated cookie state, falling back to headless Chromium only for dynamic DOM rendering.
๐ Zero-Password Security โ Passwords and MFA tokens are never requested, stored, or logged. Authentication occurs via interactive CAS SSO in a visible browser window.
๐ก๏ธ MCP Safety Annotations โ Complies with the latest MCP specification, flagging all endpoints with
readOnlyHint=TrueanddestructiveHint=False.๐ง Native Claude Skill Included โ Comes with
.claude/skills/moodle.mdfor zero-configuration, natural conversational workflows in Claude Code.๐ Smart Date & Deadline Normalization โ Automatically normalizes Moodle deadlines into ISO-8601 strings while preserving human-readable relative dates (
Tomorrow, 11:59 PM).๐ Lightweight & Cross-Platform โ Runs effortlessly on Windows, macOS, Linux, and resource-constrained environments like Raspberry Pi 4B (ARM64).
๐ Multi-Transport Support โ Native support for both
stdio(CLI / Claude Desktop) andSSE(Network / Remote MCP clients).
๐ ๏ธ MCP Tools Reference
The server exposes 9 specialized read-only tools designed for structured LLM querying:
Tool | Parameters | Returns | Description |
| None |
| Returns uptime, system health, and current authentication status. |
| None |
| Verifies CAS authentication state without revealing sensitive tokens. |
| None |
| Fetches all active and enrolled courses with their names, IDs, and URLs. |
|
|
| Retrieves pending & submitted assignments with deadlines and submission links. |
|
|
| Fetches upcoming events, submissions, and course milestones from the calendar. |
|
|
| Retrieves full course structure, sections, syllabus, and resource lists. |
|
|
| Extracts organized lectures, PDFs, folders, and external links by topic section. |
|
|
| Fetches recent announcements and discussion posts with previews & authors. |
|
|
| Lists enrolled students, teaching assistants, and professors for a course. |
class Course(BaseModel):
id: str
name: str
url: str
class Assignment(BaseModel):
course: str
name: str
due_date: Optional[str] # ISO 8601 (e.g. "2026-09-20T23:59:00")
due_date_raw: str # Display string (e.g. "Sunday, 20 September, 11:59 PM")
status: str # "submitted" | "not_submitted" | "graded"
url: str
class CalendarEvent(BaseModel):
title: str
date: Optional[str] # ISO 8601
date_raw: str
course: Optional[str]
event_type: str # "assignment_due" | "workshop_submission" | "course_event"
url: Optional[str]๐ Installation & Setup
1. Prerequisites
Python 3.9+ (Tested up to Python 3.14)
Chromium (Managed automatically via Playwright)
Compatible with Windows, macOS, Linux, and Raspberry Pi (aarch64)
2. Clone & Setup Environment
# Clone the repository
git clone https://github.com/blank6890/moodle-mcp-server.git
cd moodle-mcp-server
# Create and activate virtual environment
python -m venv venv
# On Linux / macOS:
source venv/bin/activate
# On Windows (PowerShell):
.\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install Playwright browser binary
playwright install chromium๐ Authentication (Interactive CAS Login)
Moodle requires CAS SSO credentials. To protect your security, the server never handles passwords directly.
Run the interactive login script:
python scripts/login.py============================================================
Moodle Interactive Login
============================================================
Opening Moodle login page...
Waiting for login (up to 5 minutes)...
Complete CAS login in the browser window.
โ Login successful!
โ Session cookies saved to ./session/state.jsonA visible Chromium window will launch displaying the IIIT CAS Login page.
Complete your login (enter your username, password, and 2FA/CAPTCHA if prompted).
Once authenticated, cookies are securely saved to
./session/state.json.The browser closes automatically. Your session is now ready!
๐ก Session Expired? If your session expires after several days, simply run
python scripts/login.pyagain to refresh./session/state.json.
๐ค Claude Integration
Option A: Connect to Claude Code (CLI)
Add the MCP server to Claude Code with persistent session configuration:
claude mcp add moodle python -s local -e SESSION_DIR=./session -e PYTHONPATH=. -- -m app.mainOption B: Connect to Claude Desktop
Add this configuration to your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"moodle": {
"command": "python",
"args": ["-m", "app.main"],
"cwd": "/path/to/moodle-mcp-server",
"env": {
"PYTHONPATH": ".",
"SESSION_DIR": "./session"
}
}
}
}(Replace /path/to/moodle-mcp-server and python with the absolute paths to your project directory and virtual environment Python interpreter).
Option C: Standalone Server
You can also run the server directly:
# Standard I/O mode (for MCP clients)
python app/main.py
# Server-Sent Events (SSE) mode (for remote connections)
python app/main.py --sse๐ฌ Conversational Examples
Once connected, you can interact with Moodle using natural language:
โ๏ธ Configuration
Customize runtime behavior via environment variables or a .env file:
Variable | Type | Default | Description |
|
|
| Target Moodle instance URL |
|
|
| CAS SSO Authentication URL |
|
|
| Directory storing authenticated browser session state |
|
|
| Directory for cached HTML snapshots |
|
|
| Use fast HTTP transport before falling back to browser |
|
|
| Global in-memory cache TTL (seconds) |
|
|
| Course listing cache TTL (seconds) |
|
|
| Calendar & assignment cache TTL (seconds) |
|
|
| HTTP request timeout in seconds |
|
|
| Minimum delay between requests |
|
|
| Bind host for SSE transport mode |
|
|
| Bind port for SSE transport mode |
|
|
| Logging level ( |
โก Performance & Benchmarks
The built-in hybrid architecture avoids spawning a heavy browser process for every query:
Tool Endpoint | HTTP-First (Cached) | Full Browser Fallback | Speedup |
| ~12 ms | ~450 ms | 37x |
| ~35 ms | ~800 ms | 22x |
| ~48 ms | ~1,200 ms | 25x |
| ~52 ms | ~1,450 ms | 27x |
| ~44 ms | ~1,100 ms | 25x |
Run the benchmark suite locally:
python scripts/benchmark_latency.py๐ Security & Privacy
Zero Credential Exposure: Your Moodle password and 2FA credentials are never passed as command-line arguments, environment variables, or tool inputs.
Local Session Vault: Cookies are saved locally in
./session/state.json(ignored in.gitignore).Strictly Read-Only: The server implements query tools only. It cannot submit assignments, post forum messages, modify profile details, or delete files.
Sanitized Tool Outputs: Tool outputs sanitize raw session tokens, ensuring sensitive headers or auth keys are never sent in LLM context windows.
๐งช Testing & Verification
The project includes an extensive automated test suite covering HTTP clients, browser managers, data models, and HTML parsers:
# Run full test suite
pytest
# Run tests with verbose output
pytest -v
# Run with test coverage
pytest --cov=app tests/โ Troubleshooting
CAS sessions expire periodically based on university security policies. Simply run:
python scripts/login.pyLog in once, and the server will immediately resume operating without needing a restart.
Ensure Chromium is installed for Playwright:
playwright install chromiumIf using a custom Chromium binary (e.g. on Raspberry Pi), set the environment variable:
export CHROMIUM_PATH="/usr/bin/chromium"Set LOG_LEVEL=DEBUG in your environment:
export LOG_LEVEL=DEBUG
python app/main.py๐ License
Distributed under the MIT License. See LICENSE for more information.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
OAuth-protected, read-only-by-default MCP server for provenance-labeled QuillCaddie project memory.
MCP server for the Inistate platform: module discovery, entry management, and activity submission.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that turns UPB Virtual (Moodle) into a structured knowledge source, enabling AI assistants to query courses, assignments, deadlines, announcements, and sync materials via REST API.MIT
- AlicenseAqualityBmaintenanceMCP server for the DUTIC virtual classroom (Moodle) at UNSA. Allows viewing tasks (including hidden ones), courses, resources, and downloading files, from terminal or AI agents.2420 npmMIT
- AlicenseAqualityAmaintenanceRead-only MCP server for Canvas LMS that exposes tools to list courses, assignments, grades, submissions, syllabi, announcements, modules, pages, and files, without any write operations.1113 npm1MIT
- AlicenseAqualityAmaintenanceRead-only MCP server for Canvas LMS that works without API tokens by using session cookies, enabling AI assistants to access courses, assignments, grades, announcements, and more.3023 npm2MIT