Purpose
moodle-mcp-server is an open-source MCP (Model Context Protocol) server used to connect AI agents to Moodle LMS data. It serves as a connector between AI and Moodle, allowing users to ask questions about a Moodle instance in natural language, with the AI agent querying the LMS and returning structured data, without needing to learn the report builder, write SQL, or export CSV.
Main Capabilities
- Core query tools: course catalog, user course enrollments, assignments, category navigation, site metadata, user lookup, and cache management.
- Advanced reporting plugins (optional, must be obtained separately): tools such as course completion reports and recent activity can be attached at runtime via plugins.
- LLM-agnostic: supports Claude, GPT, Gemini, Ollama, or any AI client compatible with MCP.
- Zero LMS modification: uses Moodle's existing Web Services API, with no plugin installation required.
- Compliant data handling: secure and efficient data handling, with privacy guaranteed by design.
- Read-only: never modifies Moodle data, and can be safely used in production environments.
- Plugin-extensible: place new tool modules into a directory, and tools and optional agent routing prompts can be automatically registered at runtime.
Usage
Prerequisites: a Moodle instance with Web Services enabled, and a Moodle API token (Site administration → Plugins → Web services → Manage tokens).
Most users start the server through an MCP client (such as Claude Desktop). It can also be set up from source.
Connecting an LLM:
- Run locally (recommended for speed and privacy): run local models on your own hardware, so data does not leave the network. Quantized models can run on consumer-grade GPUs or even CPU only. For example, a quantized 24B model on a single RTX 3090 responds in about 1.5 seconds after the first query. You can point the reference client to http://localhost:11434(Ollama by default) or http://localhost:8080/v1。
- Cloud providers: Anthropic (Claude), select "Anthropic" from the dropdown menu in the reference client, and Claude Sonnet provides the most reliable tool-calling behavior; OpenAI, select "OpenAI", and GPT-4o performs well on structured queries; Ollama Cloud, uses the same API as local Ollama, hosted at https://ollama.com/v1。
- Claude Desktop (direct MCP): Claude Desktop connects directly to the moodle-mcp-server core via stdio, with no reference client required. Add it to the Claude Desktop configuration (claude_desktop_config.json) and restart Claude Desktop; the server tools will appear in Claude's tool list.
User field schema: After connecting to a Moodle site, run the refresh_user_field_schema tool once to discover the available standard and custom user fields. The schema is generated per Moodle instance and stored locally at packages/server/data/user-field-schema.json. Separately installed plugins can use this schema to flatten custom profile fields into stable keys (such as school).
Configuring identity: The core owns two distinct server identity fields: server.id (a stable machine identity, such as mcp_8f3k2q9x) and server.name (a human-facing display label). If server.id is missing, the core generates one once and persists it to the resolved config file. Environment variable overrides: MOODLE_MCP_CONFIG or MOODLE_MCP_SERVER_CONFIG selects the config file path; SERVER_ID, SERVER_NAME, and SERVER_VERSION can explicitly override the corresponding fields. If server.id is missing and the resolved config path is not writable, startup deliberately fails.
Transport mode: Stdio — dist/index.js — runs as a subprocess for clients such as Claude Desktop. The open-source core intentionally provides stdio only.
Plugin contract: Creating plugins is supported, with a Hello Plugin example provided. Advanced plugins are obtained separately, including advanced reporting (gradebook, cross-course comparison, custom report builder), user analytics (progress tracking, engagement scoring, risk flagging), user directory (cached directory listings and structured filtering across standard and custom profile fields), and compliance package (certification tracking, expiration reminders, audit exports).
Use cases
Suitable for educational institutions, teachers, and administrators who need to quickly query Moodle LMS data in natural language, usingfor course, user, assignment, and site information queries. Suitable for scenarios that want to connect Moodle data into AI agent workflows while remaining read-only and without modifying the LMS.
Limitations
- Read-only, does not modify Moodle data.
- Requires a Moodle instance with Web Services enabled and an API token.
- The open-source core provides only the stdio transport mode; network-facing wrappers, remote supervision, or advanced plugin attachments are a separate commercial node agent.
- Advanced plugins are obtained separately.
- Licensed under AGPL v3: free to use, modify, build, and distribute derivative works; however, you may not repackage the core as a closed-source competing commercial product, nor offer it as a network service without sharing modifications.
- Not affiliated with, endorsed by, or sponsored by Moodle Pty Ltd or the Moodle project; the name is used only to describe compatibility with the Moodle LMS.
Project homepage:https://csmediapro.com/products/moodle-mcp-server;npm package:https://www.npmjs.com/package/moodle-mcp-server-aql;MCP Registry:io.github.csmediapro/moodle-mcp-server-aql。