Canvas MCP
Provides tools for interacting with the Canvas LMS REST API on the user's behalf: listing courses, checking authentication, and calling arbitrary Canvas endpoints (e.g. course pages) to read course data such as assignments, modules and materials.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Canvas MCP on Cloudflare Workers (stateless)
A Model Context Protocol server for Canvas LMS that runs on Cloudflare Workers.
The server is stateless:
It issues no MCP session (no
Mcp-Session-Id). Each HTTP request is complete on its own.It stores nothing: no Durable Objects, KV, D1, R2 or files.
The client keeps all Canvas credentials and sends them in HTTP headers on every request. The Worker uses them for that one request and then discards them.
Live endpoint: https://canvas-mcp.accelerateme.workers.dev/mcp
(Health check: https://canvas-mcp.accelerateme.workers.dev/health)
This repo is a fork of Drastixs/mcp-canvas-lms (branch home-lab-deploy), which is a fork of DMontgomery40/mcp-canvas-lms (MIT).
Connect an agent
If you are an AI agent and the user asked you to connect yourself to Canvas, do steps 1 to 4 in sequence. Do not print secret values in chat or logs. Do not write them into a git repository.
Step 1: Get Canvas credentials
Use one of these credential types.
Type | Headers to send | When to use |
A. Refresh credentials (recommended) |
| Your university uses SSO and you logged in with the Canvas mobile OAuth flow. The Worker gets a new access token on each request. |
B. Personal access token |
| Your Canvas lets users make tokens (Canvas → Account → Settings → + New Access Token). This is the simplest option. |
Do not send a short-lived OAuth access token by itself. Canvas cancels the old access token each time a refresh occurs, so it stops working soon.
To get type A credentials, run this on the user's computer (it needs Node 18+, and Python 3 for the login):
git clone https://github.com/Drastixs/canvas-mcp-cloudflare && cd canvas-mcp-cloudflare
npm install
# Option 1: a new login only for this client (recommended).
# A Chromium window opens. The user logs in with SSO and approves MFA.
CANVAS_EMAIL='user@university.ac.uk' CANVAS_PASSWORD='...' npm run credentials -- --login --format env
# Option 2: use the tokens that already exist in ~/.canvas-mcp/tokens.json
npm run credentials -- --format envThe command prints export CANVAS_DOMAIN=... CANVAS_REFRESH_TOKEN=... CANVAS_CLIENT_ID=... CANVAS_CLIENT_SECRET=....
Other formats: --format json, --format claude (a claude mcp add command), --format codex (a Codex config block).
--domain <host> sets the Canvas domain (default canvas.manchester.ac.uk).
Use a separate login (Option 1) for each server that refreshes tokens. If two servers share one refresh token, each refresh cancels the access token of the other server. The Worker retries in this case, but a separate login is better.
Step 2: Keep the credentials in the client
Put the values in the user's shell profile or secret manager as environment variables, for example in ~/.config/canvas-mcp.env with mode 600:
export CANVAS_DOMAIN='canvas.manchester.ac.uk'
export CANVAS_REFRESH_TOKEN='...'
export CANVAS_CLIENT_ID='...'
export CANVAS_CLIENT_SECRET='...'Then make the client config read the variables. Do not put the literal values in a config file that is in git.
Step 3: Add the server to the client
Claude Code – add to .mcp.json (project) or use claude mcp add (user). ${VAR} is read from the environment:
{
"mcpServers": {
"canvas": {
"type": "http",
"url": "https://canvas-mcp.accelerateme.workers.dev/mcp",
"headers": {
"X-Canvas-Domain": "${CANVAS_DOMAIN}",
"X-Canvas-Refresh-Token": "${CANVAS_REFRESH_TOKEN}",
"X-Canvas-Client-Id": "${CANVAS_CLIENT_ID}",
"X-Canvas-Client-Secret": "${CANVAS_CLIENT_SECRET}"
}
}
}
}or:
claude mcp add --transport http --scope user canvas https://canvas-mcp.accelerateme.workers.dev/mcp \
--header "X-Canvas-Domain: $CANVAS_DOMAIN" \
--header "X-Canvas-Refresh-Token: $CANVAS_REFRESH_TOKEN" \
--header "X-Canvas-Client-Id: $CANVAS_CLIENT_ID" \
--header "X-Canvas-Client-Secret: $CANVAS_CLIENT_SECRET"(The second form writes the values into ~/.claude.json.)
Codex – ~/.codex/config.toml. env_http_headers maps a header to an environment variable name:
[mcp_servers.canvas]
url = "https://canvas-mcp.accelerateme.workers.dev/mcp"
[mcp_servers.canvas.env_http_headers]
"X-Canvas-Domain" = "CANVAS_DOMAIN"
"X-Canvas-Refresh-Token" = "CANVAS_REFRESH_TOKEN"
"X-Canvas-Client-Id" = "CANVAS_CLIENT_ID"
"X-Canvas-Client-Secret" = "CANVAS_CLIENT_SECRET"Cursor, Windsurf, VS Code and other clients with remote HTTP support – use the same url and headers as the Claude Code JSON above, in that client's MCP config file.
Clients with personal access token (type B) – send only one header:
"headers": { "Authorization": "Bearer ${CANVAS_API_TOKEN}" }Clients that support only stdio (for example older Claude Desktop) – use the mcp-remote bridge:
{
"mcpServers": {
"canvas": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://canvas-mcp.accelerateme.workers.dev/mcp",
"--transport", "http-only",
"--header", "X-Canvas-Refresh-Token:${CANVAS_REFRESH_TOKEN}",
"--header", "X-Canvas-Client-Id:${CANVAS_CLIENT_ID}",
"--header", "X-Canvas-Client-Secret:${CANVAS_CLIENT_SECRET}"
],
"env": {
"CANVAS_REFRESH_TOKEN": "...",
"CANVAS_CLIENT_ID": "...",
"CANVAS_CLIENT_SECRET": "..."
}
}
}
}Claude.ai web "custom connectors" cannot send custom headers, so they cannot use this server.
Step 4: Verify
Restart the client (or reload its MCP servers) so it reads the new config and environment.
Call the tool
canvas_check_auth. The result must show"authenticated": true.Call
canvas_list_courses. The result must show acountgreater than 0.
You can also check from a shell:
curl -s https://canvas-mcp.accelerateme.workers.dev/mcp \
-H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
-H "X-Canvas-Refresh-Token: $CANVAS_REFRESH_TOKEN" \
-H "X-Canvas-Client-Id: $CANVAS_CLIENT_ID" \
-H "X-Canvas-Client-Secret: $CANVAS_CLIENT_SECRET" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"canvas_check_auth","arguments":{}}}'Troubleshooting
Symptom | Cause | Fix |
Tool result | The client sent no credentials. | Make sure the environment variables are set in the process that starts the client. Restart the client. |
| The refresh token was revoked (for example, the "Pixel 7" token was deleted in Canvas). | Do Step 1 again with |
| The personal access token expired or was deleted. | Make a new token in Canvas settings. |
HTTP 403 |
| Use an allowed domain, or deploy your own Worker (see below). |
HTTP 401 | The Worker has | Add the |
HTTP 405 on GET or DELETE | Normal. The server is stateless, so it has no event stream and no session to delete. | Clients must use POST. All current MCP SDK clients do this. |
Related MCP server: canvas-lms
Notes for agents that use the tools
Start with
canvas_list_coursesto get course IDs. Most other tools needcourse_id.List tools show the first 5 items plus
countandhas_more. Send"include_raw": trueto get all items.canvas_apicalls any Canvas REST endpoint (GET only on the public deployment). Use it for data that has no dedicated tool, for example{"path": "courses/123/pages/week-1"}.The default tool set is read-only (36 tools). Write tools are off.
Each tool call is independent. Do not expect the server to remember anything between calls.
Header reference
Header | Required | Purpose |
| One of these, or the three refresh headers | Canvas access token (personal access token). |
| See above | OAuth refresh credentials. The Worker refreshes on each request and retries on a 401. |
| No (default | Canvas host, for example |
| No |
|
| Only if the Worker sets | Shared key that limits who can use the Worker. |
How it works
MCP client (keeps credentials)
│ POST /mcp + JSON-RPC body + X-Canvas-* headers
▼
Cloudflare Worker (src/worker.ts)
│ 1. Check the domain allowlist and optional access key
│ 2. Make a new CanvasClient, MCP Server and transport for this request only
│ 3. If needed, exchange the refresh token for an access token (not stored)
▼
Canvas REST API ──► JSON response to the client ──► everything is discardedCode layout:
File | Purpose |
| Runtime-neutral core: tool definitions and MCP handlers ( |
| Cloudflare Worker entry (stateless streamable HTTP, credentials from headers). |
| Node entry: stdio, or a stateless streamable HTTP server. |
| Auth provider interface and the request-credentials provider used by the Worker. |
| Node-only provider ( |
|
|
Deploy your own Worker
npm install
npx wrangler login
# Edit "vars" in wrangler.jsonc: CANVAS_DOMAIN and ALLOWED_CANVAS_DOMAINS
npm run deployConfiguration (vars in wrangler.jsonc):
Variable | Default | Purpose |
|
| Domain used when the client sends no |
|
| Domains clients may use. |
|
| Default toolsets. |
| empty | Exact tool names to expose. Empty means the read-only default set. |
|
|
|
| empty | Browser origins allowed by CORS. Empty means any origin. |
| not set | Set with |
Other commands: npm run dev:worker (local Worker on port 8787), npm run tail (live logs), npm test.
Security notes
Credentials go over HTTPS in headers. The Worker does not log header values or tokens. It logs only the Canvas API path of each call.
The domain allowlist stops the Worker from being used to send requests to other hosts.
Anyone who has your refresh credentials can read your Canvas. Keep them as you would keep a password. To revoke them, delete the "Pixel 7" integration in Canvas → Account → Settings → Approved Integrations.
Write operations are off by default. Turn them on only for a private deployment that has
MCP_ACCESS_KEYset.
Run locally with Node (optional)
The original Node modes still work:
npm run build
CANVAS_DOMAIN=canvas.manchester.ac.uk node build/index.js # stdio, uses ~/.canvas-mcp/tokens.json
MCP_TRANSPORT=streamable-http MCP_BEARER_TOKEN=change-me \
CANVAS_DOMAIN=canvas.manchester.ac.uk node build/index.js # stateless HTTP on 127.0.0.1:3000/mcpThe Node HTTP mode is also stateless now (no sessions). It keeps the Canvas token on the server and needs MCP_BEARER_TOKEN.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Maven MCP server and API: applications, waitlist, student lists, at-risk students.
Unofficial remote MCP server for Less Annoying CRM: OAuth 2.1, read-only grants, 10 tools.
OAuth-protected, read-only-by-default MCP server for provenance-labeled QuillCaddie project memory.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA remote MCP server for querying Canvas LMS courses, assignments, and grades. Enables natural language interaction with Canvas data via MCP clients like Claude Desktop.-
- AlicenseNot gradedqualityCmaintenanceMCP server for Canvas LMS with automatic OAuth authentication. Enables interaction with courses, assignments, grades, modules, discussions, quizzes, files, calendar, messaging, and more without manual API token management.2MIT
- AlicenseBqualityNot gradedmaintenanceTypeScript MCP server for Canvas LMS that exposes Canvas API workflows for courses, assignments, submissions, modules, pages, discussions, announcements, files, users, enrollments, conversations, calendar, and utility endpoints.407 npmISC
- AlicenseBqualityDmaintenanceA read-only MCP server for Canvas LMS that exposes a user's courses, upcoming work, and assignments as callable tools.3MIT