Purpose
canlii-mcp is an MCP (Model Context Protocol) server for interfacing with the CanLII Canadian legal information API, enabling AI assistants to retrieve case law and legislation metadata for Canada's federal, provincial, and territorial jurisdictions. The server can be used with clients such as Claude, Cursor, VS Code, and Windsurf.
Main capabilities
- Provides access to Canadian case law and legislation metadata.
- Supports use via a hosted endpoint with no installation required.
- Supports bring-your-own-key (BYOK) authentication.
- Provides a /health route.
- Automatically enforces API rate limits per CanLII key.
Important limitations
The CanLII API provides metadata only—titles, citations, dates, keywords, and citation relationships. Full document text is not available through this API.
Usage
Using the hosted endpoint (no installation required)
The hosted instance is public and does not require a Vaquill token. You must provide your own CanLII key in one of the following two ways:
- Request header (recommended, keeps the key out of the URL):
X-CanLII-Token: <your_canlii_api_key> - URL parameter (simplest, suitable for headerless clients such as the Claude Desktop connector UI and the claude.ai web interface): append
?token=<your_canlii_api_key>to the URL, for example:https://canlii-mcp.vaquill.ai/mcp?token=YOUR_CANLII_API_KEY
You can apply for a key through the CanLII API request form. The server does not store your key and has no server-side fallback key, so every call counts against your own CanLII quota.
Client compatibility
Works with Claude Desktop / Claude Code, Cursor / VS Code / Windsurf. Any client that supports MCP streamable HTTP with custom request headers can use it; clients that support only stdio can use mcp-remote as a proxy.
stdio method
- Via npx (quickest)
- Run from source
After adding it to your MCP configuration, the MCP endpoint is http://localhost:3000/mcp. The server runs in stateless mode—each request is self-contained, with no session ID or initialization handshake required. Clients can call tools directly.
Docker Compose
It can also be run with Docker Compose.
Deploying to Cloudflare Workers
The server includes a Workers-compatible entry point (src/worker.ts).
Steps:
- Go to Cloudflare Dashboard → Workers & Pages → Create → Connect to Git.
- Select the tomilashy/canlii-mcp repository.
- On the Set up your application page, fill in:
- Project name:
canlii-mcp - Build command:
npm install && npm run build - Deploy command:
npx wrangler deploy(pre-filled)
- Project name:
- Expand Advanced settings:
- Variable name:
CANLII_API - Variable value: your CanLII API key
- Check Encrypt to store it as a secret
- Variable name:
The MCP endpoint will be at https://canlii-mcp.<your-subdomain>.workers.dev/mcp.
Rate limits
The server automatically enforces CanLII's API limits per CanLII key, so one caller's usage does not limit another caller:
- 1 concurrent request
- 2 requests per second
- 5000 requests per day
These limits match CanLII's own per-key limits. Each X-CanLII-Token Has an independent quota (keyed by key hash; the original key is not retained). Requests exceeding the daily limit return an error instead of accessing the API.
Use Cases
Suitable for legal workflows that need to retrieve Canadian case law and legislation metadata (such as titles, citations, dates, keywords, and citation relationships) within AI assistants. Because the API provides only metadata, it is not suitable for scenarios that require full judgment texts or the body of statutes and regulations.
Additional Information
The project uses Semantic Versioning and is managed via semantic-release. Commit messages follow the Conventional Commits specification. Pushing to main triggers the release workflow; if a release occurs, the Docker image is automatically built and published to ghcr.io. You can join the Vaquill community via Discord to ask questions, exchange ideas, or contribute.