Skip to main content
Glama
UAB Campus MCP

UAB Campus MCP

by HHBYTe

UAB Campus MCP

CI License: MIT

A Model Context Protocol server for the Universitat Autonoma de Barcelona Campus Virtual (cv.uab.cat) and its yearly Moodle instances (e-aules.uab.cat).

It lets an MCP client inspect the courses already available to a UAB account. It is read-only by default. An experimental, explicitly enabled local stdio mode supports a narrow assignment-submission workflow; see the submission guide. It cannot attempt quizzes, post messages, change enrolment, or call arbitrary Moodle functions.

This is an unofficial community project and is not affiliated with or endorsed by the Universitat Autonoma de Barcelona.

Acceptable use and UAB regulations

This tool acts with your own UAB account, so UAB's rules for its information systems apply to how you use it, in particular the Normativa de seguretat d'utilització dels recursos i sistemes d'informació (Consell de Govern, 10 February 2026). Nothing in it addresses tools like this one specifically. This section is not legal advice; you are responsible for your own use.

  • Use only your own account. UAB accounts are personal and non-transferable (art. 7.7). Never share your tokens.json, use someone else's, or run a server that gives other people access through your account (art. 37.1.b).

  • Course content belongs to its authors. Materials and forum posts are for your own study. Do not redistribute them (art. 10.3).

  • Think before sending Campus content to third parties. Your MCP client may forward tool results to an AI provider. Forum posts and other content can contain other people's personal data; the regulation treats sending protected information to unauthorised external systems as misuse (art. 37.1.n.IV).

  • Keep the load light. Avoid frequent scheduled jobs or bulk downloads that could burden shared systems (art. 37.1.f).

  • Assignment submission is your responsibility. The optional write tools submit work in your name. They are disabled by default; enable them only if you accept that responsibility.

  • How it signs in. The login uses the same Moodle mobile web service as the official Moodle app, with your own sign-in and MFA. UAB enabled that service for its app and may change or restrict it at any time.

Related MCP server: campus-unr-mcp

Tool-first design

Purpose-built tools are the primary interface. Agents should use them before navigating Campus pages because they return smaller structured responses, avoid repeated page discovery, and make multi-step workflows faster and more predictable.

The current tool catalog, ID relationships, and composition examples are kept in the tool guide. MCP clients can also discover the active catalog directly through the standard tools/list operation.

The server is intentionally only the Campus bridge. Scheduling, downloaded content organization, to-do synchronization, summaries, and notifications are client-owned workflows. See the client workflow guide for practical patterns and the boundary between the MCP and downstream automation.

If the tools do not cover a task, a client that separately has authenticated browser access may fall back to the normal Campus interface. That fallback is outside this MCP and does not expose arbitrary Moodle API calls. Repeated missing reads are candidates for new elemental tools.

Requirements

  • A valid UAB account with Campus Virtual access

  • Node.js 20 or newer

  • Git

  • Chromium or Chrome for the one-time interactive login

The authentication script opens the official UAB pages. You enter your account and complete Microsoft MFA in the browser yourself. This project never asks for, reads, or stores your password.

Local setup

1. Install

git clone https://github.com/HHBYTe/uab-campus-mcp.git
cd uab-campus-mcp
npm ci --include=dev

The explicit --include=dev is required because the authentication and build tools are development dependencies. It also works when npm is configured to omit development packages by default.

2. Authenticate

Choose one browser option.

To use Playwright's bundled Chromium:

npx playwright install chromium
npm run auth

To use an existing Chrome installation on Linux or macOS:

UAB_BROWSER_CHANNEL=chrome npm run auth

On Windows PowerShell:

$env:UAB_BROWSER_CHANNEL="chrome"
npm run auth

To use any other Chromium-based browser already installed, such as the chromium package of many Linux distributions, pass its executable path:

UAB_BROWSER_EXECUTABLE=/usr/bin/chromium-browser npm run auth

Use the path on your system (command -v chromium chromium-browser finds it on Linux). On Windows PowerShell, set $env:UAB_BROWSER_EXECUTABLE to the full .exe path before npm run auth.

Sign in in the opened browser and complete MFA. The script discovers the academic years available to your account, signs in to each Moodle instance, and writes data/tokens.json. The token file and persistent browser profile are ignored by Git and must remain private.

Verify the tokens:

npm run auth:check

For a broader local health report, use npm run doctor. Add --live to validate every configured academic year against UAB:

