8000 GitHub - zs-andy/lms-cli: Multi-school Canvas, Blackboard & Moodle CLI and default-read-only MCP server (with opt-in audited writes) for any AI agent harness. · GitHub
[go: up one dir, main page]

Skip to content
zs-andyPublic

About

Multi-school Canvas, Blackboard & Moodle CLI and default-read-only MCP server (with opt-in audited writes) for any AI agent harness.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Repository files navigation

lms-cli

lms-cli

Multi-school Canvas, Blackboard & Moodle CLI and default-read-only MCP server (with opt-in, audited upload & write workflows) for Codex, Claude Code, and terminal workflows.

CI Security & CodeQL Release License: MIT Node

English | 简体中文 · Compatibility · Evolution Plan · Roadmap · Discussions


Query courses, announcements, assignments, grades, files, and calendars across Canvas, Blackboard, and Moodle from a single terminal interface — or expose them safely to AI agents via read-only Model Context Protocol (MCP) tools.

Installation, school discovery, profile setup, and updates all happen directly in the terminal. A local sign-in window opens only when your university SSO or MFA requires interactive authentication.

Highlights

  • CLI-first & harness-agnostic (zero plugin required): Any shell-capable third-party agent harness (OpenCode, Cline, Roo Code, Windsurf, Goose, Aider, Claude Code, Codex, Cursor, or custom loops) can self-discover and drive lms natively via lms capabilities --compact, lms guide --mode cli, cross-platform verbs (lms courses, lms announcements, lms grades, lms calendar, lms todo, lms files), single-process lms batch, and --compact JSON — with optional stdio lms mcp and Codex / Claude Code plugins when desired.
  • Multi-school & multi-platform: Search official Canvas school directories, paste any school/course URL (lms setup --url / lms detect), extend the data-driven school catalog (src/data/schools.json or $LMS_HOME/schools.json), or connect Moodle subpath deployments like /moodle.
  • Bilingual sign-in GUI (EN / 中文): The isolated local sign-in window auto-detects OS locale and includes a live EN / 中文 toggle while keeping all CLI/code strictly English.
  • Read-only by default, opt-in tiered writes: Every profile starts strictly readonly. Opt in locally per profile (lms profiles writes <id> --mode draft|standard --yes) to unlock audited file uploads, drafts, assignment submissions, and discussion replies with --dry-run SHA-256 preflight and mandatory --confirm / confirm: true. Quizzes, exams, and raw HTTP remain permanently disabled. See docs/EVOLUTION.md.
  • Local-first security: Sessions and local todos are encrypted on disk with keys managed by your OS keychain (@napi-rs/keyring); SHA-256 verified standalone releases with resumable updates.
  • Deadline tracking & ICS export: Track schedule/deadline changes spotted in announcements and export local todos to .ics calendars.

Architecture

Terminal / Codex / Claude Code / MCP Client
                   │
                   ▼
         cli.ts  /  mcp.ts   ◄── config · auth · local todos
                   │
                   ▼
      backend.ts + policy.ts  (read-only allowlist · schema validation · cache)
                   │
                   ▼
     worker.ts  (isolated per profile × platform) ──► vault.ts (OS keychain)
                   │
                   ▼
    platforms/{canvas,blackboard,moodle}/runtime.ts  ──► University HTTPS API

Every LMS platform is registered once in src/platforms/registry.ts — CLI flags, MCP schemas, login policies, and overview planners are all derived from it. See docs/ARCHITECTURE.md.

Quick Start

1. Install

macOS / Linux:

curl -fsSL --proto '=https' https://raw.githubusercontent.com/zs-andy/lms-cli/main/install.sh | sh

Windows (PowerShell):

& ([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/zs-andy/lms-cli/main/install.ps1).Content))

The installer downloads the matching self-contained archive from GitHub Releases, verifies SHA256SUMS.txt, and installs into your user directory with bundled Node.js — no admin rights, Node, npm, or Git required. Verified Homebrew, Scoop, and Winget manifests are also generated from SHA256SUMS.txt for each release (see packaging/README.md). For unsupported targets, see building from source.

2. Connect Any University (0 → 1)

lms setup

