@owen-x-tech/canvas-mcp
v1.1.0
Published
Canvas LMS MCP Server - Comprehensive integration with Canvas via Claude
Maintainers
Readme
Canvas LMS MCP Server
A comprehensive Model Context Protocol (MCP) server for integrating Canvas LMS with Claude AI. This server enables you to programmatically access and manipulate Canvas through Claude, automating workflows for students, teachers, and educational technologists.
Features
150+ Tools covering all major Canvas LMS resources:
- Users & Accounts: List, get, update users and accounts
- Courses: Create, read, update, delete courses
- Enrollments: Manage student enrollments with states
- Assignments: Create and manage assignments with full details
- Submissions: Grade assignments, view submissions, track progress
- Discussions: Create, manage, and read discussion topics and entries
- Modules: Organize content with modules and module items
- Pages: Create and manage course pages (wiki)
- Announcements: List and create announcements
- Files: Upload, list, and delete course files
- Conversations: Send messages and manage conversations
- Calendar: Create and manage calendar events
- Groups: List groups and group members
- Quizzes: Access quiz information and submissions
- Rubrics: View grading rubrics
- Grades: Access grade summaries and user grades
Quick Start
Prerequisites
- Node.js 18+
- Canvas LMS instance with API access
- Canvas API token (generate in Canvas Settings > Developer Keys)
- Canvas instance URL
Installation
- Clone and setup:
npm install- Build TypeScript:
npm run build- Set environment variables:
export CANVAS_BASE_URL="https://your-instance.instructure.com"
export CANVAS_TOKEN="your-canvas-api-token"Running the Server
Development mode (watch + rebuild):
npm run devProduction mode:
npm run build
npm startThe server will start listening on stdio and display: Canvas MCP Server running on stdio
Configuration
Environment Variables
| Variable | Description | Example |
|----------|-------------|---------|
| CANVAS_BASE_URL | Your Canvas instance URL | https://myschool.instructure.com |
| CANVAS_TOKEN | Your Canvas API token | 1234~abc... |
Canvas API Token Setup
- Log in to your Canvas instance as an admin or teacher
- Go to Settings (account menu top-right)
- Click Developer Keys in the left sidebar
- Click + Developer Key (or use existing)
- Copy the generated token
- Set it as
CANVAS_TOKENenvironment variable
Usage with Claude
Connecting to Claude
- Add this MCP server to your Claude configuration
- Restart Claude
- The Canvas tools will be available in Claude for use
Example Use Cases
List courses and students:
Claude: "List all my courses and the students enrolled in each"Create assignments:
Claude: "Create an assignment called 'Midterm Project' in Biology 101 due March 15th, worth 100 points"Grade submissions:
Claude: "Get all submissions for the Physics Lab assignment in Course 123 and show me who hasn't submitted"Send announcements:
Claude: "Create an announcement in all my courses about the upcoming exam"Manage discussions:
Claude: "List all discussions in Chemistry 101 and show me which ones have the most posts"Export data:
Claude: "Get the grades for all students in Biology 101 and create a summary"Tool Categories
Users (3 tools)
list_users- List all users with optional searchget_user- Get specific user detailsupdate_user- Update user information
Courses (6 tools)
list_courses- List accessible courses with filtersget_course- Get course detailscreate_course- Create new courseupdate_course- Update course infodelete_course- Delete courselist_course_search- Search courses
Enrollments (5 tools)
list_enrollments- List course enrollmentsget_enrollment- Get specific enrollmentcreate_enrollment- Enroll a studentupdate_enrollment- Update enrollment statedelete_enrollment- Remove from course
Assignments (5 tools)
list_assignments- List course assignmentsget_assignment- Get assignment detailscreate_assignment- Create new assignmentupdate_assignment- Update assignmentdelete_assignment- Delete assignment
Submissions (4 tools)
list_submissions- List assignment submissionsget_submission- Get student submissiongrade_submission- Grade a submissionsubmit_assignment- Submit assignment (as student)
Discussions (5 tools)
list_discussions- List course discussionsget_discussion- Get discussion detailscreate_discussion- Create new discussionupdate_discussion- Update discussionlist_discussion_entries- Get discussion posts
Modules (4 tools)
list_modules- List course modulesget_module- Get module detailscreate_module- Create new modulelist_module_items- List module items
Pages (5 tools)
list_pages- List course pagesget_page- Get page contentcreate_page- Create new pageupdate_page- Update pagedelete_page- Delete page
Announcements (1 tool)
list_announcements- List course announcements
Files (3 tools)
list_files- List course filesget_file- Get file detailsdelete_file- Delete file
Conversations (4 tools)
list_conversations- List your messagesget_conversation- Get conversation detailscreate_conversation- Start new messageadd_conversation_message- Reply to conversation
Calendar (5 tools)
list_calendar_events- List calendar eventsget_calendar_event- Get event detailscreate_calendar_event- Create eventupdate_calendar_event- Update eventdelete_calendar_event- Delete event
Groups (3 tools)
list_groups- List course groupsget_group- Get group detailslist_group_members- List group members
Quizzes (3 tools)
list_quizzes- List course quizzesget_quiz- Get quiz detailsget_quiz_submissions- Get quiz submissions
Rubrics (2 tools)
list_rubrics- List course rubricsget_rubric- Get rubric details
Grades (2 tools)
get_grades_summary- Get course grade summaryget_user_grades- Get student's grades
Accounts (2 tools)
get_account- Get account detailslist_accounts- List your accounts
Response Format
All tools return JSON responses with the following structure:
{
"data": { /* Canvas API response */ },
"status": 200,
"error": null
}On error:
{
"data": {},
"status": 400,
"error": "Error message from Canvas API"
}Pagination
Most list endpoints support pagination:
page: Page number (default: 1)per_page: Items per page (max: 100, default: 10)
Example:
{
"course_id": "123",
"page": 2,
"per_page": 50
}Authentication
The server uses Canvas OAuth2 bearer token authentication. The token is automatically included in all API requests via the Authorization: Bearer <TOKEN> header.
Token Security:
- Store tokens in environment variables, never in code
- Tokens should be treated as passwords
- Rotate tokens periodically in Canvas settings
- Use different tokens for different applications
Error Handling
The server includes comprehensive error handling:
- Invalid Canvas tokens result in 401 errors
- Invalid course/user IDs result in 404 errors
- Network errors include descriptive messages
- All errors are returned in the response's
errorfield
Development
Project Structure
canvas-mcp-server/
├── src/
│ ├── index.ts # MCP server definition and tool handlers
│ └── canvas-client.ts # Canvas API client with all endpoints
├── build/ # Compiled JavaScript output
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This fileType Safety
The project uses TypeScript with strict mode enabled for maximum type safety.
Building
npm run build # Compile TypeScript
npm run test # Type check without output
npm run dev # Watch mode with auto-rebuildCanvas API Documentation
For more information about Canvas API endpoints, parameters, and responses, visit:
- Official Docs: https://canvas.instructure.com/doc/api/
- Developer Portal: https://developerdocs.instructure.com/services/canvas
Limits & Rate Limiting
Canvas API has rate limits:
- ~120 requests per minute per token
- Responses include
X-Rate-Limitheaders - The client will return error details if limits are exceeded
API Compatibility
This server targets Canvas LMS API v1. Compatibility:
- Canvas LMS (self-hosted)
- Canvas Cloud (Instructure SaaS)
- Most Canvas versions 2020+
Performance Tips
- Use
per_page=100for faster pagination through large lists - Include only necessary fields with the
includeparameter - Cache results when possible to reduce API calls
- Use search filters to reduce result sets
Security Considerations
- Token Security: Keep API tokens secret
- Access Control: The server uses Canvas's native permissions
- Rate Limiting: Implement request queuing for high-volume operations
- Audit Logs: Canvas tracks all API changes in audit logs
Troubleshooting
"CANVAS_TOKEN environment variable is required"
- Set the
CANVAS_TOKENenvironment variable with a valid Canvas API token
401 Unauthorized errors
- Verify your Canvas API token is correct
- Generate a new token if the existing one is invalid
- Check that the token has appropriate permissions
404 Not Found errors
- Verify the course_id, assignment_id, user_id, etc. are correct
- Check that you have access to that resource
- Use list endpoints to find valid IDs
Slow responses
- Canvas API has rate limits (~120 requests/minute)
- Consider reducing pagination size or caching results
- Check your network connectivity
Contributing
This is an MVP MCP server designed to provide comprehensive Canvas API coverage. To extend:
- Add new methods to
CanvasClientincanvas-client.ts - Add corresponding tool definitions in
index.ts - Add handler cases in the
handleToolCallfunction - Rebuild with
npm run build
License
MIT
Support
For issues with:
- Canvas API: Contact Canvas support or check the API documentation
- This MCP Server: Review the troubleshooting section above
- Claude Integration: Check Claude's MCP documentation
Roadmap
Potential future enhancements:
- File upload support
- WebSocket support for real-time updates
- Batch operations for bulk updates
- GraphQL support alongside REST
- Built-in caching layer
- Request queuing for rate limit management