npm run doctor
npm run doctor -- --live
npm run doctor -- --live --json

The JSON report omits tokens, identities, and private paths, so it is suitable for attaching to a bug report after reviewing it. Local warnings do not fail the command; configuration or live authentication errors do.

The portal normally discovers available years automatically. To refresh a specific year that is not linked there, pass it explicitly:

npm run auth -- 2026-27

3. Build

npm run build

4. Add it to an MCP client

Use absolute paths. A typical stdio configuration is:

{
  "mcpServers": {
    "uab-campus": {
      "command": "node",
      "args": ["/absolute/path/uab-campus-mcp/dist/index.js"],
      "env": {
        "UAB_TOKEN_FILE": "/absolute/path/uab-campus-mcp/data/tokens.json"
      }
    }
  }
}

Windows paths in JSON need escaped backslashes:

{
  "command": "node",
  "args": ["C:\\Users\\you\\uab-campus-mcp\\dist\\index.js"],
  "env": {
    "UAB_TOKEN_FILE": "C:\\Users\\you\\uab-campus-mcp\\data\\tokens.json"
  }
}

For Claude Code, register the same command and environment variable from a terminal instead of editing JSON:

claude mcp add uab-campus --scope user \
  -e UAB_TOKEN_FILE=/absolute/path/uab-campus-mcp/data/tokens.json \
  -- node /absolute/path/uab-campus-mcp/dist/index.js

--scope user makes the server available in every project; omit it to register it only for the current directory. claude mcp list should then show uab-campus as connected.

Restart the MCP client, then ask it to list uab-campus tools or call campus_list_years.

Updating

To move an existing installation to a newer version, pull, reinstall, rebuild, and restart the MCP client:

git pull
npm ci --include=dev
npm run build

Your UAB tokens are kept. See the changelog for what changed in each version. The updating guide covers self-hosted deployments, clients that cache the tool list, and rolling back.

Self-hosted setup

Remote and server deployments are covered in the self-hosting guide.

Renewing UAB authentication

If npm run auth:check reports an expired token, run the interactive flow again:

npm run auth
npm run auth:check

For a remote deployment, replace its tokens.json with the refreshed file. The MCP process rereads the file on every tool call, so it does not need to be restarted.

Configuration

Variable

Default

Purpose

UAB_TOKEN_FILE

data/tokens.json

Absolute token-file path

UAB_REQUEST_TIMEOUT_MS

30000

Moodle request timeout, 1-120 seconds

UAB_BROWSER_EXECUTABLE

Playwright Chromium

Explicit browser executable

UAB_BROWSER_CHANNEL

unset

Browser channel such as chrome

MCP_HOST

127.0.0.1

HTTP listen address

MCP_PORT

3000

HTTP listen port

MCP_HTTP_TOKEN

required for HTTP

Bearer secret, at least 32 characters

MCP_ALLOWED_HOSTS

local hostnames

Comma-separated accepted HTTP hosts

Security model

  • MCP tools are read-only by default. Optional assignment-write tools are enabled only through explicit local stdio configuration and annotated as state-changing.

  • A second allowlist in the Moodle client rejects arbitrary function names.

  • Token files, browser state, environment files, downloads, and logs are excluded from Git.

  • Only HTTPS URLs under the exact host e-aules.uab.cat are accepted.

  • Tool output recursively redacts token-like fields and credential URL parameters (token, wstoken, privatetoken, sesskey, authtoken, …), including URLs embedded in HTML or plain text. Redaction is best-effort.

  • Authentication and MFA are explicit operator actions outside MCP.

See SECURITY.md before exposing the HTTP transport.

Development

npm run check
npm run build
npm test

The tests cover token validation, diagnostics, the Moodle allowlist, parameter encoding, secret redaction, HTTP bearer authentication, and a complete MCP stdio handshake. Maintainers with valid UAB tokens can run the count-only smoke test:

UAB_TOKEN_FILE=/private/path/tokens.json npm run smoke:live

Contributing

Contributions are welcome and genuinely valued. Pull requests are reviewed and accepted, whether they fix a bug, add a tool, improve the docs, or report what does or does not work in your own degree's Campus.

