Skip to main content
Glama

moodle-mcp

Ask Claude (or any MCP client) about your Moodle: courses, slides, deadlines, announcements, forums, private messages and grades.

"What's due on Moodle in the next two weeks?" "Summarise the slides of lecture 3 in Linear Algebra." "Anything new in my courses since Monday?" "Did anyone message me on Moodle?"

It works with any Moodle site (4.x and most 3.x) that has the Moodle mobile app enabled, which almost every university does. It is read-only by default: it can't submit, post, change or mark anything as read. Sending messages and forum replies can be switched on, with your confirmation for every send.

Quick start

You need uv (one command to install).

uv tool install git+https://github.com/rahul069/moodle-mcp
moodle-mcp setup

setup asks for your Moodle address, signs you in, and adds the server to Claude Code if it is installed. For other apps it prints the config to paste. That's it.

uvx --from git+https://github.com/rahul069/moodle-mcp moodle-mcp setup

Related MCP server: Moodle MCP

Signing in

moodle-mcp setup looks up how your Moodle handles logins and picks the right way:

  • Username and password (sites with their own Moodle accounts): type them once. They go only to your Moodle to get a token and are not saved.

  • University single sign-on (Shibboleth, SAML, Microsoft, ...): setup gives you a link.

    1. Log in to Moodle in your browser as usual.

    2. Open the link from setup in the same browser. Moodle then tries to open the Moodle app with an address starting with moodlemobile://token=.

    3. Copy that address and paste it into setup.

      • Firefox: it is in the address bar or on the error page.

      • Chrome / Edge: cancel the "open app" dialog, press F12, open Network, reload, click the launch.php row and copy Location from the response headers.

The token is stored in your system keyring (macOS Keychain, Windows Credential Manager, GNOME Keyring / KWallet). On machines without a keyring it is stored in ~/.config/moodle-mcp/token with permissions 600.

Use it in your MCP client

Claude Code: moodle-mcp setup offers to add it, or run moodle-mcp add-to-claude.

Claude Desktop, Cursor, Windsurf, VS Code, ...: add this to the app's MCP config (Claude Desktop: Settings → Developer → Edit Config):

{
  "mcpServers": {
    "moodle": { "command": "moodle-mcp" }
  }
}

If the app can't find moodle-mcp, use the full path (which moodle-mcp) or "command": "uvx", "args": ["--from", "git+https://github.com/rahul069/moodle-mcp", "moodle-mcp"].

Tools

Tool

What it does

moodle_courses

your courses with ids

moodle_course

sections and materials of a course, with [module ids]

moodle_open

text of a page or PDF, saves files to ~/Downloads/moodle/<course>/

moodle_updates

what changed in the last N days (files, forum posts, grades)

moodle_deadlines

upcoming deadlines and calendar events

moodle_notifications

latest notifications (announcements, feedback, grades)

moodle_forum, moodle_discussion

forums, discussions and posts

moodle_assignments

assignments with due dates and submission or grading status

moodle_grades

your grades in a course

moodle_messages, moodle_conversation

private and group chats

Courses can be named by id or by any part of their name ("linear alg", "algorithms").

Sending messages and forum replies (optional, off by default)

Two write tools can be switched on for local use:

Tool

What it does

moodle_send_message

private message into an existing chat, or to a person

moodle_forum_reply

reply to a forum post (everyone in the course can read it)

claude mcp add --scope user moodle -e MOODLE_ALLOW_WRITE=1 -- moodle-mcp

