canvas mcp
A local server that enables interaction with Canvas Learning Management System API through Claude Desktop, allowing users to manage courses, access assignments, view announcements, and retrieve course materials.
A local server that enables interaction with Canvas Learning Management System API through Claude Desktop, allowing users to manage courses, access assignments, view announcements, and retrieve course materials.
This repository contains a Message Control Protocol (MCP) server implementation for interacting with the Canvas Learning Management System API. The server is designed to work with Claude Desktop and potentially other MCP clients.
The Canvas MCP Server provides a local interface to Canvas LMS API, allowing you to: - List and manage courses - Access assignments and submissions - View announcements - Retrieve course syllabi and modules - Manage users and enrollments - Generate course summaries
Clone this repository:
git clone https://github.com/vishalsachdev/canvas-mcp.git
cd canvas-mcp
Create and activate a virtual environment:
python -m venv canvas-mcp
source canvas-mcp/bin/activate # On Unix/macOS
Install dependencies:
pip install -r requirements.txt
Create a .env
file in the root directory with the following variables:
CANVAS_API_TOKEN=your_canvas_api_token_here
CANVAS_API_URL=https://canvas.youruniversity.edu/api/v1
Replace the values with: - Your Canvas API Token (How to get your Canvas API token) - Your university's Canvas API URL
The start_canvas_server.sh
script is already configured to:
- Load environment variables from the .env
file
- Activate the virtual environment
- Run the cached server implementation
Make the start script executable:
chmod +x start_canvas_server.sh
Install Claude Desktop if you haven't already.
Create or edit the Claude Desktop configuration file:
vim ~/Library/Application Support/Claude/claude_desktop_config.json
Add the Canvas MCP server configuration:
{
"mcpServers": [
{
"name": "canvas-api",
"command": "/Users/YOUR_USERNAME/path/to/canvas-mcp/start_canvas_server.sh"
}
]
}
Replace /Users/YOUR_USERNAME/path/to/canvas-mcp
with the absolute path to where you cloned this repository.
The server provides the following tools for Canvas LMS interaction:
list_courses
: List all courses for the authenticated userget_course_details
: Get detailed information about a specific coursesummarize_course
: Generate a comprehensive summary of a courselist_assignments
: List all assignments for a courseget_assignment_details
: Get detailed information about a specific assignmentget_assignment_description
: Get the full description of an assignmentlist_submissions
: List all submissions for a specific assignmentlist_users
: List all users enrolled in a courselist_announcements
: List all announcements for a courseget_course_syllabus
: Get the syllabus for a courseget_course_modules
: Get all modules for a courseThis MCP server is designed to work seamlessly with Claude Desktop:
For manual testing, you can start the server directly:
./start_canvas_server.sh
The server uses:
- fastmcp
: A Python library for building MCP servers
- httpx
: For asynchronous HTTP requests to the Canvas API
- Caching mechanisms to improve performance for course lookups
The main implementation file is canvas_server_cached.py
, which provides:
- Efficient caching of course information
- Pagination handling for Canvas API requests
- Error handling and reporting
- Support for both course IDs and course codes
The server requires the following Python packages:
- httpx
: For HTTP requests
- fastmcp
: For MCP server implementation
- requests
: For some HTTP operations
- Other standard libraries for encoding and networking
If you encounter issues:
.env
file exists and contains valid credentialsstart_canvas_server.sh
Ensure all dependencies are installed
Authentication Errors
Check that you have the necessary permissions in Canvas
Connection Issues
Verify your institution hasn't restricted API access
Debugging
.env
file to version controlContributions are welcome! Feel free to: - Submit issues for bugs or feature requests - Create pull requests with improvements - Share your use cases and feedback
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Vishal Sachdev