Skip to main content
Glama

canvas-mcp

A read-only cache of your Canvas LMS courses, served to AI assistants over the Model Context Protocol. Point Claude, ChatGPT or any MCP client at it and ask "what's due this week?", "what do I need on the final for a B?" or "find the lecture on molecular orbitals".

It is plain Python (standard library plus one vendored, hash-pinned wheel), built to run as a small Kubernetes pod but usable anywhere.

What it does

  • Syncs on a schedule (default 30 minutes) with your personal Canvas API token: courses, grades, assignment groups and rubrics, submission comments, modules, pages, announcements, calendar events, missing work and course files. Hidden Files/Pages tabs are worked around by following module items and links in the syllabus, pages and assignments. Every request is a GET; the token is sent only to your Canvas host and never to file-download redirects.

  • Keeps an archive: courses that leave your active list at the end of a term stay in the cache, with their files.

  • Serves MCP tools that read only the cache, never Canvas: upcoming and missing work, grades and grade projection, exams, calendar, feedback, syllabus, pages, modules, files and search. Nothing can submit, message or change anything in Canvas.

  • Extracts and indexes documents: text from PDFs (via pypdf) and text files, searchable by keyword and by meaning (hybrid search with a small static embedding model, no GPU or model server).

  • Optionally notifies through ntfy, only about what Canvas does not tell you itself: a morning digest of work due in 48 hours, newly missing work, letter-grade cutoff crossings and exam reminders.

Related MCP server: Canvas LMS MCP Server

Tools

Tool

Purpose

canvas_status

Last sync time and whether the token still works

list_courses

Credit courses and current scores

get_upcoming_assignments

Work due in the next N days, with state, platform and completion

get_missing_assignments

Work Canvas marks missing

get_grades

Scores per course or per assignment

project_grade

Average needed on remaining work per letter cutoff

get_recent_announcements

Announcements

get_recent_changes

Pages, files, assignments, grades and announcements changed recently

get_course_modules

Course structure, filterable by module or week

get_page, get_syllabus

Page and syllabus text with resolved links

get_assignment

Instructions, rubric with your scores, feedback, submission status

get_feedback

Recent instructor comments and rubric notes

get_exam_schedule, get_calendar

Exams (from the calendar, assignments and syllabus text) and one timeline

list_course_files, read_course_file

Files, as documents or extracted text by page

search_course_materials

Hybrid keyword + semantic search with page citations

Every result carries synced_at and is returned both as JSON text and as MCP structuredContent.

Facts, inferences and unknowns

Tools keep three things apart, so an agent does not present a guess as fact:

  • Assignment state is graded, graded but hidden, submitted and ungraded, missing, past due with unknown status, or upcoming. Work done outside Canvas (Gradescope, PrairieLearn, a Google Form) has completion: "unknown", never "nothing to do".

  • Grade projections separate graded, remaining and unknown work. They apply Canvas drop rules and accept syllabus policy that Canvas lacks (group_weights, group_rules, future_work), and report projection_complete only when nothing is unknown.

  • Exam dates read from syllabus text are marked confidence: "syllabus text" with their sources. The year comes from the text or the page title before the term, and stated weekdays are checked. coverage says what was searched: no exams found does not mean no exams.

Running it

# 1. Sync (needs a Canvas token in $CANVAS_CREDENTIALS/token)
CANVAS_BASE_URL=https://canvas.example.edu \
CANVAS_CREDENTIALS=./credentials CANVAS_DATA=./data CANVAS_DEPS=./vendor \
  python app/canvas_sync.py once

# 2. Serve MCP over stdio for a local client
CANVAS_DATA=./data python app/canvas_mcp.py

For Claude Code: claude mcp add canvas -- python /path/to/app/canvas_mcp.py (with CANVAS_DATA set). python app/canvas_sync.py serve keeps syncing and exposes Prometheus metrics on port 9464 (/metrics, /healthz).

Remote clients (ChatGPT)

