← All work

campus-usc

The USC's Campus Virtual (Moodle) in the terminal and for AI agents: one HTTP engine behind a 30 ms CLI and a 94-tool MCP server, with no browser to download.

Role
Solo project
When
Aug 2026 – present
Stack
Python · httpx · BeautifulSoup · Chrome DevTools Protocol · MCP · keyring · Playwright · GitHub Actions · uv
Links
Diagram: campus and mcp-usc are two faces of the campus-usc-core engine, which reads the USC's Campus Virtual over internal AJAX and HTML pages, with timetables and exams from usc.gal; logging in uses your own browser over the DevTools protocol.

The University of Santiago de Compostela runs its Campus Virtual on Moodle with no student API. campus-usc talks HTTP just like a browser and exposes two thin interfaces over one engine: a fast terminal CLI for people (campus) and a 94-tool MCP server for AI agents. Open source (MIT) and unofficial, with no affiliation to the university.

~30 msper screencached (~1.8 s fresh · ~2.2 s web)
0 MBextra browserreuses installed Chrome/Edge/Brave
94MCP toolsover the same engine as the CLI
3 OSesverified in CILinux, macOS and Windows

Tested live across Computer Science, Mathematics and Medicine, and verified end to end with a second real student account.

Three design decisions

1. No official API → direct HTTP (AJAX + HTML)Same footprint as the web

Moodle's mobile API is disabled at the USC. The engine uses the web session to call internal AJAX endpoints (courses, assignments, files, messages) and parses HTML only where Moodle offers no structured data (grades, forums, quizzes). Timetables and exam dates are fetched on demand from public usc.gal pages for any degree, including phased-out study plans.

2. 2FA sign-in without downloading a browserSilent renewal

Instead of bundling a 160 MB Chromium download, it drives an existing Chromium browser (Chrome, Edge, Brave, Chromium or Helium) over DevTools in an isolated profile that never touches your tabs or passwords, grabs only the session cookie and renews headless afterwards. Playwright remains an optional fallback.

3. Instant cache and safe writes by defaultPreview + confirmation

The CLI paints from local cache and refreshes stale data in the background, firing network calls concurrently over one session. Every write (submitting work, sending messages) requires a preview and a single-use confirmation token, and Campus output is stripped of terminal control characters.

Architecture

A four-package monorepo: the HTTP engine (campus-usc-core), the CLI (campus), the MCP server (mcp-usc) and the optional timetables-and-exams module. A single-command installer detects OS and browser before touching anything, with CI across Linux, macOS and Windows (Python 3.11 and 3.14).