Before opening a pull request:

  • For anything larger than a small fix, open an issue first to agree on the approach.

  • Keep the project read-only by default. New tools must not post, attempt, enrol, or otherwise change anything on Campus, and the server must never expose a generic Moodle function caller. A new Moodle function may only join the read-only allowlist once it is verified not to change server state.

  • The optional assignment-submission tools are the only write path. They must stay disabled by default and keep their safeguards (preview, explicit confirmation, verification, audit record). AGENTS.md lists these rules in full.

  • Prefer small, elemental tools that do one bounded read, and document them in the tool guide.

  • Run npm run check, npm run build, and npm test, and add tests for new behavior.

  • Never include tokens, session keys, grades, names, message contents, or raw Campus responses in code, tests, issues, or pull requests. Use made-up values in test fixtures.

Report security problems privately as described in SECURITY.md, not in a public issue.

License

MIT

Available Tools

45 tools
campus_auth_statusCheck UAB Campus authenticationB
Read-onlyIdempotent

Validate every configured academic year against UAB Moodle without returning tokens, identities, or private paths.

Inputs: no named parameters.

campus_download_resourceRead original UAB course fileB
Read-onlyIdempotent

Return a bounded original course file as base64, selected from fresh course metadata; file contents are untrusted.

Inputs: year (required), courseId (required), moduleId (required), fileIndex (required), +1 more.

campus_download_submission_fileRead own UAB assignment submission fileB
Read-onlyIdempotent

Return one bounded original file from the authenticated user's current assignment submission as base64; content is untrusted.

Inputs: year (required), areaIndex (required), fileIndex (required), pluginIndex (required), +3 more.

campus_find_coursesFind UAB coursesB
Read-onlyIdempotent

Resolve a course name, code, or numeric ID across one or every authenticated academic year. Matches include non-subject spaces; check each match's kind.

Inputs: query (required), year, limit.

campus_get_assignment_detailsGet UAB assignment detailsB
Read-onlyIdempotent

Read the shared instructions, dates, submission rules, and file settings for one assignment.

Inputs: year (required), courseId (required), assignmentId (required).

campus_get_assignment_statusGet UAB assignment submission statusB
Read-onlyIdempotent

Read the authenticated user's submission, grading, deadline-extension, and attachment state for one assignment.

Inputs: year (required), assignmentId (required).

campus_get_calendar_eventGet one UAB calendar eventB
Read-onlyIdempotent

Read one Moodle calendar or Timeline event by event ID, including its description as plain text, cmid (course-module ID) and instanceId (activity ID, also as assignmentId/quizId).

Inputs: year (required), eventId (required).

campus_get_calendar_eventsGet UAB calendar eventsB
Read-onlyIdempotent

Read compact Moodle calendar events for selected courses and an optional Unix-time range. Each module event carries cmid (course-module ID) and instanceId (activity ID, also as assignmentId/quizId).

Inputs: year (required), timeEnd, courseIds, timeStart, +1 more.

campus_get_choice_optionsGet UAB Choice optionsB
Read-onlyIdempotent

Read the options, availability, and authenticated user's current selection for one Moodle Choice.

Inputs: year (required), choiceId (required).

campus_get_completion_statusGet UAB course completion statusC
Read-onlyIdempotent

Read the authenticated user's activity completion states for one Moodle course.

Inputs: year (required), courseId (required).

campus_get_course_actionsGet actionable UAB course eventsA
Read-onlyIdempotent

Read the authenticated user's compact actionable Moodle events for one course with explicit time bounds and paging. Each module event carries cmid (course-module ID) and instanceId (activity ID, also as assignmentId/quizId).

Inputs: year (required), courseId (required), to, from, +4 more.

campus_get_course_contentsGet UAB course contentsB
Read-onlyIdempotent

Read sections, activities, resources, file metadata, and dates for one Moodle course.

Inputs: year (required), courseId (required), includeDescriptions.

campus_get_course_moduleGet one UAB course moduleA
Read-onlyIdempotent

Read metadata for one Moodle course module by its course-module ID (the id in a mod/...view.php?id= URL, or moduleId from campus_list_resources). Hidden or restricted modules, and modules in courses you are not enrolled in, fail with requireloginerror.

Inputs: year (required), moduleId (required).

campus_get_discussion_postsGet UAB discussion postsC
Read-onlyIdempotent

Read the root post and replies from one Moodle forum discussion.

Inputs: year (required), discussionId (required), page, perPage, +1 more.

campus_get_forum_discussionsGet UAB forum discussionsA
Read-onlyIdempotent

Read one Moodle forum's discussions without posting or changing subscriptions. Root messages are shortened; use campus_get_discussion_posts for full text.

Inputs: year (required), forumId (required), page, perPage, +1 more.

