Skip to main content
Glama
README.md
# Canvas Bridge

**Live:** https://canvas-bridge-ox.vercel.app

A hosted [MCP](https://modelcontextprotocol.io) connector that lets anyone add their Canvas LMS account to Claude by pasting one URL. Nothing to install, and **no database**: the server stores nothing about its users.

Ask Claude things like:

- "What's due this week across all my courses?"
- "Show me the rubric for my essay assignment"
- "What feedback did I get on my last submission?"
- "Any new announcements in Business Finance?"

## For students: add it to Claude

1. In Claude, open **Settings → Connectors** and click **Add custom connector**.
2. Name it **Canvas** and paste the connector URL: `https://canvas-bridge-ox.vercel.app/mcp`
3. Click **Connect**. On the page that opens, enter your Canvas web address (for example `canvas.yourschool.edu`) and a Canvas access token.

To get a token: in Canvas, click your profile picture → **Settings** → **Approved Integrations** → **+ New Access Token**.

To disconnect, delete that token in Canvas. It stops working everywhere at once.

> Only enter your token on the page that opens after **you** click Connect in Claude. If someone sends you a sign-in link, don't use it.

## Tools

19 tools. The 4 write tools are annotated `readOnlyHint: false, destructiveHint: true` so Claude treats them as actions. Users can set them to "Needs approval" in the connector settings.

| Read | Write |
|---|---|
| `list_courses`, `get_course`, `list_assignments`, `get_assignment`, `get_rubric`, `get_submission`, `list_modules`, `list_announcements`, `list_discussions`, `get_discussion_entries`, `find_assignments_by_due_date`, `get_upcoming_assignments`, `get_overdue_assignments`, `search_course_content`, `get_all_upcoming_work` | `submit_assignment`, `upload_file` (uploads only, unless `submit_after_upload: true`), `post_discussion_entry`, `reply_to_discussion` |

## How it works

```
Claude ──(1) register / authorize──▶ Canvas Bridge ──(2) sign-in page──▶ student enters Canvas URL + token
   ▲                                       │  checks the token with Canvas (/api/v1/users/self)
   └──────(3) code → tokens ◀──────────────┘  seals {Canvas URL, token} into the OAuth tokens (AES-256-GCM)

Claude ──(4) POST /mcp + Bearer token──▶ Canvas Bridge opens the token, calls Canvas as that student
```

- **Stateless OAuth 2.1** with PKCE and dynamic client registration, built on the MCP TypeScript SDK's auth router. Client registrations, sign-in forms, codes, access tokens and refresh tokens are all sealed with AES-256-GCM. Each kind uses its own associated data, so one can never be used as another.
- **The Canvas token lives only inside the OAuth tokens that Claude holds** for that person's connection. The server keeps no database and writes no logs of request bodies. Its only secret is `SEAL_KEY`.
- **Access tokens last 1 hour, refresh tokens 90 days.** The Canvas token's own expiry still applies.

## Security

What's built in:

- **Only Claude can receive sign-ins.** Client registration only accepts redirect URIs on `claude.ai` / `claude.com` (configurable). This stops anyone from using this sign-in page to phish tokens for their own site.
- **SSRF protection.** The Canvas address must be public HTTPS (no IPs, `localhost` or internal names). Every outbound connection checks the resolved IP when it connects, so DNS rebinding to private ranges (including cloud metadata `169.254.169.254` and IPv4-mapped IPv6 forms) is refused. Pagination links are only followed on the same Canvas host. File-upload redirects only go back to the Canvas host.
- **Codes and tokens are bound to the client** that requested them. PKCE (S256) is required, and `redirect_uri` and `resource` must match.
- **Pages say up front that they are independent** of Instructure and Anthropic, and use an original logo, not Canvas's.
- **Pages run no JavaScript.** Strict CSP (`default-src 'none'`), `frame-ancestors 'none'`, `Referrer-Policy: no-referrer` and HSTS. All dynamic text is HTML-escaped.
- **Rate limits.** The sign-in form allows 10 attempts per 15 minutes per IP, and the SDK limits registration and token requests.
- **Upload safety.** `upload_file` no longer auto-submits.
- **Tested.** `npm test` runs the whole OAuth flow plus the attack cases against a mock Canvas.

What you should know (the honest limits):

1. **`SEAL_KEY` is the crown jewel.** Anyone who has both the key and a person's OAuth token (which Claude stores) can read that person's Canvas token. Keep the key only in Vercel's encrypted environment variables. To rotate, move the old key to `SEAL_KEY_PREVIOUS` and set a new `SEAL_KEY`. To disconnect everyone instantly, replace the key without keeping the old one.
2. **No per-user revocation on the server.** It stores nothing, so people disconnect by deleting their token in Canvas. That always works and takes effect immediately.
3. **Authorization codes are not single-use.** This is the stateless trade-off. Codes expire after 2 minutes, only work for the client they were issued to, and need the PKCE verifier, so a leaked code alone is useless.
4. **Rate limits are per server instance.** For stronger limits, add a Vercel Firewall rate-limit rule on `/connect`.
5. **Canvas tokens are all-or-nothing.** Students can't create limited tokens, so the connector can do anything the student can do in Canvas.
6. **The operator is trusted.** Whoever deploys this could change the code to log tokens. Users are trusting the deployment, not just this repo. Deploy from a public repo, so people can see what runs.
7. **School policy.** Some institutions restrict personal access tokens or third-party tools. Check yours.

## Deploy your own (Vercel)

```bash
npm install
npm test
vercel link
openssl rand -base64 32 | vercel env add SEAL_KEY production
vercel deploy --prod
```

The connector URL is `https://<project>.vercel.app/mcp`. `APP_URL` defaults to the Vercel production URL. Set it to pin a specific domain.

| Variable | |
|---|---|
| `SEAL_KEY` | **Required.** 32 random bytes, base64 (`openssl rand -base64 32`). |
| `SEAL_KEY_PREVIOUS` | Old key, still accepted during a rotation. |
| `APP_URL` | Public origin, e.g. `https://canvas-bridge-ox.vercel.app`. |
| `CANVAS_HOST_ALLOWLIST` | Only allow these Canvas hosts, e.g. `*.instructure.com,canvas.sbs.ox.ac.uk`. |
| `ALLOWED_REDIRECT_HOSTS` | OAuth redirect hosts. Default `claude.ai,claude.com`. |

## Develop

```bash
cp .env.example .env    # set SEAL_KEY
npm run dev             # http://localhost:8787
npm test                # build + end-to-end tests
npm run icons           # regenerate PNG/ICO icons from public/icon.svg
```

## Credits and trademarks

The Canvas API client and tool definitions come from [lucanardinocchi/canvas-mcp](https://github.com/lucanardinocchi/canvas-mcp) (MIT). They were adapted here for multi-user hosting: a per-request client, SSRF guards, an upload that doesn't auto-submit, and tool annotations.

Canvas is a trademark of Instructure, Inc. This project is independent and is not affiliated with or endorsed by Instructure or Anthropic. "Canvas" is used only to describe what the connector works with. The Canvas Bridge logo is original and does not use Instructure's marks.