canlii-mcp

canlii-mcp

An MCP server providing AI assistants access to Canadian case law and legislation metadata from CanLII across all jurisdictions, supporting search and citation relationships.

Category
Visit Server

README

canlii-mcp

An MCP (Model Context Protocol) server for the CanLII Canadian legal information API. Gives AI assistants access to Canadian case law and legislation metadata across all federal, provincial, and territorial jurisdictions.

Forked from tomilashy/canlii-mcp. This fork adds bring-your-own-key (BYOK) auth, a /health route, and a hosted endpoint at canlii-mcp.vaquill.ai. Tools are unchanged.

Note: The CanLII API provides metadata only — titles, citations, dates, keywords, and citation relationships. Full document text is not available through the API.

Use the hosted endpoint (no install)

https://canlii-mcp.vaquill.ai/mcp

Two headers are required for the hosted instance:

  • Authorization: Bearer <MCP_AUTH_TOKEN> — gates access to the MCP server itself
  • X-CanLII-Token: <your_canlii_api_key> — your CanLII key. Apply at canlii.org/en/api/. The server never stores your key.

Claude Desktop / Claude Code

{
  "mcpServers": {
    "canlii": {
      "url": "https://canlii-mcp.vaquill.ai/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_TOKEN",
        "X-CanLII-Token": "YOUR_CANLII_API_KEY"
      }
    }
  }
}

Cursor / VS Code / Windsurf

Same pattern: any client supporting MCP streamable HTTP with custom headers works. For stdio-only clients use mcp-remote to proxy.

Authentication

Mode Header When
BYOK (preferred) X-CanLII-Token: <key> Hosted / shared deployments
Server fallback (env CANLII_API) Self-hosted single-tenant. Required for stdio.
MCP gate Authorization: Bearer <MCP_AUTH_TOKEN> Optional. Restricts who may use the hosted endpoint.

Tools

Tool Description
list_case_databases List all courts and tribunals in the CanLII collection
list_cases Browse decisions from a specific court/tribunal database
get_case Get metadata for a specific case (title, citation, date, keywords)
get_case_citations Get cases cited by a case, cases citing it, or legislation it references
list_legislation_databases List all statute and regulation databases
list_legislation Browse statutes or regulations from a specific database
get_legislation Get metadata for a specific piece of legislation

Requirements

Usage

stdio via npx (quickest)

{
  "mcpServers": {
    "canlii": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@tomilashy/canlii-mcp"],
      "env": {
        "CANLII_API": "your_api_key"
      }
    }
  }
}

stdio (from source)

npm install
npm run build
node dist/index.js

Add to your MCP config:

{
  "mcpServers": {
    "canlii": {
      "command": "node",
      "args": ["/path/to/canlii-mcp/dist/index.js"],
      "env": {
        "CANLII_API": "your_api_key"
      }
    }
  }
}

HTTP server

PORT=3000 CANLII_API=your_api_key node dist/index.js --transport http

The MCP endpoint is available at http://localhost:3000/mcp. The server runs in stateless mode — each request is self-contained, no session ID or initialize handshake required. Clients can call tools directly:

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_case_databases","arguments":{"language":"en"}}}'

Docker

docker run -e CANLII_API=your_api_key -e MCP_AUTH_TOKEN=your_secret -p 3000:3000 ghcr.io/tomilashy/canlii-mcp

Or with Docker Compose:

services:
  canlii-mcp:
    image: ghcr.io/tomilashy/canlii-mcp
    environment:
      CANLII_API: your_api_key
      MCP_AUTH_TOKEN: your_secret  # optional
    ports:
      - "3000:3000"

Cloudflare Workers

The server includes a Workers-compatible entry point (src/worker.ts).

CLI deploy

npx wrangler secret put CANLII_API
npx wrangler secret put MCP_AUTH_TOKEN  # optional
npx wrangler deploy

Dashboard deploy (Connect to Git)

  1. Go to Cloudflare DashboardWorkers & PagesCreateConnect to Git
  2. Select your tomilashy/canlii-mcp repository
  3. On the Set up your application page:
    • Project name: canlii-mcp
    • Build command: npm install && npm run build
    • Deploy command: npx wrangler deploy (pre-filled)
  4. Expand Advanced settings:
    • Variable name: CANLII_API
    • Variable value: your CanLII API key
    • Check Encrypt to store it as a secret
  5. Click Deploy

The MCP endpoint will be at https://canlii-mcp.<your-subdomain>.workers.dev/mcp.

Configuration

Environment Variable Required Default Description
CANLII_API Yes Your CanLII API key
PORT No 3000 HTTP server port (HTTP mode only)
MCP_AUTH_TOKEN No Bearer token for HTTP authentication. If set, all HTTP requests must include Authorization: Bearer <token>. If not set, the server runs without authentication.

Rate Limits

The server enforces CanLII's API limits automatically:

  • 1 request at a time
  • 2 requests per second
  • 5,000 requests per day

Requests that exceed the daily limit return an error rather than hitting the API.

Development

npm install
npm run build      # compile TypeScript
npm run watch      # watch mode

Release

This project uses Semantic Versioning via semantic-release. Commit messages follow the Conventional Commits spec:

Commit prefix Release type
fix: Patch (1.0.01.0.1)
feat: Minor (1.0.01.1.0)
feat!: or BREAKING CHANGE Major (1.0.02.0.0)

Pushing to main triggers the release workflow. If a release is cut, the Docker image is automatically built and published to ghcr.io.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured