Moodle MCP server

Streamlines Moodle educational workflows by providing automated tools for retrieving student information, managing assignments, and generating feedback through natural language interactions.
Back to servers
Provider
peancor
Release date
Mar 09, 2025
Language
TypeScript
Stats
7 stars

The Moodle MCP Server allows Large Language Models (LLMs) to interact with your Moodle platform, letting them manage courses, students, assignments, and quizzes through the Model Context Protocol.

Features

Student Management Tools

  • list_students - Retrieves the list of students enrolled in the course
    • Displays ID, name, email, and last access time for each student

Assignment Management Tools

  • get_assignments - Retrieves all available assignments in the course
    • Includes information such as ID, name, description, due date, and maximum grade
  • get_student_submissions - Examines a student's submissions for a specific assignment
    • Requires the assignment ID and optionally the student ID
  • provide_assignment_feedback - Provides grades and comments for a student's submission
    • Requires student ID, assignment ID, grade, and feedback comment

Quiz Management Tools

  • get_quizzes - Retrieves all available quizzes in the course
    • Includes information such as ID, name, description, opening/closing dates, and maximum grade
  • get_quiz_attempts - Examines a student's attempts on a specific quiz
    • Requires the quiz ID and optionally the student ID
  • provide_quiz_feedback - Provides comments for a quiz attempt
    • Requires the attempt ID and feedback comment

Requirements

  • Node.js (v14 or higher)
  • Moodle API token with appropriate permissions
  • Moodle course ID

Installation

  1. Clone the repository:
git clone https://github.com/your-username/moodle-mcp-server.git
cd moodle-mcp-server
  1. Install dependencies:
npm install
  1. Create a .env file with the following configuration:
MOODLE_API_URL=https://your-moodle.com/webservice/rest/server.php
MOODLE_API_TOKEN=your_api_token
MOODLE_COURSE_ID=1  # Replace with your course ID
  1. Build the server:
npm run build

Setting Up with Claude

To use with Claude Desktop, add the server configuration:

MacOS

Add to: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "moodle-mcp-server": {
      "command": "/path/to/node",
      "args": [
        "/path/to/moodle-mcp-server/build/index.js"
      ],
      "env": {
        "MOODLE_API_URL": "https://your-moodle.com/webservice/rest/server.php",
        "MOODLE_API_TOKEN": "your_moodle_api_token",
        "MOODLE_COURSE_ID": "your_course_id"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Windows

Add to: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "moodle-mcp-server": {
      "command": "C:\\path\\to\\node.exe",
      "args": [
        "C:\\path\\to\\moodle-mcp-server\\build\\index.js"
      ],
      "env": {
        "MOODLE_API_URL": "https://your-moodle.com/webservice/rest/server.php",
        "MOODLE_API_TOKEN": "your_moodle_api_token",
        "MOODLE_COURSE_ID": "your_course_id"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Getting a Moodle API Token

  1. Log in to your Moodle site as an administrator
  2. Navigate to Site Administration > Plugins > Web Services > Manage tokens
  3. Create a new token with the necessary permissions to manage courses
  4. Copy the generated token and add it to your .env file

Using the Server

Once configured, Claude can interact with your Moodle course using the following tools:

Managing Students

Claude can list all students enrolled in the course, showing their IDs, names, emails, and last access times.

Working with Assignments

Claude can:

  • View all assignments in the course
  • Check student submissions for specific assignments
  • Provide grades and feedback on student work

Handling Quizzes

Claude can:

  • View all quizzes in the course
  • Examine student attempts on specific quizzes
  • Provide feedback on quiz attempts

Security Tips

  • Keep your .env file and Moodle API token private
  • Ensure the MCP server only has access to the courses it needs to manage
  • Use a token with the minimum necessary permissions for your use case

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later