This repository contains a Model Context Protocol (MCP) server implementation for interacting with the Canvas Learning Management System API. The server is designed to work with Claude Desktop and other MCP-compatible clients.
Note: Recently refactored to a modular architecture for better maintainability. The legacy monolithic implementation has been archived.
The Canvas MCP Server bridges the gap between Claude Desktop and Canvas Learning Management System, providing both students and educators with an intelligent interface to their Canvas environment. Built on the Model Context Protocol (MCP), it enables natural language interactions with Canvas data.
| Released: November 10, 2025 | View Full Release Notes |
bulk_grade_submissions - Efficient batch grading with optional rubric assessmentbulk_grade_discussions - Token-efficient discussion grading APIsearch_canvas_tools - Discover available MCP tools dynamicallyget_assignment_details tool (full HTML descriptions now returned)Get AI-powered assistance with:
Enhance your teaching with:
β Get Started as an Educator
Complete FERPA compliance through systematic data anonymization when working with student data:
ENABLE_DATA_ANONYMIZATION=true)All student data is anonymized before it reaches AI systems. See Educator Guide for configuration details.
Canvas MCP works with any application that supports the Model Context Protocol. Popular options include:
Recommended:
AI Coding Assistants:
Development Platforms:
Enterprise:
See the official MCP clients list for more options.
Note: While Canvas MCP is designed to work with any MCP client, setup instructions in this guide focus on Claude Desktop. Configuration for other clients may vary.
# Install uv package manager (faster than pip)
pip install uv
# Install the package
uv pip install -e .
# Copy environment template
cp env.template .env
# Edit with your Canvas credentials
# Required: CANVAS_API_TOKEN, CANVAS_API_URL
Get your Canvas API token from: Canvas β Account β Settings β New Access Token
Note for Students: Some educational institutions restrict API token creation for students. If you see an error like βThere is a limit to the number of access tokens you can createβ or cannot find the token creation option, contact your institutionβs Canvas administrator or IT support department to request API access or assistance in creating a token.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"canvas-api": {
"command": "canvas-mcp-server"
}
}
}
Test your setup:
# Test Canvas API connection
canvas-mcp-server --test
# View configuration
canvas-mcp-server --config
# Start server (for manual testing)
canvas-mcp-server
The Canvas MCP Server provides a comprehensive set of tools for interacting with the Canvas LMS API. These tools are organized into logical categories for better discoverability and maintainability.
Student Tools (New!)
Shared Tools (Both Students & Educators)
Educator Tools
bulk_grade_submissions for efficient batch grading)Developer Tools
search_canvas_tools and list_code_api_modulesexecute_typescript for token-efficient bulk operations (99.7% token savings!)π View Full Tool Documentation for detailed information about all available tools.
The Canvas MCP now supports code execution patterns for maximum token efficiency when performing bulk operations.
Traditional Tool Calling (for simple queries):
Ask Claude: "Show me my courses"
Ask Claude: "Get assignment details for assignment 123"
β Best for: Single queries, small datasets, quick lookups
Bulk Grade Submissions Tool (for batch grading with predefined grades):
Ask Claude: "Grade these 10 students with their specific rubric scores"
β Best for: Batch grading when you already have the grades/scores, concurrent processing
Code Execution (for bulk operations with custom logic):
Ask Claude: "Grade all 90 Jupyter notebook submissions by analyzing each notebook"
Ask Claude: "Send reminders to all students who haven't submitted"
β Best for: Bulk processing with custom analysis logic, large datasets, complex conditions
Scenario: Grading 90 Jupyter notebook submissions
| Approach | Token Usage | Efficiency |
|---|---|---|
| Traditional | 1.35M tokens | Loads all submissions into context |
| Code Execution | 3.5K tokens | 99.7% reduction! π |
import { bulkGrade } from './canvas/grading/bulkGrade';
await bulkGrade({
courseIdentifier: "60366",
assignmentId: "123",
gradingFunction: (submission) => {
// Analysis happens locally, not in Claude's context!
const notebook = submission.attachments?.find(f =>
f.filename.endsWith('.ipynb')
);
if (!notebook) return null; // Skip
const hasErrors = analyzeNotebook(notebook.url);
return hasErrors ? null : {
points: 100,
rubricAssessment: { "_8027": { points: 100 } },
comment: "Great work! No errors."
};
}
});
Grade discussion posts with initial post + peer review requirements:
import { bulkGradeDiscussion } from './canvas/discussions/bulkGradeDiscussion';
// Preview grades first (dry run)
await bulkGradeDiscussion({
courseIdentifier: "60365",
topicId: "990001",
criteria: {
initialPostPoints: 10, // Points for initial post
peerReviewPointsEach: 5, // Points per peer review
requiredPeerReviews: 2, // Must review 2 peers
maxPeerReviewPoints: 10 // Cap at 10 pts for reviews
},
dryRun: true // Preview first!
});
// Then apply grades
await bulkGradeDiscussion({
courseIdentifier: "60365",
topicId: "990001",
assignmentId: "1234567", // Required to write grades
criteria: {
initialPostPoints: 10,
peerReviewPointsEach: 5,
requiredPeerReviews: 2,
maxPeerReviewPoints: 10
},
dryRun: false
});
Features:
The Canvas MCP Server includes a search_canvas_tools MCP tool that helps you discover and explore available code execution API operations. This tool searches through the TypeScript code API files and returns information about available Canvas operations.
Tool Parameters:
query (string, optional): Search term to filter tools by keyword (e.g., βgradingβ, βassignmentβ, βdiscussionβ). Empty string returns all available tools.detail_level (string, optional): Controls how much information to return. Options:
"names": Just file paths (most efficient for quick lookups)"signatures": File paths + function signatures + descriptions (recommended, default)"full": Complete file contents (use sparingly for detailed inspection)Example Usage:
Ask Claude in natural language:
Or use directly via MCP:
// Search for grading-related tools with signatures
search_canvas_tools("grading", "signatures")
// List all available tools (names only)
search_canvas_tools("", "names")
// Get full implementation details for bulk operations
search_canvas_tools("bulk", "full")
// Find discussion-related operations
search_canvas_tools("discussion", "signatures")
Returns: JSON response with:
query: The search term useddetail_level: The detail level requestedcount: Number of matching tools foundtools: Array of matching tools with requested detail levelsrc/canvas_mcp/code_api/
βββ client.ts # Base MCP client bridge
βββ index.ts # Main entry point
βββ canvas/
βββ assignments/ # Assignment operations
β βββ listSubmissions.ts
βββ grading/ # Grading operations
β βββ gradeWithRubric.ts
β βββ bulkGrade.ts # β Bulk grading (99.7% token savings!)
βββ discussions/ # Discussion operations
β βββ listDiscussions.ts
β βββ postEntry.ts
β βββ bulkGradeDiscussion.ts # β Bulk discussion grading
βββ courses/ # Course operations
βββ communications/ # Messaging operations
search_canvas_tools to find available operationsπ View Bulk Grading Example for a detailed walkthrough.
This MCP server works seamlessly with any MCP-compatible client:
Students:
Educators:
New to Canvas MCP? Check out these practical guides:
Modern Python package structure following 2025 best practices:
canvas-mcp/
βββ pyproject.toml # Modern Python project config
βββ env.template # Environment configuration template
βββ src/
β βββ canvas_mcp/ # Main package
β βββ __init__.py # Package initialization
β βββ server.py # Main server entry point
β βββ core/ # Core utilities
β β βββ config.py # Configuration management
β β βββ client.py # HTTP client
β β βββ cache.py # Caching system
β β βββ validation.py # Input validation
β βββ tools/ # MCP tool implementations
β β βββ courses.py # Course management
β β βββ assignments.py # Assignment tools
β β βββ discussions.py # Discussion tools
β β βββ rubrics.py # Rubric tools
β β βββ student_tools.py # Student-specific tools
β β βββ messaging.py # Communication tools
β β βββ discovery.py # Code API tool discovery
β β βββ code_execution.py # TypeScript code execution (NEW!)
β β βββ ... # Other tool modules
β βββ code_api/ # Code execution API (NEW!)
β β βββ client.ts # MCP client bridge
β β βββ canvas/ # Canvas operations
β β βββ grading/ # Bulk grading (99.7% token savings!)
β β βββ courses/ # Course operations
β β βββ ... # Other modules
β βββ resources/ # MCP resources
βββ examples/ # Usage examples (NEW!)
βββ docs/ # Documentation
Built with current Python ecosystem best practices:
src/ layout with pyproject.tomluv package manager with locked dependenciespyproject.toml scriptshttpx client with connection pooling and rate limitingModern Python packages (see pyproject.toml):
fastmcp: MCP server frameworkhttpx: Async HTTP clientpython-dotenv: Environment configurationpydantic: Data validation and settingspython-dateutil: Date/time handlingmypy support for type safetyruff and black for formatting and lintingFor contributors, see the Development Guide for detailed architecture and development reference.
If you encounter issues:
.env file, virtual environment path, and dependencies.env file to version controlEducators working with student data can enable FERPA-compliant anonymization:
# In your .env file
ENABLE_DATA_ANONYMIZATION=true # Anonymizes student names/emails before AI processing
ANONYMIZATION_DEBUG=true # Debug anonymization (optional)
Students donβt need anonymization since they only access their own data.
For detailed privacy configuration, see:
This server is published to the Model Context Protocol Registry for easy installation.
Publishing is automated via GitHub Actions:
# Update version in pyproject.toml
# Update CHANGELOG if applicable
git commit -am "chore: bump version to X.Y.Z"
git push
git tag vX.Y.Z
git push origin vX.Y.Z
vishalsachdevcanvas-mcppublish-mcp.ymlAlternative: Use API token (legacy method - not recommended):
PYPI_API_TOKEN secret in repository settingspassword: $For manual publishing:
# Install MCP Publisher
curl -fsSL https://modelcontextprotocol.io/install.sh | sh
# Login using GitHub
mcp-publisher login github
# Publish server
mcp-publisher publish
The server.json configuration is automatically validated against the MCP schema during CI/CD. To validate locally:
# Download schema
curl -s https://registry.modelcontextprotocol.io/v0/server.schema.json -o /tmp/mcp-schema.json
# Validate (requires jsonschema CLI)
pip install jsonschema
jsonschema -i server.json /tmp/mcp-schema.json
Contributions are welcome! Feel free to:
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Vishal Sachdev