Query Moodle LMS data through natural language. Attach your agent to your LMS data.
Ask your Moodle instance anything. Get structured answers in seconds.
moodle-mcp-server is an open-source MCP (Model Context Protocol) server that connects AI agents directly to Moodle's Web Services API. It is the Moodle connector behind CSMediaPro's broader Agentic Query Layer (AQL) work.
Instead of learning report builders, writing SQL, or exporting CSVs, you ask questions in plain English — the AI agent queries your LMS and returns structured data.
Project home: 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
Most users launch the server through an MCP client such as Claude Desktop:
{
"mcpServers": {
"moodle-mcp-server-aql": {
"command": "npx",
"args": ["-y", "moodle-mcp-server-aql"],
"env": {
"MOODLE_URL": "https://your-moodle-instance.example",
"MOODLE_TOKEN": "your-moodle-web-services-token"
}
}
}
}
# Clone the repo
git clone https://github.com/csmediapro/moodle-mcp-server
cd moodle-mcp-server
# Install dependencies
npm install
# Configure
cp packages/server/.env.example packages/server/.env
# Edit .env: add your MOODLE_URL and MOODLE_TOKEN
# Run (stdio mode)
npm run server:build
node packages/server/dist/index.js
User field display settings are generated per Moodle instance and stored locally at
packages/server/data/user-field-schema.json. This file is intentionally ignored by git
because it can include site-specific custom profile fields.
After connecting to a Moodle site, run the refresh_user_field_schema tool once to
discover available standard and custom user fields. A minimal example shape is included
at packages/server/data/user-field-schema.example.json.
Separately installed plugins can use this schema to flatten custom profile fields
into stable keys such as school. The premium user-directory plugin, for example,
uses it to cache and summarize full-user directory fields outside the OSS core.
The core owns two different server identity fields:
server.id — stable machine identity, for example mcp_8f3k2q9xserver.name — human-facing display labelIf server.id is missing, the core generates one once and persists it to the resolved config file before startup continues.
Environment overrides:
MOODLE_MCP_CONFIG or MOODLE_MCP_SERVER_CONFIG — choose the config file pathSERVER_ID — explicit server.id overrideSERVER_NAME — explicit server.name overrideSERVER_VERSION — explicit server.version overrideIf server.id is missing and the resolved config path is not writable, startup fails deliberately.
# From the project root
cp packages/client/.env.example packages/client/.env
npm run client:dev
# Open http://localhost:3000
The client will auto-detect your Moodle instance and present a chat interface where you can ask questions in plain English.
moodle-mcp-server needs an AI model to power the natural-language interface. You bring the model — the moodle-mcp-server core and reference client support any MCP-compatible provider.
Running a local model keeps all data on your own hardware — nothing leaves your network. Modern quantized models run well on consumer GPUs and even CPU-only setups.
Performance: A quantized 24B model on a single RTX 3090 delivers ~1.5-second responses after the first query — faster than most cloud APIs once the system is initialized.
# Install Ollama: https://ollama.com
ollama pull gemma3:12b # Fast, reliable tool use (~200ms TTFT)
ollama pull qwen3:14b # Strong reasoning, good for complex queries
ollama pull deepseek-r1:14b # Excellent at multi-step chains
Then point the reference client at http://localhost:11434 (Ollama's default).
# Download a GGUF model (example: Devstral 24B Q4)
# Run the llama.cpp server:
llama-server -m devstral-24b-Q4_K_M.gguf --ctx-size 60000 --port 8080
Point the reference client at http://localhost:8080/v1.
| Model | Size | Best For | Hardware |
|---|---|---|---|
| Gemma 3 12B | ~7 GB VRAM | Fast tool calls, straightforward queries | Single consumer GPU |
| Qwen 3 14B | ~8.5 GB VRAM | Complex reasoning, multi-tool chains | Single consumer GPU |
| Devstral 24B Q4 | ~14.5 GB VRAM | Maximum capability, 60K context | RTX 3090 / 4090 |
Anthropic (Claude):
export ANTHROPIC_API_KEY=sk-ant-...
Select "Anthropic" in the reference client's provider dropdown. Claude Sonnet offers the most reliable tool-calling behavior.
OpenAI (GPT):
export OPENAI_API_KEY=sk-...
Select "OpenAI" in the provider dropdown. GPT-4o performs well on structured queries.
Ollama Cloud:
Uses the same API as local Ollama, hosted at https://ollama.com/v1. Good middle ground — faster than local cold starts, more private than big cloud providers.
Claude Desktop connects to the moodle-mcp-server core directly over stdio — no reference client needed.
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"moodle-mcp-server": {
"command": "node",
"args": ["/path/to/moodle-mcp-server/packages/server/dist/index.js"],
"env": {
"MOODLE_URL": "https://your-moodle-instance.com",
"MOODLE_TOKEN": "your-api-token"
}
}
}
}
Restart Claude Desktop. The server's tools will appear in Claude's tool list — ask questions directly.
| Tool | Description |
|---|---|
list_courses | Full course catalog with category drill-down |
get_course | Detail view for any course |
list_course_users | Enrolled users with roles and access data (now supports course name search with interactive selection) |
list_assignments | All assignments with due dates |
list_categories | Full hierarchy with exact parent resolution |
get_site_info | Instance overview — site name, version, course count |
get_user | Detail view for a Moodle user |
list_user_courses | Courses for a specific user |
search_users | User search by standard Moodle identity fields |
search_courses_by_name | Search for courses by name with partial matching and interactive selection |
User (plain English question)
│
▼
AI Agent (Claude / GPT / Gemini / Ollama / local)
│
▼ MCP Protocol
`moodle-mcp-server`
├── Tool Registry (core + plugins)
├── Agent Runtime Config (core + plugin rules)
├── Optimized Data Layer (secure, efficient data handling)
└── Moodle Client (REST API calls)
│
▼
Moodle Web Services API
dist/index.js — runs as a subprocess, used by Claude Desktop and similar clientsThe OSS core intentionally ships with stdio only. Any network-facing wrapper, remote supervision, or premium plugin attachment belongs in a separate commercial node agent or wrapper.
AGPL v3 — see LICENSE.
This means you can:
moodle-mcp-server core for free, in any environmentYou cannot:
moodle-mcp-server core as a closed-source competing commercial productMoodle is a trademark of Moodle Pty Ltd. moodle-mcp-server is an independent CSMediaPro project and is not affiliated with, endorsed by, sponsored by, or officially connected to Moodle Pty Ltd or the Moodle project. The name is used descriptively to identify compatibility with Moodle LMS.
moodle-mcp-server is built and maintained by CSMediaPro, a software development company specializing in AI integration, systems engineering, and workflow automation.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y moodle-mcp-server-aqlMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-csmediapro-moodle-mcp-server-aql": {
"command": "npx",
"args": [
"-y",
"moodle-mcp-server-aql"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referencemoodle-mcp-server-aqlnpmio.github.csmediapro/moodle-mcp-server-aql works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.