(or set "env": {"MOODLE_ALLOW_WRITE": "1"} in your client's MCP config).

Safety rails:

  • You confirm every send in a desktop dialog that shows the recipient and the exact text (zenity on Linux), or in your MCP client's own prompt (MCP elicitation). The AI can't confirm for you. If neither is available, nothing is sent.

  • Rate limit: 5 sends per hour, 20 per day (MOODLE_WRITE_MAX_PER_HOUR, MOODLE_WRITE_MAX_PER_DAY).

  • Log: every send is recorded in ~/.local/state/moodle-mcp/writes.log.

  • Never remote: the remote connector (moodle-mcp serve) never offers write tools.

  • Nothing graded: there are no tools to submit assignments, attempt quizzes, delete or edit anything.

Your messages and posts are your responsibility: read what you confirm. Using AI for graded work can break your university's exam rules.

Commands

moodle-mcp                 run the MCP server (what your MCP client starts)
moodle-mcp setup           connect your Moodle account
moodle-mcp test            check the connection
moodle-mcp add-to-claude   register with Claude Code
moodle-mcp logout          delete the saved site and token

Settings via environment variables (all optional):

Variable

Meaning

MOODLE_URL, MOODLE_TOKEN

use these instead of what setup saved

MOODLE_TOKEN_FILE

file containing the token (or a MOODLE_TOKEN= line)

MOODLE_DOWNLOADS

where moodle_open saves files (default ~/Downloads/moodle)

MOODLE_INLINE_TEXT=0

don't return the text of PDFs, only save them

Use it from claude.ai and your phone (optional)

Run moodle-mcp on an always-on machine (a home server or a small cloud VM) as a remote connector and add it in claude.ai → Settings → Connectors → Add custom connector. It then also works in the Claude mobile apps.

moodle-mcp setup             # on the server (paste the token; no browser needed there)
moodle-mcp set-passphrase    # the passphrase you'll type when connecting claude.ai
moodle-mcp serve --public-url https://your-server.example.com

It listens on 127.0.0.1:8790 only, so put HTTPS in front of it, e.g. tailscale funnel --bg 8790, a Cloudflare Tunnel, or Caddy/nginx. In claude.ai, use https://your-server.example.com/mcp as the connector URL. A sign-in page asks for your passphrase (5 wrong tries lock it for 15 minutes).

# /etc/systemd/system/moodle-mcp.service
[Unit]
Description=Moodle MCP connector
After=network-online.target

[Service]
User=youruser
Environment=MOODLE_TOKEN_FILE=/home/youruser/.config/moodle-mcp/token
ExecStart=/home/youruser/.local/bin/moodle-mcp serve --public-url https://your-server.example.com
Restart=on-failure
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/home/youruser/.local/state/moodle-mcp /home/youruser/Downloads
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Other clients: only claude.ai/claude.com (and localhost) may receive sign-in codes. To allow another client, add its redirect host, e.g. for Gemini: --allow-redirect-host oauth-redirect.googleusercontent.com. moodle-mcp revoke-all signs every client out.

Privacy and security

  • Read-only by construction. The client can only call the Moodle web-service functions listed in api.py (READ_ONLY); everything else is refused before any request is sent. The three send functions (WRITE) work only with MOODLE_ALLOW_WRITE=1 and a confirmation from you.

  • Your data stays between your computer and your Moodle. No telemetry, no third-party servers. Your MCP client (e.g. Claude) sees the tool results you ask for.

  • The token gives access to your Moodle account. Keep it private. To revoke it, delete it on Moodle under Preferences → Security keys (/user/managetoken.php), then run moodle-mcp logout.

  • Content from Moodle (posts, messages, files) is written by other people. Good MCP clients treat it as data, but be aware of prompt injection when you let an assistant act on it.

Development

git clone https://github.com/rahul069/moodle-mcp && cd moodle-mcp
uv sync
uv run pytest
uv run moodle-mcp setup

License

MIT. Not affiliated with Moodle Pty Ltd. "Moodle" is a registered trademark of Moodle Pty Ltd.

Available Tools

12 tools
moodle_assignmentsB
Read-onlyIdempotent

Assignments with due dates and your submission and grading status. Leave course empty for all courses.

Inputs: course, include_past. Returns: result

moodle_conversationA
Read-onlyIdempotent

Read the latest messages of one Moodle conversation (conversation_id from moodle_messages), oldest first. Nothing is marked as read.

Inputs: conversation_id (required), limit. Returns: result

moodle_courseA
Read-onlyIdempotent

Show a course's sections and materials (files, pages, forums, assignments, links) with their [module ids]. course is the course id or part of its name.

Inputs: course (required). Returns: result

moodle_coursesA
Read-onlyIdempotent

List the Moodle courses you are enrolled in, with their ids.

Inputs: no named parameters. Returns: result

moodle_deadlinesB
Read-onlyIdempotent

Upcoming deadlines and calendar events (assignments, quizzes, course events) for the next days days.

Inputs: days. Returns: result

moodle_discussionA
Read-onlyIdempotent

Read all posts of one forum discussion (discussion_id from moodle_forum).

Inputs: discussion_id (required). Returns: result

moodle_forumA
Read-onlyIdempotent

List a course's forums (no forum_id), or the latest discussions in one forum (forum_id from that list).

Inputs: course (required), limit, forum_id. Returns: result

moodle_gradesA
Read-onlyIdempotent

Your grades in one course (id or part of its name).

Inputs: course (required). Returns: result

moodle_messagesA
Read-onlyIdempotent

Your Moodle private chats and group conversations (newest first): who, unread count and the last message. Open one with moodle_conversation(conversation_id). Nothing is marked as read.

Inputs: limit. Returns: result

moodle_notificationsB
Read-onlyIdempotent

Your latest Moodle notifications (announcements, forum posts, feedback, grades), newest first.

Inputs: limit. Returns: result

moodle_openA
Read-onlyIdempotent

Open one item from moodle_course by its [module id]: returns the text of pages, labels, links and PDFs, and saves attached files under ~/Downloads/moodle//. Long PDFs come back in parts (about 40,000 characters each); call again with start_page to read the rest. Give course (id or name) to make it faster.

Inputs: module_id (required), course, start_page. Returns: result

moodle_updatesA
Read-onlyIdempotent

What changed in your courses in the last days days (new or updated files, forum posts, grades, ...). Leave course empty for all courses.

Inputs: days, course. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 12 tools

    Disambiguation3/5

    moodle_courses (list enrolled courses) vs moodle_course (show one course's contents) differ only by an 's', which is a real misselection hazard despite the descriptions. There is also partial overlap among moodle_updates, moodle_notifications, and moodle_deadlines, and moodle_assignments partially duplicates due-date info found in moodle_deadlines.

    Naming Consistency4/5

    Every tool uses a uniform moodle_<resource> snake_case pattern, which is predictable and readable. The only blemish is the singular/plural pair moodle_courses/moodle_course, which is technically consistent but semantically fragile.

    Tool Count5/5

    Twelve tools is well within the healthy range and each maps to a distinct Moodle entity or activity stream. Nothing feels padded or redundant at the count level.

    Completeness3/5

    Read coverage is broad (courses, materials, forums, discussions, assignments, grades, messages, deadlines), but the surface is entirely read-only: no submitting assignments, uploading files, replying to forums, or sending messages. Agents asked to act on Moodle rather than summarize it will hit dead ends, even though assignment submission status is exposed.

    Related MCP Connectors

    Related MCP Servers