python app/canvas_mcp.py serve-http serves streamable HTTP on POST /mcp (port CANVAS_MCP_PORT, default 8080). It is meant to sit behind Cloudflare Access with managed OAuth. Every request must carry an Access JWT, which the server verifies itself (RS256 against the team's keys, issuer, expiry, allowed emails). Set CANVAS_ACCESS_TEAM (e.g. yourteam.cloudflareaccess.com) and CANVAS_ACCESS_EMAILS, and optionally CANVAS_ACCESS_AUD.

For ChatGPT, allow both of its OAuth callbacks in the Access app's dynamic client registration: https://chatgpt.com/connector_platform_oauth_redirect and https://chatgpt.com/connector/oauth/*. Access does not advertise RFC 9207 issuer identification, so ChatGPT uses the per-connection one.

Configuration

Variable

Default

Meaning

CANVAS_BASE_URL

https://canvas.wisc.edu

Your Canvas host

CANVAS_CREDENTIALS

/credentials

Directory with token and optional expires (YYYY-MM-DD)

CANVAS_DATA

/data

Cache directory

CANVAS_SYNC_INTERVAL

1800

Seconds between syncs

CANVAS_MAX_FILE_MB, CANVAS_FILES_BUDGET_GB

50, 8

Download limits

CANVAS_DEPS

/deps

Directory with vendor/ contents (pypdf)

CANVAS_MODEL

$CANVAS_DATA/models/potion-base-8M

Embedding model, downloaded once and hash-checked

CANVAS_NTFY_URL, CANVAS_NTFY_TOKEN_FILE

unset, /ntfy/token

ntfy topic URL and token; notifications are off without a URL

Defaults lean toward UW–Madison (base URL, letter scale A 93 / AB 88 / B 83 / BC 78 / C 70, subject aliases such as CS 354 → COMPSCI). Pass targets to project_grade for other scales.

Student API tokens may be short-lived. With CANVAS_CREDENTIALS/expires set, the metrics expose the expiry, so you can alert before it lapses. The token file is re-read every cycle, so rotating it needs no restart.

Supply chain

  • Runtime dependencies are the Python standard library plus vendor/pypdf-7.1.0-py3-none-any.whl. Its SHA-256 is pinned in vendor/manifest.json and checked before import.

  • The embedding model (minishlab/potion-base-8M, MIT) is fetched from a fixed revision and refused if either file's SHA-256 differs (FILES in app/canvas_semantic.py). No neural network runs at query time: a text's vector is the normalized mean of its WordPiece tokens' rows.

Development

python -m unittest discover -s tests -v

The tests are offline: Canvas, ntfy, Cloudflare Access and the embedding model are all faked. A tiny generated model checks the tokenizer and index, and a throwaway RSA key checks JWT verification.

License

MIT

Available Tools

18 tools
canvas_statusA

When Canvas data was last synced and whether the API token still works.

Inputs: no named parameters.

get_assignmentA

One assignment in full: instructions, links, rubric, dates, attempts, whether it needs a Canvas submission, and your submission status.

Inputs: course (required), assignment (required).

get_calendarA

One timeline for the next N days: Canvas calendar events, assignment deadlines (with submission status) and exams found in syllabus text.

Inputs: days, course.

get_course_modulesA

A course's modules and their items, in order. Filter with module (name or week number, e.g. '14'); detail='summary' lists modules with item counts only, to save context.

Inputs: course (required), detail, module.

get_exam_scheduleA

Upcoming exams across courses (or one course): from the Canvas calendar and exam assignments (confidence 'canvas') and from dates in syllabi, syllabus PDFs and course pages (confidence 'syllabus text': confirm before relying on them). Exams carry kind (exam or makeup exam), start_at/end_at in Central time when the text gives a time, and structured sources (file_id, page_number, url). coverage says what was searched per course: no exams found is not no exams.

Inputs: course, include_past.

get_feedbackA

Instructor comments and rubric notes on your submissions from the last N days, newest first. get_assignment shows one assignment's feedback with per-criterion scores.

Inputs: days, course.

get_gradesB

Canvas current scores for every course, or graded work for one course.

Inputs: course, include_other.

get_missing_assignmentsC

Assignments Canvas marks as missing.

Inputs: no named parameters.

get_pageB

The text of a course page by its title or URL slug (from get_course_modules).

Inputs: page (required), course (required).

get_recent_announcementsC

Announcements posted in the last N days.

Inputs: days, course, include_other.

get_recent_changesA

What changed in the last N days: pages and files updated, assignments posted or edited, grades entered and announcements. Catches updates instructors post on pages instead of announcements. Each event has a stable id; poll with since (an ISO timestamp) instead of days.

Inputs: days, since, course, include_other.

get_syllabusA

A course's syllabus text with its links. Linked Canvas files and files named like a syllabus come back with file ids for read_course_file.

Inputs: course (required).

get_upcoming_assignmentsA

Assignments due in the next N days. Each has state (graded, graded_hidden, submitted_ungraded, missing, past_due_unknown, upcoming), requires_student_action (true/false/null = unknown), requires_canvas_submission, submission_platform (canvas, gradescope, prairielearn, google form, ...) and completion (done/not_done/unknown). Work outside Canvas has completion 'unknown': do not drop it from to-do lists.

Inputs: days, course, include_other.

list_course_filesC

Files in a course (slides, PDFs, notes), optionally filtered by name or folder.

Inputs: course (required), query.

list_coursesB

Credit courses in the cache with their current Canvas score; archived courses are from past terms.

Inputs: include_other.

project_gradeA

Current percentage and the average needed to reach each letter cutoff (UW scale by default). Work is graded, remaining, or unknown (done or past due but score hidden/ungraded/missing; never counted as remaining). Canvas drop rules apply; weighted groups with nothing posted count as remaining. Supply syllabus policy Canvas lacks with future_work, group_weights and group_rules; duplicates of Canvas work are rejected. Present letters as definitive only when projection_complete is true; with unknown scores, needed_average_on_unscored_percent replaces needed_average_on_remaining_percent.

Inputs: course (required), targets, future_work, group_rules, +1 more.

read_course_fileA

Contents of a cached course file by id: the document itself (PDFs up to 10 MiB), or with as_text its extracted text per page, which also works for larger PDFs. Narrow long documents with first_page/last_page.

Inputs: file_id (required), as_text, last_page, first_page.

search_course_materialsA

Search syllabi, pages, assignment instructions, announcements, module items, file names and the text inside cached PDFs; hits cite file_id and page_number. mode=hybrid (default) fuses keyword matches (every term present) with semantic matches by meaning, so 'how electrons bond in molecules' finds molecular-orbital lectures; keyword or semantic alone are available. Each hit says how it matched; semantic hits carry a confidence (high/medium/low), and queries made only of words the model does not know return no semantic hits. Identical text in several files is one hit listing the others in also_in.

Inputs: query (required), mode, limit, course, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target distinct resources (courses, grades, modules, pages, files, syllabus, feedback, exams), and descriptions actively disambiguate near-neighbors like get_recent_changes vs get_recent_announcements or get_assignment vs get_missing_assignments. The main overlap is among the time-window tools (get_upcoming_assignments, get_calendar, get_exam_schedule, get_missing_assignments), which a careful agent can separate but could occasionally misselect.

    Naming Consistency4/5

    Strong, predictable snake_case verb_noun pattern throughout (list_courses, get_assignment, read_course_file, search_course_materials). Only minor deviations break the pattern: canvas_status (noun-only) and project_grade (verb without a clear get_ prefix).

    Tool Count4/5

    At 18 tools the set is on the high end of the comfortable band, but each tool maps to a distinct Canvas surface (courses, assignments, grades, files, pages, modules, exams, calendar, search, status). No tool appears redundant filler, so the count is justified for an LMS domain.

    Completeness4/5

    Coverage is broad for a read-only student workflow: courses, assignments, grades and projections, modules, pages, syllabus, files, cross-material search, exams, calendar, feedback, and sync status. The notable gap is the absence of any write/submission actions (submit assignment, post, mark done), so lifecycle coverage is complete for reading but not for acting.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers