Moodle MCP Server
Provides tools for interacting with Moodle LMS, including listing courses, retrieving course contents and documents, and searching resources across enrolled courses.
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 Serverlist my enrolled courses"
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
Model Context Protocol integration for Moodle LMS
Features โข Installation โข Usage โข Documentation โข Contributing
๐ Overview
A powerful Model Context Protocol (MCP) server that seamlessly integrates AI assistants with Moodle Learning Management System. Enable your AI assistant to access courses, retrieve educational content, download resources, and search through your learning materials.
๐ Compatible with: Claude Desktop, and any MCP-compatible AI assistant
Related MCP server: mcpUPB
โจ Features
๐ Secure Authentication - Token-based auth using Moodle Web Services
๐ Course Management - List and access all enrolled courses
๐ Content Retrieval - Get sections, modules, and resources from courses
๐พ Document Access - Download files and documents with proper authentication
๐ Smart Search - Find resources by name across all enrolled courses
๐ก๏ธ Error Handling - Comprehensive error handling with automatic token refresh
๐ TypeScript - Fully typed for better developer experience
๐ฏ Use Cases
Study Assistant: Let AI help you navigate course materials
Content Organization: Search and organize learning resources
Course Overview: Get quick summaries of course structures
Resource Discovery: Find specific documents across multiple courses
Learning Analytics: Analyze course content and structure
๐ Prerequisites
Node.js 18 or higher
Moodle Instance with Web Services enabled
Valid Credentials with API access to your Moodle instance
๐ Installation
Quick Start
# Clone the repository
git clone <repository-url>
cd moodle-mcp
# Install dependencies
npm install
# Build the project
npm run buildConfiguration
Create environment file
cp .env.example .envConfigure your credentials
MOODLE_URL=https://your-moodle-instance.com
MOODLE_USERNAME=your_username
MOODLE_PASSWORD=your_password
MOODLE_SERVICE=moodle_mobile_app # OptionalMoodle Web Services Setup
Your Moodle instance must have Web Services enabled. If you're a Moodle administrator:
Navigate to Site administration โ Server โ Web services โ Overview
Follow the setup wizard to enable web services
Create or use the built-in
moodle_mobile_appserviceEnsure these functions are enabled:
core_webservice_get_site_infocore_enrol_get_users_coursescore_course_get_coursescore_course_get_contents
๐ฎ Usage
Running the Server
# Production
node dist/index.js
# Development with auto-reload
npm run devIntegration with Claude Desktop
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"moodle": {
"command": "node",
"args": ["/absolute/path/to/moodle-mcp/dist/index.js"],
"env": {
"MOODLE_URL": "https://your-moodle-instance.com",
"MOODLE_USERNAME": "your_username",
"MOODLE_PASSWORD": "your_password"
}
}
}
}Available Tools
Tool | Description |
| List all enrolled courses with details |
| Retrieve complete course structure with sections and modules |
| Get all downloadable files from a course with direct URLs |
| Search for resources by name across all courses |
๐ Detailed documentation: See USAGE.md for comprehensive tool documentation
๐งช Testing
Quick Test
# Run the complete test suite
npm testTesting Options
Method | Description |
Automated Tests |
|
MCP Inspector | Interactive web-based tool testing |
Standalone Script | Direct API testing without MCP |
Manual cURL | Test Moodle API endpoints directly |
๐ Full testing guide: See TESTING.md
๐๏ธ Development
Project Structure
moodle-mcp/
โโโ src/
โ โโโ index.ts # MCP server implementation
โ โโโ moodle-client.ts # Moodle API client
โ โโโ types.ts # TypeScript type definitions
โ โโโ test.ts # Standalone test script
โโโ dist/ # Compiled JavaScript
โโโ .env.example # Environment template
โโโ README.md # This file
โโโ USAGE.md # Tool usage guide
โโโ TESTING.md # Testing guideCommands
# Build the project
npm run build
# Watch mode (auto-rebuild)
npm run watch
# Run tests
npm test
# Development mode
npm run dev๐ง API Architecture
Authentication Flow
1. Token Generation โ POST /login/token.php
2. API Calls โ GET/POST /webservice/rest/server.php?wstoken={token}
3. File Downloads โ GET /pluginfile.php/...?token={token}Moodle Web Services
core_webservice_get_site_info- User and site informationcore_enrol_get_users_courses- Enrolled courses listcore_course_get_courses- All available coursescore_course_get_contents- Course structure and resources
๐ Documentation
USAGE.md - Comprehensive guide to all available tools
TESTING.md - Testing instructions and methods
MCP Documentation - Learn more about MCP
๐ Troubleshooting
โ Verify credentials are correct in
.envโ Ensure Web Services are enabled in Moodle
โ Check service name matches your Moodle configuration
โ Verify user has appropriate API access permissions
โ Verify user has appropriate role permissions in Moodle
โ Some resources may be restricted based on enrollment
โ Check course visibility settings
โ Verify Moodle URL is correct and accessible
โ Check network connection and firewall settings
โ Ensure Moodle instance accepts API requests
โ Try accessing Moodle URL directly in browser
๐ Security
๐ Store credentials securely using environment variables
๐ Use HTTPS for Moodle connections in production
๐ Regularly rotate passwords and tokens
๐ Follow your organization's security policies
โ ๏ธ Never commit
.envfile to version control
๐ค Contributing
Contributions are welcome! Here's how you can help:
๐ด Fork the repository
๐จ Create a feature branch (
git checkout -b feature/amazing-feature)๐พ Commit your changes (
git commit -m 'Add amazing feature')๐ค Push to the branch (
git push origin feature/amazing-feature)๐ Open a Pull Request
Please ensure your PR:
โ Includes tests for new features
โ Updates documentation as needed
โ Follows existing code style
โ Passes all tests
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Built with Model Context Protocol SDK
Powered by Moodle LMS
TypeScript & Node.js ecosystem
๐ Support
๐ Documentation
๐ Issue Tracker
๐ฌ Discussions
Made with โค๏ธ for the Moodle and AI community
โญ Star this repo if you find it helpful!
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoโฆ
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that provides seamless access to Moodle developer documentation from moodledev.io. It enables AI assistants and other MCP clients to search, browse, and retrieve Moodle development documentation with version-specific support.4MIT
- 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
- AlicenseNot gradedqualityCmaintenanceConnects Moodle LMS with AI assistants through the Model Context Protocol, enabling users to interact with Moodle data via a conversational chatbot interface.7 npmMIT
- FlicenseNot gradedqualityBmaintenanceA Model Context Protocol (MCP) server that connects AI coding agents to your Moodle LMS. Fetch assignments, grades, deadlines, and sync everything to Obsidian automatically.-