campus_get_grade_overviewGet UAB grade overviewA
Read-onlyIdempotent

Read the authenticated user's overall grade for each enrolled subject in one academic year. Each row carries the course name and kind; non-subject spaces (degree coordination, student council, university info) are hidden unless includeNonSubjects is true.

Inputs: year (required), includeNonSubjects.

campus_get_gradesGet UAB gradesB
Read-onlyIdempotent

Read the authenticated user's grade items for one Moodle course.

Inputs: year (required), courseId (required).

campus_get_group_choice_optionsGet UAB Group Choice optionsA
Read-onlyIdempotent

Read group options, capacity counts, and only the authenticated user's current selection for one Group Choice activity.

Inputs: year (required), groupChoiceId (required).

campus_get_h5p_attemptsGet personal UAB H5P attemptsB
Read-onlyIdempotent

Read the authenticated user's attempt summaries for one H5P activity.

Inputs: year (required), h5pActivityId (required).

campus_get_h5p_resultsGet personal UAB H5P resultsB
Read-onlyIdempotent

Read report data for selected H5P attempt IDs, or all attempts belonging to the authenticated user.

Inputs: year (required), h5pActivityId (required), attemptIds.

campus_get_my_groupsGet personal UAB course groupsB
Read-onlyIdempotent

Read the authenticated user's group memberships in one Moodle course.

Inputs: year (required), courseId (required).

campus_get_pageGet one UAB Moodle pageB
Read-onlyIdempotent

Read the title, description, and instructional content of one Moodle Page activity.

Inputs: year (required), pageId (required), courseId (required).

campus_get_private_files_infoGet UAB private-file usageA
Read-onlyIdempotent

Read the authenticated user's private-file counts and storage usage without listing or changing files.

Inputs: year (required).

campus_get_profileGet UAB Moodle profileB
Read-onlyIdempotent

Read the authenticated user's basic profile and the available read-only capabilities for one academic year.

Inputs: year (required).

campus_get_quiz_attemptsGet personal UAB quiz attemptsB
Read-onlyIdempotent

Read the authenticated user's attempt history for one quiz without starting or changing an attempt.

Inputs: year (required), quizId (required), status.

campus_get_quiz_best_gradeGet personal UAB quiz best gradeC
Read-onlyIdempotent

Read the authenticated user's best recorded grade for one quiz.

Inputs: year (required), quizId (required).

campus_get_scorm_attempt_countCount personal UAB SCORM attemptsB
Read-onlyIdempotent

Count the authenticated user's attempts for one SCORM activity.

Inputs: year (required), scormId (required), completedOnly.

campus_get_scorm_structureGet UAB SCORM structureB
Read-onlyIdempotent

Read the organizations and SCO items contained in one SCORM package without launching it.

Inputs: year (required), scormId (required), organization.

campus_get_scorm_tracksGet personal UAB SCORM trackingA
Read-onlyIdempotent

Read the authenticated user's completion, score, and timing tracks for one SCO and attempt.

Inputs: year (required), scoId (required), attempt.

campus_get_unread_notification_countCount unread UAB notificationsA
Read-onlyIdempotent

Return the authenticated user's unread Moodle notification counts. count covers every unread notification whatever its delivery channel (forum posts and assignment reminders are often email-only); popupCount covers only notifications delivered to the web bell, which is what campus_list_notifications lists and its unreadcount reports.

Inputs: year (required).

campus_get_upcoming_actionsGet upcoming UAB actionsB
Read-onlyIdempotent

Read compact upcoming actionable Moodle events ordered by due time. Each module event carries cmid (course-module ID) and instanceId (activity ID, also as assignmentId/quizId).

Inputs: year (required), from, limit, includeDescriptions.

campus_list_assignmentsList UAB assignmentsA
Read-onlyIdempotent

Read assignment IDs, dates, grades, and submission rules for one or more Moodle courses. Intros are shortened; use campus_get_assignment_details for full instructions.

Inputs: year (required), courseIds (required).

campus_list_booksList UAB Moodle BooksA
Read-onlyIdempotent

Read Moodle Book metadata and navigation settings for one course.

Inputs: year (required), courseId (required).

campus_list_choicesList UAB Choice activitiesB
Read-onlyIdempotent

Read standard Moodle Choice activities and their availability rules for one course.

Inputs: year (required), courseId (required).

campus_list_coursesList enrolled UAB coursesA
Read-onlyIdempotent

