Summary
Moodle learning platform over its Web Services REST protocol: courses and course content, participants, users, grades, activity completion, assignments and submissions, quizzes, calendar and deadlines, forums and messages. Site URL and web service token.
Guided setup
Connect Moodle to Gemini in 2 minutes
Start a free trial on AnythingMCP Cloud, connect Moodle in the guided setup, then add your MCP URL to Gemini. No code and no server to run.
No credit card · 7-day trial · Self-host alternative available
Try asking
Example prompts for Moodle
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → Moodle, enter your Moodle site address and a web service token, mint an MCP API key and you're done. No Docker, no
git clone, no local server.
Moodle + Gemini
Moodle learning platform over its Web Services REST protocol: courses and course content, participants, users, grades, activity completion, assignments and submissions, quizzes, calendar and deadlines, forums and messages. Site URL and web service token.
Prerequisites
See the full setup instructions baked into the connector (visible in the in-app store when you select the connector). The required environment variables for this connector are:
MOODLE_URL, MOODLE_TOKEN
Step 1 — Get credentials
Setup by a Moodle administrator (about 10 minutes)
- Site administration, General, Advanced features: tick Enable web services and save.
- Site administration, Server, Web services, Manage protocols: enable the REST protocol.
- Web services, External services: add a service (enabled), then Add functions and add the functions named in the list below. The built-in Moodle mobile web service already contains all of them except
core_user_get_users, and can be used instead when Mobile app, Mobile settings, Enable web services for mobile devices is on. - Choose the user the connector acts as, ideally a dedicated account. Its role needs the capability Use REST protocol (
webservice/rest:use) and the rights for what you want to read: a teacher or manager role for participants, grades of others and submissions. - Web services, Manage tokens, Create token: pick that user and the service, save and copy the token into
MOODLE_TOKEN. - Put the address of the site into
MOODLE_URL, without a slash at the end, e.g.https://moodle.myschool.org.
A user without administrator rights can use their own token of the mobile service, shown under Preferences, Security keys when the site allows it. The connector then sees exactly what that user sees.
Where to start: moodle_get_site_info checks the token and returns userid. Then moodle_list_my_courses (or moodle_list_user_courses) for the course ids everything else needs.
Courses: moodle_list_my_courses, moodle_list_user_courses, moodle_search_courses, moodle_get_courses_by_field, moodle_list_courses (all courses, manager token), moodle_list_categories and moodle_get_course_contents for sections, activities and files.
People: moodle_list_enrolled_users (participants of a course), moodle_get_users_by_field (exact lookup by id, username, email, idnumber), moodle_search_users (custom service only).
Progress: moodle_get_grade_items (grade report of a course), moodle_get_course_grades_overview (final grades across courses), moodle_get_completion_status (activity completion).
Activities: moodle_list_assignments, moodle_list_assignment_submissions, moodle_list_quizzes. Calendar: moodle_list_calendar_events, moodle_list_upcoming_deadlines. Forums: moodle_list_forums, moodle_list_forum_discussions, moodle_get_discussion_posts. Messages: moodle_list_conversations and moodle_send_message, the only tool that writes.
Functions behind the tools (add these to a custom service): core_webservice_get_site_info, core_course_get_enrolled_courses_by_timeline_classification, core_enrol_get_users_courses, core_course_get_courses, core_course_get_courses_by_field, core_course_search_courses, core_course_get_contents, core_course_get_categories, core_enrol_get_enrolled_users, core_user_get_users_by_field, core_user_get_users, gradereport_user_get_grade_items, gradereport_overview_get_course_grades, core_completion_get_activities_completion_status, mod_assign_get_assignments, mod_assign_get_submissions, mod_quiz_get_quizzes_by_courses, core_calendar_get_calendar_events, core_calendar_get_action_events_by_timesort, mod_forum_get_forums_by_courses, mod_forum_get_forum_discussions, mod_forum_get_discussion_posts, core_message_get_conversations, core_message_send_instant_messages.
Errors come with HTTP 200: Moodle answers a failed call with status 200 and a body holding exception, errorcode and message. The connector turns that into a failed call. Common codes: invalidtoken (token wrong, expired or deleted), accessexception (the function is not in the service of the token, or web services are off), nopermissions (the user lacks a capability, named in the message), invalidparameter (a value has the wrong type) and invalidrecord (no such id). Many tools also return warnings next to the data when single items were skipped: read them.
Ids: Moodle has three ids per activity. cmid (course module id) is the one in page addresses and in moodle_get_course_contents; instance (or id in the assignment, quiz and forum lists) is what the activity tools take. User, course and group ids are plain numbers.
Values: times are Unix seconds (0 means not set). Flags are numbers: 1 for yes, 0 for no; Moodle refuses the words true and false. Texts such as summary, intro and message are HTML.
Permissions: every call runs as the user of the token. A student token reads its own courses, grades and deadlines; lists of participants, grades of others and submissions need a teacher or manager. There is no documented rate limit; the site's own capacity is the limit, so prefer one call with several course ids over one call per course.
Step 2 — Install the adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
Step 3 — Add the connector in Gemini
Your server URL: in AnythingMCP, open MCP Servers → the server this connector is on, and copy its URL (
https://cloud.anythingmcp.com/mcp/…). Use it wherever this guide showsYOUR_SERVER_ID.
Gemini CLI reads MCP servers from ~/.gemini/settings.json (on Windows %USERPROFILE%\.gemini\settings.json). Add:
{
"mcpServers": {
"anythingmcp": {
"httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- Create an MCP API key in AnythingMCP under MCP Servers → your server → API keys, and paste it in place of
YOUR_MCP_API_KEY. - Save the file and restart
gemini. - Run
/mcpinside Gemini CLI (orgemini mcp listin your shell) —anythingmcpshould show as connected. - Start prompting — Gemini CLI can now call the
Moodletools.
Available tools
| Tool | What it does |
|---|---|
moodle_get_site_info | Read the site and the user the token belongs to: sitename, siteurl, release (Moodle version), userid, username, fullname, lang and whether… |
moodle_list_my_courses | List the courses of the token user as on the Moodle dashboard: id, fullname, shortname, summary, startdate, enddate (Unix seconds)… |
moodle_list_user_courses | List the courses a user is enrolled in: id, shortname, fullname, category, startdate, enddate, lastaccess (Unix seconds), progress in… |
moodle_list_courses | Read courses by id with their settings: id, shortname, fullname, categoryid, summary, format, startdate, enddate, visible, numsections… |
moodle_get_courses_by_field | Find courses by one field and read what the token user may see of them: id, fullname, shortname, categoryid, categoryname, summary… |
moodle_search_courses | Search the course catalogue by text: per course id, fullname, shortname, categoryid, categoryname, summary, contacts (teachers) and… |
moodle_get_course_contents | Read the content of a course: its sections (id, name, summary, section number, visible) and in each the activities and resources as… |
moodle_list_categories | List course categories: id, name, description, parent (0 at the top level), coursecount, depth and path. Without a filter every category… |
moodle_list_enrolled_users | List the participants of a course: id, username, fullname, email, idnumber, department, lastaccess and lastcourseaccess (Unix seconds)… |
moodle_get_users_by_field | Look up users by id, username, email or idnumber (exact values): id, username, firstname, lastname, fullname, email, department, idnumber… |
moodle_search_users | Search the users of the site by one field: id, username, firstname, lastname, fullname, email, idnumber, department, lastaccess and… |
moodle_get_grade_items | Read the grade report of a course: per user gradeitems with itemname, itemtype (mod, category, course), itemmodule, graderaw… |
moodle_get_course_grades_overview | Read the final grade of a user in every course they are enrolled in: courseid, grade (as displayed) and rawgrade. Use… |
moodle_get_completion_status | Read which activities of a course a user has completed: per activity cmid, modname, instance, state (0 not completed, 1 completed, 2… |
moodle_list_assignments | List the assignments of courses: per course assignments with id, cmid, name, intro, duedate, allowsubmissionsfromdate, cutoffdate… |
moodle_list_assignment_submissions | List the submissions of assignments: per assignment submissions with id, userid, attemptnumber, status (new, draft, submitted, reopened)… |
moodle_list_quizzes | List the quizzes of courses: id, coursemodule, course, name, intro, timeopen, timeclose (Unix seconds, 0 when not set), timelimit in… |
moodle_list_calendar_events | List calendar events: id, name, description, courseid, groupid, userid, modulename, instance, eventtype (user, course, group, site, due… |
moodle_list_upcoming_deadlines | List what the token user has to do next, as on the Moodle timeline: events with an action such as an assignment to submit or a quiz to… |
moodle_list_forums | List the forums of courses: id, course, name, intro, type (news, general, qanda, single and others), cmid, numdiscussions… |
moodle_list_forum_discussions | List the discussions of a forum: per discussion discussion (the discussion id for moodle_get_discussion_posts), name, subject, message of… |
moodle_get_discussion_posts | Read all posts of a forum discussion: id, subject, message (HTML), author (id, fullname), parentid (the post it answers), timecreated… |
moodle_list_conversations | List the private conversations of the token user: id, name, type (1 between two users, 2 group, 3 notes to self), membercount, unreadcount… |
moodle_send_message | Send a private Moodle message from the token user to another user. The recipient is notified as their Moodle preferences say (web, email… |
Example prompts
- "Which assignments are due in my courses this week?"
- "List the participants of course 42 who have not submitted the essay assignment."
- "Show my grade overview across all courses."
- "Which activities of the Biology 101 course have I not completed yet?"
- "Summarise the latest discussions in the course forum."
FAQ
Where does the token come from? A Moodle administrator enables web services and the REST protocol, adds a service with the functions the tools use (the built-in Moodle mobile web service already has all but one), and creates a token for a user under Manage tokens. Users can also use their own mobile service token from Preferences, Security keys when the site allows it. On AnythingMCP Cloud the site must be reachable from the internet over HTTPS.
What can it see? Exactly what the token's user may see: a student token reads its own courses, grades and deadlines; participants, grades of others and submissions need a teacher or manager. It covers courses and content, users, grades, activity completion, assignments and submissions, quizzes, the calendar, forums and private messages, for Moodle 4 and 5, self-hosted or MoodleCloud.
Which tools write, and what installs switched off? Only moodle_send_message writes, it sends a private message. Nothing installs switched off.
Where does Gemini CLI look for MCP servers? In ~/.gemini/settings.json for your user, or in .gemini/settings.json inside a project. gemini mcp list shows each server and whether it connects.
Next steps
Was this guide helpful?