Skip to main content
Glama
canvas-claude-connector

canvas-claude-connector

by bwierzbo
README.md
# canvas-claude-connector

[![CI](https://github.com/bwierzbo/canvas-claude-connector/actions/workflows/ci.yml/badge.svg)](https://github.com/bwierzbo/canvas-claude-connector/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

A small, read-only [MCP](https://modelcontextprotocol.io) server that connects Claude to your [Canvas LMS](https://www.instructure.com/canvas) account so it can answer one question well:

> **What's due, when, and what exactly do I need to do?**

That includes the messy cases, where the real deadline is in the syllabus, a module page or an announcement and the Canvas assignment has no due date at all.

It works with Claude Desktop, Claude Code and claude.ai (as a custom connector), and with any other MCP client.

## What it does

- **One call for "what's due?"** `get_upcoming_deadlines` gathers every active course, sorts by due time, and reports dates in your time zone with your submission status.
- **Finds deadlines hiding in text.** `search_course_content` searches the syllabus, pages, assignment descriptions and announcements, and returns the date phrases it finds next to each match ("Friday, December 11 at 5:00 PM", "Week 15").
- **Points out the gaps.** Unsubmitted assignments with no Canvas due date are listed separately, so Claude knows to go and look for the real date.
- **Full instructions as clean markdown.** Assignment descriptions, syllabi and pages are converted from Canvas HTML, with scripts and styles removed.
- **Read-only.** It only sends `GET` requests. It cannot submit work, post, message anyone or change anything in Canvas.
- **Runs locally or remotely from the same code.** stdio for desktop apps, Streamable HTTP for Vercel, Cloudflare Workers or plain Node.

### Tools

| Tool | What it answers |
|---|---|
| `get_upcoming_deadlines(days=14)` | What is due across all my classes? Also returns recent overdue work and assignments with no due date in Canvas |
| `search_course_content(course_id, query)` | Where does the course mention "midterm", "due" or "late policy"? Searches syllabus, pages, assignments and announcements |
| `list_courses()` | Which courses am I in? Active only by default |
| `list_assignments(course_id, bucket)` | Assignments in one course: `upcoming`, `overdue`, `past`, `undated` or `all`, with due, lock and unlock dates, points and submission status |
| `get_assignment(course_id, assignment_id)` | The full instructions and rubric for one assignment |
| `get_syllabus(course_id)` | The syllabus as markdown |
| `list_modules(course_id)` | Modules and their items in order, with due dates |
| `get_page(course_id, page_url)` | One course page as markdown |
| `list_announcements(course_ids, since)` | Recent announcements, where deadline changes usually appear |
| `list_calendar_events(start, end)` | Calendar events and assignment due dates in a date range |

### Example prompts

- "What's due this week across all my classes?"
- "What exactly do I need to do for the aerodynamics problem set? Is there a rubric?"
- "Does the syllabus for HU 145 say anything about late work?"
- "When is the wind tunnel project due? Canvas doesn't show a date."
- "Did any professor change a deadline in the last few days?"
- "Do I have anything overdue?"
- "Make me a day-by-day plan for the next two weeks based on my deadlines and exam dates."

## Privacy

- The server runs with **your own Canvas access token**, on your computer or on a deployment you control.
- It **stores nothing**: no database, no cache on disk, no analytics, no telemetry. Each request reads from Canvas and returns the result.
- Your token is sent only to your school's Canvas address over HTTPS. It is never logged and never included in tool output or error messages.
- What Claude reads through these tools (course content, due dates, your submission status and grades on individual assignments) becomes part of your conversation with Claude, under the privacy terms of the Claude product you use.
- A Canvas personal access token can do anything your account can do. This server only ever reads, but treat the token like a password: set an expiry date when you create it, and delete it in Canvas if you stop using this.

Check your course's policy on AI tools before using Claude for coursework.

## 1. Create a Canvas access token

1. Log in to Canvas in a browser.
2. Open **Account** (left sidebar) and then **Settings**.
3. Scroll to **Approved Integrations** and click **+ New Access Token**.
4. Give it a purpose such as "Claude", set an expiry date, and click **Generate Token**.
5. Copy the token now. Canvas will not show it again.

Your **base URL** is the address you use to open Canvas, for example `https://erau.instructure.com`.

> **Some schools turn this off.** If there is no "New Access Token" button, your institution has disabled personal access tokens for students and this server cannot connect to that Canvas. Your IT help desk can tell you whether they will enable it.

## 2. Install

You need [Node.js](https://nodejs.org) 20 or newer.

```bash
git clone https://github.com/bwierzbo/canvas-claude-connector.git
cd canvas-claude-connector
npm install     # also builds dist/
```

Note the full path to `dist/stdio.js`; the setups below call it `/path/to/canvas-claude-connector/dist/stdio.js`.

## 3. Connect it to Claude

### Claude Desktop

Open **Settings > Developer > Edit Config** and add the server to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "canvas": {
      "command": "node",
      "args": ["/path/to/canvas-claude-connector/dist/stdio.js"],
      "env": {
        "CANVAS_BASE_URL": "https://yourschool.instructure.com",
        "CANVAS_API_TOKEN": "your-token-here"
      }
    }
  }
}
```

Quit and reopen Claude Desktop. The config file lives at `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS and `%APPDATA%\Claude\claude_desktop_config.json` on Windows.

### Claude Code

```bash
claude mcp add canvas \
  -e CANVAS_BASE_URL=https://yourschool.instructure.com \
  -e CANVAS_API_TOKEN=your-token-here \
  -- node /path/to/canvas-claude-connector/dist/stdio.js
```

Add `--scope user` to make it available in every project. Check it with `claude mcp list`.

### claude.ai (custom connector)

claude.ai connects to servers over the internet, so you deploy the HTTP mode first and then add its URL.

**Deploy.** You set three secrets on the deployment:

| Variable | Value |
|---|---|
| `CANVAS_BASE_URL` | Your school's Canvas address |
| `CANVAS_API_TOKEN` | Your Canvas access token |
| `MCP_AUTH_TOKEN` | A long random secret you make up: `openssl rand -hex 32` |

`MCP_AUTH_TOKEN` is what keeps strangers out. Every request must carry it as `Authorization: Bearer <secret>`, and the server refuses all requests if it is not set.

<details>
<summary><strong>Vercel</strong></summary>

```bash
npm i -g vercel
vercel link
vercel env add CANVAS_BASE_URL production
vercel env add CANVAS_API_TOKEN production
vercel env add MCP_AUTH_TOKEN production
vercel deploy --prod
```

Your endpoint is `https://<your-project>.vercel.app/mcp`. Vercel no longer accepts Node 20 for new deployments; it will pick a newer Node version automatically, which this project supports.

</details>

<details>
<summary><strong>Cloudflare Workers</strong></summary>

Wrangler needs Node 22 or newer on your machine.

```bash
npx wrangler login
npx wrangler secret put CANVAS_BASE_URL
npx wrangler secret put CANVAS_API_TOKEN
npx wrangler secret put MCP_AUTH_TOKEN
npx wrangler deploy
```

Your endpoint is `https://canvas-claude-connector.<your-subdomain>.workers.dev/mcp`.

</details>

<details>
<summary><strong>Any Node host, or your own machine</strong></summary>

```bash
export CANVAS_BASE_URL=https://yourschool.instructure.com
export CANVAS_API_TOKEN=your-token-here
export MCP_AUTH_TOKEN=$(openssl rand -hex 32)
npm run start:http          # http://127.0.0.1:3000/mcp
```

Set `PORT` to change the port and `HOST=0.0.0.0` to accept connections from other machines. Put it behind HTTPS before exposing it to the internet.

</details>

**Check it.** This should list ten tools:

```bash
curl -s https://YOUR-DEPLOYMENT/mcp \
  -H "Authorization: Bearer $MCP_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

**Add it to claude.ai.**

1. Open **Settings > Connectors** and choose **Add custom connector**.
2. Enter a name (for example "Canvas") and your endpoint URL ending in `/mcp`.
3. In the request headers section, add a header named `Authorization` with the value `Bearer <your MCP_AUTH_TOKEN>`.
4. Save, then enable the connector in a chat.

The wording of that dialog changes from time to time; see Anthropic's [custom connector guide](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp) if yours looks different. On Team and Enterprise plans an owner may need to add the connector for the organization.

The same deployment also works from Claude Code:

```bash
claude mcp add --transport http canvas https://YOUR-DEPLOYMENT/mcp \
  --header "Authorization: Bearer <your MCP_AUTH_TOKEN>"
```

One deployment serves one person: it uses the single Canvas token in its environment. Do not share the URL and secret with classmates, because they would be reading your Canvas.

## Configuration

| Variable | Required | Description |
|---|---|---|
| `CANVAS_BASE_URL` | yes | Your Canvas address, e.g. `https://yourschool.instructure.com`. Must be `https://` |
| `CANVAS_API_TOKEN` | yes | Canvas personal access token |
| `CANVAS_TIMEZONE` | no | IANA time zone such as `America/New_York`. Defaults to the time zone set in your Canvas profile, then UTC |
| `MCP_AUTH_TOKEN` | HTTP mode | Secret that callers must send as a bearer token |
| `PORT`, `HOST` | no | For `npm run start:http`. Defaults: `3000`, `127.0.0.1` |

## Troubleshooting

| What you see | What it means |
|---|---|
| "Canvas rejected the access token" | The token is mistyped, expired or deleted. Create a new one. If Canvas has no "New Access Token" button, your school has disabled tokens |
| "does not have permission to view ..." | Your account cannot see that item. The course may be unpublished or concluded, or the instructor restricted it |
| "Canvas could not find ..." | Wrong ID, or the instructor turned that feature off (Pages and Syllabus are often hidden) |
| "answered with something that is not JSON" | `CANVAS_BASE_URL` is not your Canvas address. Use the URL from your browser's address bar when you are in Canvas |
| "Canvas is rate limiting this access token" | Too many requests in a short time. The server already backs off and retries; wait a minute |
| HTTP 401 from your deployment | The `Authorization: Bearer` header is missing or does not match `MCP_AUTH_TOKEN` |
| HTTP 503 from your deployment | `MCP_AUTH_TOKEN` is not set on the deployment |
| Times look wrong | Set your time zone in Canvas (Account > Settings) or set `CANVAS_TIMEZONE` |

## How it works

- **Pagination.** Canvas returns lists in pages; the client follows `Link: rel="next"` headers, and only to the same host so the token cannot be sent elsewhere.
- **Rate limits.** The client watches `X-Rate-Limit-Remaining`, slows down as the quota runs low, and retries throttled requests with exponential backoff.
- **Time zones.** Every date is returned as `{ utc, local }`, where `local` is written out in your time zone ("Thu, Dec 3, 2026, 11:59 PM EST").
- **Stateless HTTP.** Each request is handled independently, which suits serverless hosts.

## Limitations

- It reads Canvas pages, assignments, the syllabus, announcements, modules and the calendar. It does not read uploaded files (PDF or Word syllabi, slides), quiz questions, discussion threads or grades for a whole course.
- Date phrases found in text are returned as written ("Dec 11 at 5 PM"). The server does not guess the year or convert them to timestamps; Claude interprets them in context, and you should confirm anything important with the original page.
- Authentication is a personal access token. Canvas OAuth (a developer key issued by your school) is not implemented yet, so schools that have disabled personal tokens are not supported. The code has a seam for it: `CanvasAuth` in `src/canvas/auth.ts` and `Authenticator` in `src/http.ts`.
- This is an independent project. It is not affiliated with or endorsed by Instructure or Anthropic.

## Contributing

Bug reports, Canvas quirks from your school and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, project layout and ground rules.

```bash
npm install
npm test          # unit tests against a mocked Canvas
npm run lint
npm run typecheck
```

## License

[MIT](LICENSE)