Works for any school — preset or not:

  • Search by school name/domain, or paste any course/dashboard URL straight from your browser (e.g. https://canvas.uni.edu/courses/123, https://learn.uni.edu/ultra/course, https://uni.edu/moodle/my/). lms-cli automatically detects the platform, strips course/login leaf paths (preserving clean Moodle subpaths), and suggests the timezone.
  • Auto-detects installed AI clients (Codex, Claude Code, Cursor) so you can connect your preferred client—or use standalone CLI—without hitting missing-client errors.

Useful shortcuts:

lms setup --url "https://your-school-lms-url"     # One-command auto-detect + setup
lms detect "https://your-school-lms-url"          # Inspect platform & clean base URL
lms setup --client claude --client cursor         # Connect Claude Code / Cursor directly
lms profiles attach --moodle https://uni.edu/moodle  # Add a second platform to a school
lms profiles export-preset --alias "MyUni"        # Export a secret-free preset JSON to share or PR

3. Query Courses, Deadlines & Files (CLI-First or Any Agent Harness)

lms status                                        # Active profile, auth & write policy summary
lms overview --days 7 --fresh                     # Bounded schedule + full announcements across platforms
lms courses --compact                             # Cross-platform fan-out (single-line JSON)
lms announcements --compact
lms batch --calls '[{"tool":"canvas_list_courses"}]' --compact
lms download <file-id> --directory ./downloads    # Relative paths resolved on CLI; never overwrites
lms capabilities --compact                        # Single-shot manifest for third-party harnesses
lms guide --mode cli --out AGENTS.md              # Export live harness-agnostic agent instructions

Use with Claude Code

After running lms setup --no-codex:

claude plugin marketplace add zs-andy/lms-cli
claude plugin install lms-cli@lms-cli

Or register the MCP server directly (do not enable both at once):

claude mcp add --scope user lms -- lms mcp

Read-only lms tools carry MCP read-only annotations; local configuration, login, download, and opt-in write tools (lms_profile_add, lms_profile_attach, lms_profile_use, lms_auth_login, lms_items_upsert, lms_download_file, lms_write) should remain confirmation-gated.

Updates

lms update --check      # Check for a newer stable release
lms update              # Download (with resume & SHA-256 check) and upgrade
lms update --rollback   # Revert to the previous version

Set LMS_UPDATE_CHECK=0 to disable automatic update checks.

Experimental Sign-In Options

When re-authentication is needed, lms-cli always opens your school's genuine SSO/login page. Optional, off-by-default Remember Password and Auto Sign-In toggles are available for standard forms, multi-step sign-in flows, and Microsoft ADFS (such as PolyU). Credentials are encrypted locally only after verified authentication; CAPTCHA, push MFA, and device compliance remain controlled by your school. See docs/USER_GUIDE.md for details and cleanup instructions.

Background Reauthorization

After enabling both Remember Password and Auto Sign-In interactively, scheduled CLI or MCP runs can opt into hidden reauthorization with LMS_AUTH_BACKGROUND=1:

LMS_AUTH_BACKGROUND=1 lms overview --days 7 --fresh
LMS_AUTH_BACKGROUND=1 lms auth login

This keeps the authorization controller, school SSO child windows, and JavaScript dialogs hidden without stealing focus (and suppresses the macOS Dock icon). Each platform is capped at 45 seconds and continues to remaining platforms on failure. Without existing consent—or on MFA, CAPTCHA, network errors, or unsupported forms—it fails closed with state: "cancelled" instead of popping up a window; repair interactively by running lms auth login with LMS_AUTH_BACKGROUND unset. Note that background mode hides windows within a graphical desktop session; headless Linux without a display server (or Xvfb) and OS Secret Service remains unsupported.

Documentation

Contributing

Contributions are very welcome! Great places to jump in:

Run the offline check & test suite locally (no university account required):

npm ci
node node_modules/electron/install.js
npm run check:repo && npm run typecheck && npm test

See CONTRIBUTING.md and CODE_OF_CONDUCT.md before opening a pull request.

Disclaimer & License

Independent community project with no affiliation to any university, Instructure, Anthology, or OpenAI. Connectors build on canvas-student-mcp and blackboard-mcp; see THIRD_PARTY_NOTICES.md.

Licensed under the MIT License.

About

Multi-school Canvas, Blackboard & Moodle CLI and default-read-only MCP server (with opt-in audited writes) for any AI agent harness.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Releases