Canvas LMS MCP Server
Canvas LMS MCP Server
一个 Model Context Protocol 服务器,为 MCP 客户端(Claude Desktop、Claude Code 或任何支持 MCP 的客户端)提供对您的 Canvas LMS 账户的只读访问。
它回答两个问题:
"我在修什么课,成绩如何?" — 活跃课程及当前成绩。
"我还有哪些作业没交,什么时候截止?" — 未完成作业及截止日期。
通信使用标准的 stdio 传输方式,因此客户端将服务器作为子进程启动。除了 MCP 流量外,不会向 stdout 写入任何内容。
要求
Node.js 18.17 或更高版本(服务器使用内置的
fetch)一个 Canvas 个人访问令牌
Related MCP server: Canvas MCP Server
安装
cd canvas-mcp-server
npm install配置
两个变量都是必需的;如果缺少任何一个,服务器会退出并显示明确的提示信息。
变量 | 描述 | 示例 |
| 您的 Canvas 实例根地址。末尾的 |
|
| 一个 Canvas 个人访问令牌。 |
|
获取 Canvas 访问令牌
登录 Canvas。
转到账户 → 设置。
在已批准的集成下,点击**+ 新建访问令牌**。
为其指定用途和(可选)到期日期,然后点击生成令牌。
立即复制令牌——Canvas 只显示一次。
令牌携带您的完整 Canvas 权限。请勿将其纳入版本控制,如果泄露,请从同一设置页面撤销它。
连接客户端
将服务器添加到您的 MCP 客户端配置中,指向 src/index.js 的绝对路径:
{
"mcpServers": {
"canvas": {
"command": "node",
"args": ["/absolute/path/to/canvas-mcp-server/src/index.js"],
"env": {
"CANVAS_API_URL": "https://asu.instructure.com",
"CANVAS_ACCESS_TOKEN": "your-token-here"
}
}
}
}Claude Desktop —
claude_desktop_config.json(macOS:~/Library/Application Support/Claude/,Windows:%APPDATA%\Claude\)。Claude Code —
claude mcp add canvas --env CANVAS_API_URL=... --env CANVAS_ACCESS_TOKEN=... -- node /absolute/path/to/canvas-mcp-server/src/index.js
编辑配置后重启客户端。
工具
list_courses_and_grades
您以学生身份活跃注册的每门课程,以及其当前成绩。
参数 | 类型 | 默认值 | 描述 |
| boolean |
| 同时包含已结束学期中的活跃注册。 |
当您的机构使用评分周期时,Canvas 会报告两次成绩:一次针对进行中的周期,一次针对整个课程。grades.scope 字段说明您正在查看的是哪一个:
current_grading_period— 分数涵盖进行中的评分周期,course_total_score/course_total_grade携带整个课程的数字。course_total— 机构不使用评分周期,因此分数就是课程总分。unavailable— Canvas 未返回带有成绩数据的注册信息。
在任一范围内,current_* 忽略尚未评分的作业,而 final_* 将未评分的作业计为零分。
{
"courses": [
{
"id": "101",
"name": "Full Stack Web Development",
"course_code": "GIT-411",
"term": "Fall 2026",
"term_start": "2026-08-20T00:00:00Z",
"term_end": "2026-12-18T00:00:00Z",
"enrollment_state": "active",
"grades": {
"current_score": 88.0,
"current_grade": "B+",
"final_score": 80.5,
"final_grade": "B-",
"scope": "current_grading_period",
"grading_period_title": "Fall Term",
"course_total_score": 91.4,
"course_total_grade": "A-"
},
"html_url": "https://asu.instructure.com/courses/101"
}
],
"course_count": 1,
"retrieved_at": "2026-09-01T12:00:00.000Z"
}list_upcoming_assignments
您活跃课程中仍未完成的作业,按截止日期排序,最近的在前。
参数 | 类型 | 默认值 | 描述 |
| integer 1–365, or |
| 向前查看多远。 |
| boolean |
| 包含从未提交的逾期作业。 |
| boolean |
| 包含没有截止日期的未完成作业。 |
| string[] | 所有活跃课程 | 限制为特定的 Canvas 课程 ID。 |
当作业已发布、可评分且未提交、未评分或未豁免时,该作业被视为未完成。具体来说,以下情况会被过滤掉:
任何带有提交时间戳的内容
处于
submitted、pending_review或graded状态的提交已豁免的作业
已有分数或成绩的作业(手动或纸质录入)
not_graded作业(考勤占位符等)未发布的作业
{
"assignments": [
{
"id": "9004",
"name": "Missed lab writeup",
"course_id": "101",
"course_name": "Full Stack Web Development",
"due_at": "2026-08-28T06:59:00.000Z",
"days_until_due": -4.2,
"overdue": true,
"points_possible": 25,
"submission_types": ["online_upload"],
"submission_state": "unsubmitted",
"missing": true,
"locked": false,
"unlock_at": null,
"lock_at": null,
"html_url": "https://asu.instructure.com/courses/101/assignments/9004"
}
],
"assignment_count": 1,
"courses_checked": 2,
"window": {
"from": "2026-09-01T12:00:00.000Z",
"to": "2026-09-15T12:00:00.000Z",
"include_overdue": true,
"include_undated": false
},
"errors": [],
"retrieved_at": "2026-09-01T12:00:00.000Z"
}如果某门课程无法读取——已结束、受限或其他错误——它会被列在 errors 中,其余课程仍会返回结果。
行为说明
分页。 Canvas 通过
Link标头对每个集合进行分页。客户端以每页 100 条记录跟随rel="next",每个端点最多 20 页,这样错误的响应就不会无限循环。并发。 每次最多从 5 门课程获取作业,以避免触及 Canvas 的速率限制。
当前学期。 默认只返回学期尚未结束的课程。Canvas 的默认学期没有结束日期,因此始终包含在内。
错误。 Canvas 的失败会以 MCP 工具错误的形式返回,携带状态码和 Canvas 自身的消息,并针对常见情况给出提示(401 → 令牌错误,404 → URL 错误)。
只读。 两个工具都标注了
readOnlyHint。服务器只发出GET请求,绝不会修改您的 Canvas 数据。
开发
npm test # 36 tests: API client, grade logic, filtering, and an end-to-end MCP round trip测试套件使用带有录制 Canvas 负载的 fetch 替身,因此无需网络或真实令牌。所有测试数据的日期都相对于测试运行的时刻。
src/
index.js MCP server: tool definitions, schemas, stdio wiring
canvas.js Canvas REST client: auth, pagination, error mapping
courses.js Active-course and grade normalization
assignments.js Outstanding-assignment filtering and due-date windows许可证
MIT
Available Tools
2 toolslist_courses_and_gradesList active courses and gradesARead-only
Fetch every course the user is actively enrolled in as a student, together with the current grade for each. When the institution uses grading periods, the score reported is for the grading period in progress and the whole-course total is included alongside it (see the 'scope' field). Defaults to the current term only.
| Name | Required | Description | Default |
|---|---|---|---|
| include_all_terms | No | Include active enrollments from terms that have already ended. |
Output Schema
| Name | Required | Description |
|---|---|---|
| courses | Yes | |
| course_count | Yes | |
| retrieved_at | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true. The description adds useful behavioral nuance beyond those: grading-period behavior, inclusion of the whole-course total alongside the in-progress score, and the 'scope' field for interpretation. This is valuable context for a read-only listing tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences. The first sentence front-loads the primary purpose, and the second adds an important grading-period nuance. There is no filler or repetition of schema details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only listing tool with one optional parameter, an output schema, and high schema coverage, the description is complete. It explains active enrollment, grading-period behavior, and term defaulting, which is sufficient for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and the only parameter, include_all_terms, is well documented in the schema with a clear description and default value. The main description restates the default behavior ('Defaults to the current term only') but adds no additional parameter-level meaning, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action ('Fetch every course the user is actively enrolled in as a student') and a clear resource ('courses... together with the current grade for each'). It also adds meaningful scope distinctions like 'Defaults to the current term only' and grading-period behavior, which clearly separates it from the sibling assignment-listing tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context for when to use the tool: when you need active course enrollments and current grades, defaulting to the current term. It does not explicitly mention alternatives or exclusions relative to list_upcoming_assignments, but the course/grade vs. assignment subject matter implies the boundary clearly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_upcoming_assignmentsList upcoming unsubmitted assignmentsARead-only
Fetch assignments across the user's active courses that are still outstanding — not submitted, not graded, and not excused — with their due dates, sorted soonest first. Past-due work that was never turned in is included by default.
| Name | Required | Description | Default |
|---|---|---|---|
| course_ids | No | Restrict to these Canvas course IDs. Defaults to all active courses. | |
| days_ahead | No | How far ahead to look, in days. Pass null for no upper bound. | |
| include_overdue | No | Include past-due assignments that were never submitted. | |
| include_undated | No | Include outstanding assignments that have no due date. |
Output Schema
| Name | Required | Description |
|---|---|---|
| errors | Yes | Courses that could not be read; the rest of the results are still valid. |
| window | Yes | |
| assignments | Yes | |
| retrieved_at | Yes | |
| courses_checked | Yes | |
| assignment_count | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already declare readOnlyHint=true and openWorldHint=true, so the description doesn't need to repeat those. It goes beyond the annotations by specifying the filtering logic (not submitted, not graded, not excused), sorting order (soonest first), and default inclusion of overdue items. This adds useful behavioral context without contradicting the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the core purpose, and every clause adds value. It efficiently conveys the tool's scope, filtering criteria, ordering, and default behavior without any fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema exists (as noted in the context), the description doesn't need to explain return values. The tool is relatively simple with 4 optional parameters, and the description plus schema fully cover the behavior. It could be a 5, but the absence of any prerequisites or error conditions keeps it at a solid 4.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already covers 100% of the parameters with descriptions. The tool description adds a bit more by explaining the filtering and sorting behavior, which relates to how the parameters interact (e.g., include_overdue default true). Since schema coverage is high, a baseline 3 is appropriate, but the description's mention of 'sorted soonest first' and 'Past-due work ... included by default' adds context beyond the schema, justifying a 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Fetch') and identifies the resource ('assignments across the user's active courses') with clear criteria ('not submitted, not graded, not excused'). It also notes the sorting by due date and the inclusion of past-due unsubmitted work, which distinguishes it from the sibling tool (list_courses_and_grades) that focuses on grades and courses.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description makes it clear that the tool is for outstanding assignments, which implies using it when you need to see what's due or overdue. It does not explicitly state when NOT to use it or mention the sibling alternative, but the context is sufficiently clear for most use cases, and the default behavior (including overdue) is disclosed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
list_courses_and_grades - First observed
list_upcoming_assignments
TDQS
Scored across 2 tools
The two tools serve clearly distinct purposes: one retrieves course enrollments with grades, the other retrieves upcoming assignments. There is no ambiguity in selecting between them.
Both tools follow a consistent 'list_' prefix followed by a clear noun phrase ('courses_and_grades', 'upcoming_assignments'), making the naming pattern uniform and predictable.
With only two tools, the server feels minimal but not entirely unreasonable for a focused student dashboard scope. The count is at the borderline of being thin, as agents may expect additional related operations.
The tool surface covers the two primary student needs (grades and upcoming assignments) but lacks operations like retrieving individual course details, assignment submissions, or past assignmentscars. This leaves notable gaps for broader academic workflows, though it may suffice for a narrow use case.
Related MCP Connectors
Manage your Canvas coursework with quick access to courses, assignments, and grades. Track upcomin…
Read-only access to Epivo's live course catalogue for AI agents.
Search university course materials, your flashcards, quizzes, streak and quota. All tools read-only.
Ask your AI about your Airbnb and VRBO listings, bookings, guest messages and reviews. Read-only.
Related MCP Servers
- FlicenseAqualityNot gradedmaintenanceEnables interaction with Canvas LMS courses and assignments directly from your LLM, allowing you to retrieve, search, and summarize course information, check due dates, and access assignment details without leaving your AI assistant.42,863 npm-
- FlicenseBqualityNot gradedmaintenanceProvides read-only access to Canvas LMS for students to retrieve courses, assignments, grades, files, discussions, and planner items. Includes optional NotebookLM integration for uploading course content to AI-powered study notebooks.452,863 npm-
- AlicenseAqualityCmaintenanceEnables AI systems to interact with Canvas Learning Management System data, allowing users to access courses, assignments, quizzes, planner items, files, and syllabi through natural language queries.227MIT
- FlicenseBqualityDmaintenanceEnables interaction with Canvas LMS to access courses, modules, files, pages, assignments, submissions, announcements, upcoming deadlines, and syllabus.15-