canvascli

package module
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 2 Imported by: 0

README

Canvas CLI

CI codecov Go Version License Release Go Report Card Go Reference Ask DeepWiki

A powerful command-line interface for Canvas LMS, built with Go.

Documentation · Installation · Commands


Features

  • Secure Authentication - OAuth 2.0 with PKCE, system keyring integration
  • Multi-Instance - Manage multiple Canvas instances from one CLI
  • Smart Rate Limiting - Adaptive throttling based on API quotas
  • Multiple Outputs - Table, JSON, YAML, and CSV formats
  • Interactive Mode - REPL shell with command history and completion
  • 265 Commands - Full coverage of Canvas LMS resources
  • MCP Server - Use as an AI agent tool via Model Context Protocol

Installation

Homebrew (macOS/Linux)

brew tap jjuanrivvera/canvas-cli
brew install canvas-cli

Go Install

Requires Go 1.25+ (or Go 1.24+ with automatic toolchain download).

go install github.com/jjuanrivvera/canvas-cli/cmd/canvas@latest

Docker

docker run --rm ghcr.io/jjuanrivvera/canvas-cli:latest version

Images are published to GHCR for every release (:latest, :v1, and exact versions). Pass credentials via environment variables:

docker run --rm -e CANVAS_URL -e CANVAS_TOKEN ghcr.io/jjuanrivvera/canvas-cli:latest courses list

Binary Download

Download from GitHub Releases. Release checksums are signed with cosign (keyless) and archives ship with SBOMs — verification instructions are in the .goreleaser.yaml signs section.

Quick Start

# Authenticate with your Canvas instance
canvas auth login https://your-school.instructure.com

# List your courses
canvas courses list

# Get assignments for a course
canvas assignments list --course-id <course-id>

# Start interactive mode
canvas shell

Command Overview

Category Commands
Auth login, logout, status
Courses list, get, create, update, delete
Assignments list, get, create, update, delete, bulk-update
Submissions list, get, grade, bulk-grade, comments
Users me, list, get, create, update
Enrollments list, get, create, update, delete, accept
Modules list, get, create, update, delete, publish, items
Pages list, get, create, update, delete, front, revisions
Discussions list, get, create, entries, post, reply, subscribe
Announcements list, get, create, update, delete
Quizzes list, get, create, update, delete, questions, submissions
Grades summary, history, bulk-update, final, current
Groups list, get, create, update, delete, users, categories
Outcomes list, get, create, update, delete, groups, results
Rubrics list, get, create, update, delete, associate
Conversations list, get, create, reply, archive, star, batch-update
Calendar list, get, create, update, delete, reserve
Files list, get, upload, download, delete
Sections list, get, create, update, delete, crosslist
Admin admins, roles, analytics, blueprint, sis-imports
Utilities shell, doctor, webhook, api, version

See full command reference for all options and flags.

Configuration

# ~/.canvas-cli/config.yaml
default_instance: myschool
instances:
  myschool:
    url: https://myschool.instructure.com
    client_id: your-client-id
settings:
  default_output_format: table
  cache_enabled: true

See Authentication Guide for detailed setup.

MCP Server Mode

Canvas CLI can also run as an MCP server, exposing 253 of its 265 commands as tools for AI coding agents (Claude Code, Cursor, VS Code Copilot). Only the canvas mcp management commands themselves are excluded.

# Start as STDIO MCP server
canvas mcp start

# Start as HTTP MCP server
canvas mcp stream --port 8080

# Export all tool schemas to JSON
canvas mcp tools

# Auto-configure in your editor
canvas mcp claude enable
canvas mcp vscode enable
canvas mcp cursor enable

The same binary, two interfaces. When used as an MCP server, each CLI command becomes an MCP tool with typed parameters derived from the command's flags. Required flags become required schema properties. All output goes through structured JSON.

Sensitive flags (--show-token, --config) are automatically excluded from MCP exposure.

Note for go install users: MCP support requires Go 1.25+ due to the MCP Go SDK dependency. Homebrew and binary downloads are not affected by this requirement.

For full setup (Claude Desktop, Claude Code CLI, Cursor, VS Code, OpenCode, Codex), auth precedence, and troubleshooting, see:

AI Agent Skill

Canvas CLI ships an agent skill that teaches AI coding agents (Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Copilot, …) how to drive it — commands, flags, safety rules (--dry-run previews), and common grading/content workflows. Install the skill across every agent you have with one command:

npx skills add jjuanrivvera/canvas-cli

Or use one of the built-in / native paths:

canvas skills install --global              # write the bundled skill (no Node needed)
canvas skills install --agent cursor        # target a specific agent

# Native Claude Code plugin:
#   /plugin marketplace add jjuanrivvera/canvas-cli
#   /plugin install canvas-cli@canvas

The skill wraps this binary, so install the CLI (above) and authenticate first. For structured tool access (Claude Desktop, etc.) use the MCP server mode described above — the two can coexist.

See the Agent Skill guide for details.

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

MIT License

Documentation

Overview

Package canvascli embeds the agent-skill assets (SKILL.md + references) into the binary so `canvas skills install` can write them into an AI agent's skills directory. The same files under skills/canvas-cli/ are what `npx skills add jjuanrivvera/canvas-cli` and the Claude Code plugin consume.

Index

Constants

View Source
const SkillName = "canvas-cli"

SkillName is the directory the skill installs into within an agent's skills dir.

Variables

View Source
var SkillFS = mustSub(embedded, "skills/"+SkillName)

SkillFS is rooted at the skill directory, so it contains SKILL.md and references/ at its top level.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
canvas command
internal/logging
Package logging provides structured logging for commands
Package logging provides structured logging for commands
internal/options
Package options provides option structs for commands to eliminate global state.
Package options provides option structs for commands to eliminate global state.
testing
Package testing provides a test framework for command testing
Package testing provides a test framework for command testing
internal
api
update
Package update provides auto-update functionality for the CLI.
Package update provides auto-update functionality for the CLI.
tools
gendocs command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL