moodle_math_mcp
# moodle_math_mcp
MCP server for [moodle.math.tusur.ru](https://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](https://playwright.dev) browsers: `npx playwright install chromium`
## Setup
1. Clone the repo:
```bash
git clone https://github.com/<you>/moodle_math_mcp.git
cd moodle_math_mcp
```
2. Install dependencies:
```bash
npm install
```
3. Create `.env` from the example:
```bash
cp .env.example .env
```
Fill in `MATH_USERNAME` and `MATH_PASSWORD` with your Moodle credentials.
4. (Optional) Save browser session for cookie-based auth:
```bash
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):
```json
{
"mcpServers": {
"moodle-math": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/moodle_math_mcp"
}
}
}
```
### Development
```bash
npm run dev
```
### Build
```bash
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
TDQS
Scored across 6 tools
Most tools are clearly distinct: list_courses, list_course_modules, find_course_module, and the two download tools each target different actions or scopes. get_assignment_details could be slightly confused with download_module_files when an assignment contains files, but its purpose of returning the assignment text is distinguishable.
All tool names follow the same lowercase snake_case verb_noun pattern: list_, get_, find_, download_. The naming consistently reflects the action and target resource, making the API predictable.
Six tools is a well-scoped size for a Moodle math file/material retrieval server. Each tool covers a meaningful operation without unnecessary fragmentation or bloat.
The set covers the core workflow: listing courses, viewing course modules, finding specific modules, getting assignment details, and downloading files at module or course level. Minor gaps exist, such as no direct way to fetch course metadata or handle other Moodle activities, but agents can work around these.