canvas-mcp

canvas-mcp

Enables AI agents to interact with Canvas LMS via its REST API for reading courses, assignments, grades, announcements, discussions, and performing write actions with dry-run safety.

Category
访问服务器

README

canvas-mcp

CI License: MIT Node Model Context Protocol

A Model Context Protocol server that gives AI agents structured access to Canvas LMS — coursework, deadlines, grades, submissions, discussions, and messages — over the official REST API.

Works with any Instructure-hosted Canvas instance. Built and validated against canvas.okstate.edu.

Contents

Why the REST API

Canvas exposes a stable, versioned API at /api/v1/. Wrapping it — rather than scraping the web UI — yields:

  • Single-call actions instead of multi-page navigation.
  • Resilience to UI redesigns; the API is versioned.
  • Compact, structured JSON that doesn't flood an agent's context with rendered HTML.
  • Simple auth via one bearer token.

Browser automation is reserved for things genuinely outside Canvas — embedded LTI tools such as zyBooks, Cengage, or Coursera quizzes, whose contents Canvas itself cannot see.

Features

  • 11 workflow-oriented tools spanning the full student workflow, designed for agent ergonomics (human-readable names over opaque IDs, consolidated multi-step actions).
  • Dry-run safety on every write — nothing is submitted, posted, or sent without an explicit confirm: true.
  • Cross-course planner — one call returns everything due across all courses.
  • Zero-config secrets — the server auto-loads a local .env, so no token ever appears on a command line or in client config.
  • Tested — offline boot check in CI plus a live contract/regression suite.

Tools

Tool Description Access
canvas_list_courses Active courses with code, term, and current grade read
canvas_deadlines Everything due soon across all courses (via the planner) read
canvas_list_assignments Assignments in a course with due dates and submission status read
canvas_get_assignment Full detail: instructions, rubric, accepted types, your status read
canvas_get_grades Course grade summary, or per-assignment feedback and rubric read
canvas_list_announcements Recent announcements, all courses or one read
canvas_get_discussion List discussion topics, or read a full thread read
canvas_find_person Resolve a name to a user ID for messaging read
canvas_submit_assignment Submit a text entry, URL, or uploaded file write
canvas_post_reply Reply to a discussion topic write
canvas_send_message Send a Canvas inbox message write

Installation

Requirements: Node.js ≥ 22.

git clone https://github.com/tylergibbs1/canvas-mcp.git
cd canvas-mcp
npm install
npm run build

Configuration

Generate a token in Canvas: Account → Settings → "+ New Access Token". Treat it like a password.

cp .env.example .env   # then set CANVAS_TOKEN
Variable Required Description
CANVAS_BASE_URL yes Your Canvas origin, e.g. https://canvas.okstate.edu (no trailing slash).
CANVAS_TOKEN yes A personal access token.

The server reads .env automatically. Real environment variables take precedence, so you may also pass these inline if you prefer.

Usage

Claude Code

The server auto-loads .env, so no secret is needed on the command line:

claude mcp add --scope user canvas -- node /absolute/path/to/canvas-mcp/dist/index.js

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "canvas": {
      "command": "node",
      "args": ["/absolute/path/to/canvas-mcp/dist/index.js"],
      "env": {
        "CANVAS_BASE_URL": "https://your-school.instructure.com",
        "CANVAS_TOKEN": "your_token_here"
      }
    }
  }
}

Any MCP-compatible client works — point it at node dist/index.js with the two environment variables set.

Write safety

Every write tool defaults to a dry run: it validates inputs and returns a preview of exactly what would be sent, but performs no action. You must re-call with confirm: true to actually submit, post, or send. An accidental or hallucinated call cannot change anything in Canvas.

Development

npm run dev       # run from source with tsx
npm run build     # compile TypeScript to dist/
npm test          # offline: boot the server and verify all tools register (no token)
npm run eval      # live: contract/regression suite (requires a token)
npm run inspect   # interactive MCP Inspector (requires a token)

Evaluation

  • eval/eval.mjs (npm run eval) asserts data-independent invariants against the live API — deadline ordering, valid status values, HTML stripping, cross-tool grade consistency, and that every write tool's confirm:false path returns a dry run and never executes.
  • eval/tasks.md provides realistic agent task prompts (happy path, multi-step, write safety, scope boundary) for behavioral evaluation, each with "what good looks like."

Security

  • Tokens are secrets. .env is git-ignored; never commit it. Anyone with your token can act as you in Canvas.
  • Scoped to your account. The server can only do what your Canvas account can do.
  • Revocation. Remove a token anytime in Canvas under Account → Settings → Approved Integrations.
  • Tokens are sent only to your configured CANVAS_BASE_URL over HTTPS.

Contributing

Issues and pull requests are welcome. Please run npm run build and npm test before opening a PR; if you have a Canvas token available, npm run eval is encouraged.

License

MIT © Tyler Gibbs

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选