Skip to main content
Glama

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.

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

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

Related MCP server: swiss-courts-mcp

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 Dashboard → Workers & Pages → Create → Connect 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.0 → 1.0.1)

feat:

Minor (1.0.0 → 1.1.0)

feat!: or BREAKING CHANGE

Major (1.0.0 → 2.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

Available Tools

7 tools
get_caseGet CaseA
Read-only

Get metadata for a specific case including title, citation, decision date, keywords, and URL.

Inputs: caseId (required), databaseId (required), language.

get_case_citationsGet Case CitationsA
Read-only

Get citation information for a case: what it cites, what cites it, or what legislation it references. Note: the CanLII API currently only supports English for this endpoint; French requests will fall back to English.

Inputs: caseId (required), databaseId (required), citationType (required), language.

get_legislationGet LegislationA
Read-only

Get metadata for a specific piece of legislation including title, citation, dates, and repeal status.

Inputs: databaseId (required), legislationId (required), language.

list_case_databasesList Case DatabasesA
Read-only

List all courts and tribunals in the CanLII collection with their database IDs.

Inputs: language.

list_casesList CasesB
Read-only

List decisions from a specific caselaw database. Returns case titles, citations, and IDs.

Inputs: databaseId (required), offset, language, resultCount, +4 more.

list_legislationList LegislationA
Read-only

List statutes or regulations from a specific legislation database.

Inputs: databaseId (required), language.

list_legislation_databasesList Legislation DatabasesA
Read-only

List all legislation and regulation databases in the CanLII collection.

Inputs: language.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a distinct action and resource: getting specific items (legislation, case, citations) versus listing collections (databases, legislation, cases). No overlap or ambiguity exists.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using lowercase with underscores, using either 'get_' for specific resources or 'list_' for collections. The convention is uniform and predictable.

    Tool Count5/5

    Seven tools is well-scoped for a legal document retrieval server. Each tool covers an essential operation without redundancy or bloat.

    Completeness4/5

    The tool set covers metadata retrieval, database listings, and citation graphs, but lacks any search functionality for cases or legislation. This is a notable gap for a legal research API, though the core lookup workflows are complete.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      An MCP server providing AI assistants access to Canadian case law and legislation metadata from CanLII across all jurisdictions, supporting search and citation relationships.
      7
      46 npm
      8
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      MCP server for searching Swiss court decisions from federal and cantonal courts via entscheidsuche.ch. Enables full-text search, law reference lookup, and filtering by canton, court level, and date without API keys.
      8
      47 PyPI
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP server for searching and fetching metadata of Chilean laws, decrees, and resolutions via the BCN Linked Open Data SPARQL endpoint.
      3
      36 PyPI
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      MCP server for Swiss federal legislation metadata via Fedlex, enabling search and retrieval of act details with ELI URIs, SR numbers, and multilingual support.
      3
      34 PyPI
      Apache 2.0