Skip to main content
Glama

moodle_math_mcp

MCP server for moodle.math.tusur.ru — automates Moodle interactions via Playwright browser automation.

Features

  • list_courses — get available courses

  • list_course_modules — list materials and assignments in a course

  • find_course_module — search modules by title

  • get_assignment_details — fetch assignment page text

  • download_module_files — download files from a resource or assignment

Prerequisites

  • Node.js >= 18

  • Playwright browsers: npx playwright install chromium

Setup

  1. Clone the repo:

    git clone https://github.com/<you>/moodle_math_mcp.git
    cd moodle_math_mcp
  2. Install dependencies:

    npm install
  3. Create .env from the example:

    cp .env.example .env

    Fill in MATH_USERNAME and MATH_PASSWORD with your Moodle credentials.

  4. (Optional) Save browser session for cookie-based auth:

    npm run login

    A browser window will open — log in manually. The session is saved to storage/auth.json.

Usage

As an MCP server

Add to your MCP client config (e.g. Claude Desktop):

{
  "mcpServers": {
    "moodle-math": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/moodle_math_mcp"
    }
  }
}

Development

npm run dev

Build

npm run build
npm start

Environment Variables

Variable

Required

Default

Description

MATH_USERNAME

Yes

Moodle login

MATH_PASSWORD

Yes

Moodle password

MOODLE_URL

No

https://moodle.math.tusur.ru

Moodle base URL

HEADLESS

No

false

Run browser without UI

License

ISC