List the authenticated user's enrolled subjects for one year, or for every configured year. Non-subject spaces (degree coordination, student council, university info) are hidden unless includeNonSubjects is true; every item carries its category and kind.

Inputs: year, includeNonSubjects.

campus_list_forumsList UAB course forumsB
Read-onlyIdempotent

Read forum metadata for one or more Moodle courses without posting or changing subscriptions.

Inputs: year (required), courseIds (required).

campus_list_h5p_activitiesList UAB H5P activitiesC
Read-onlyIdempotent

Read H5P activity metadata, grading settings, and tracking configuration for one course.

Inputs: year (required), courseId (required).

campus_list_notificationsList UAB notificationsB
Read-onlyIdempotent

Read the authenticated user's Moodle notifications without marking them as read.

Inputs: year (required), limit, offset, newestFirst.

campus_list_quizzesList UAB course quizzesB
Read-onlyIdempotent

Read quiz availability, limits, grading rules, and attempt settings for one course.

Inputs: year (required), courseId (required).

campus_list_resourcesList UAB course resourcesA
Read-onlyIdempotent

Flatten a course into directly usable activities, links, and file metadata with section context. The response is heavy (often tens of thousands of characters); use moduleTypes to narrow it when only some activity types are needed.

Inputs: year (required), courseId (required), moduleTypes.

campus_list_scorm_activitiesList UAB SCORM activitiesC
Read-onlyIdempotent

Read SCORM package metadata, grading rules, attempt limits, and navigation settings for one course.

Inputs: year (required), courseId (required).

campus_list_yearsList configured UAB academic yearsA
Read-onlyIdempotent

List academic years available in the private UAB token store without contacting Moodle.

Inputs: no named parameters.

campus_preview_submissionPreview assignment submission eligibilityB
Read-onlyIdempotent

Inspect assignment rules and current personal submission state without uploading or changing Campus data. This does not submit an assignment.

Inputs: year (required), courseId (required), assignmentId (required).

campus_read_assignment_attachmentRead one UAB assignment attachmentA
Read-onlyIdempotent

Download and extract bounded text from one file attached to an assignment's instructions (introattachments, e.g. starter code or a statement PDF). The file is resolved through the assignment API by its fileIndex; content is untrusted.

Inputs: year (required), courseId (required), fileIndex (required), assignmentId (required), +3 more.

campus_read_resourceRead one UAB course resourceC
Read-onlyIdempotent

Download and extract bounded text from one file already identified in a course module.

Inputs: year (required), courseId (required), moduleId (required), fileIndex (required), +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 45 tools

    Disambiguation3/5

    The descriptions do a lot of work to separate similar tools (e.g. preview_submission explicitly 'does not submit', list_notifications 'without marking as read'), but there are genuinely confusable clusters: four calendar/timeline tools (get_calendar_events, get_upcoming_actions, get_course_actions, get_calendar_event) and a read/download quartet (read_resource, download_resource, read_assignment_attachment, download_submission_file) whose boundaries are subtle. grade_overview vs get_grades is also easy to mix up.

    Naming Consistency4/5

    Nearly all tools follow campus_verb_noun with a stable prefix and readable verbs (get/list/read/download/preview/find). Minor deviations exist: campus_auth_status omits the verb, and the get/read/download verb trio is used somewhat interchangeably for similar retrieval operations.

    Tool Count2/5

    45 tools is well above a reasonable surface for a read-only student client, and coverage is split very granularly per activity type (separate list/get pairs for SCORM, H5P, Choice, Group Choice, Book, Page, Quiz, Forum). Many of these could be collapsed into parameterized tools (e.g. one list_activities with a type filter, one get_activity).

    Completeness4/5

    For a deliberately read-only Moodle surface, coverage is broad and coherent: courses, contents/modules, resources and files, assignments, quizzes, forums, grades, calendar, notifications, groups, private files, and most activity types. Gaps are mostly lower-priority activity types (lesson, wiki, glossary, database, workshop, feedback) and a dedicated single-course lookup, but core student workflows are covered with no dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      MCP server for the Moodle-based Campus Virtual FCEIA UNR, providing tools to read courses, assignments, forums, and grades, plus write operations (posting, grading, messaging, events) with dry-run safety.
      20
      1
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      A remote, read-only MCP server for the Campus Virtual Interactiva Moodle that enables querying courses, upcoming work, calendar events, grades, and course resources without storing institutional credentials.
      -