canlii-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@canlii-mcpsearch for Supreme Court case R v Oakes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 all courts and tribunals in the CanLII collection |
| Browse decisions from a specific court/tribunal database |
| Get metadata for a specific case (title, citation, date, keywords) |
| Get cases cited by a case, cases citing it, or legislation it references |
| List all statute and regulation databases |
| Browse statutes or regulations from a specific database |
| Get metadata for a specific piece of legislation |
Related MCP server: swiss-courts-mcp
Requirements
Node.js 22+
A CanLII API key — apply here
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.jsAdd 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 httpThe 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-mcpOr 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 deployDashboard deploy (Connect to Git)
Go to Cloudflare Dashboard → Workers & Pages → Create → Connect to Git
Select your
tomilashy/canlii-mcprepositoryOn the Set up your application page:
Project name:
canlii-mcpBuild command:
npm install && npm run buildDeploy command:
npx wrangler deploy(pre-filled)
Expand Advanced settings:
Variable name:
CANLII_APIVariable value: your CanLII API key
Check Encrypt to store it as a secret
Click Deploy
The MCP endpoint will be at https://canlii-mcp.<your-subdomain>.workers.dev/mcp.
Configuration
Environment Variable | Required | Default | Description |
| Yes | — | Your CanLII API key |
| No |
| HTTP server port (HTTP mode only) |
| No | — | Bearer token for HTTP authentication. If set, all HTTP requests must include |
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 modeRelease
This project uses Semantic Versioning via semantic-release. Commit messages follow the Conventional Commits spec:
Commit prefix | Release type |
| Patch ( |
| Minor ( |
| Major ( |
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 toolsget_caseGet CaseARead-only
Get metadata for a specific case including title, citation, decision date, keywords, and URL.
| Name | Required | Description | Default |
|---|---|---|---|
| caseId | Yes | Case ID from list_cases (e.g. "2008scc9") | |
| language | No | Response language | en |
| databaseId | Yes | Database ID (e.g. "csc-scc") |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already provide readOnlyHint: true, so the read-only nature is known. The description adds behavioral context by specifying the type of data returned (metadata fields), which goes beyond the annotation. However, it does not mention response language behavior or potential limitations, so it's not a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that leads with the verb and object, then concisely lists the returned fields. Every word is informative with no redundancy, making it easily scannable for an AI agent.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description carries responsibility for explaining return values, and it does so by listing the main metadata fields. It adequately covers the essential behavior for a simple read-only tool, though it omits details like response structure or error handling. Given the tool's simplicity and the provided schema, this is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema descriptions cover 100% of parameters, each with clear meaning (caseId from list_cases, language enum, databaseId example). The description adds no additional parameter semantics beyond what the schema already provides, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Get') and clearly identifies the resource ('metadata for a specific case') while listing the key fields returned (title, citation, decision date, keywords, URL). This differentiates it from sibling tools like get_legislation (which targets legislation) and get_case_citations (which returns citations) by focusing on case metadata retrieval.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when you need metadata for a specific case rather than a list (list_cases) or legislation (get_legislation), but it does not explicitly state when to use this tool versus alternatives. It lacks any exclusion criteria or direct reference to sibling tools, so guidance is only implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_case_citationsGet Case CitationsARead-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.
| Name | Required | Description | Default |
|---|---|---|---|
| caseId | Yes | Case ID (e.g. "1999canlii1527") | |
| language | No | Response language (currently only 'en' is supported by the API) | en |
| databaseId | Yes | Database ID (e.g. "onca") | |
| citationType | Yes | Type of citation data to retrieve |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide readOnlyHint=true, and the description adds valuable behavioral context by noting that the API only supports English for this endpoint, with French requests falling back to English. This is beyond what annotations convey and helps set expectations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description consists of two succinct sentences: the first states the tool's purpose, and the second adds a critical language constraint. Every word earns its place, with no fluff or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only lookup tool, the description covers the core purpose and a key limitation. Although there is no output schema, the nature of citation data is self-explanatory, and the added language note addresses a potential edge case. A bit more detail on response structure would elevate it further, but current coverage is solid.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage for all four parameters, including enums and examples. The description does not add additional parameter-level meaning beyond what the schema already provides, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states 'Get citation information for a case' and enumerates the three types of data (what it cites, what cites it, legislation referenced), making the tool's purpose unmistakable. It clearly distinguishes from sibling tools like get_case or get_legislation by focusing solely on citation data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a clear context for when to use the tool—when citation data is needed—but it does not explicitly name alternatives or when-not-to-use scenarios. This is clear guidance without exclusions, warranting a 4 rather than a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_legislationGet LegislationARead-only
Get metadata for a specific piece of legislation including title, citation, dates, and repeal status.
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Response language | en |
| databaseId | Yes | Legislation database ID | |
| legislationId | Yes | Legislation ID from list_legislation (e.g. "rso-1990-c-a1") |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds return-field details ('including title, citation, dates, and repeal status') which is useful context beyond annotations. However, it does not disclose any potential behavioral quirks like error handling, response format, or language-specific variations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that states the core purpose, omits any fluff, and includes the most relevant details about the returned metadata. It is optimally concise for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (3 params, no output schema), the description adequately explains the return content (title, citation, dates, repeal status). It covers the essential purpose and fields, though it could benefit from a note about using it after list_legislation, which is already hinted in the schema. The absence of an output schema makes the field enumeration valuable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with all three parameters (language, databaseId, legislationId) having clear descriptions. The tool description does not add any parameter-specific meaning beyond what the schema already provides, so it meets the baseline but does not exceed it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Get metadata for a specific piece of legislation' with a specific verb ('Get') and resource ('legislation'), distinguishing it from sibling tools like 'list_legislation' which lists multiple items. It also enumerates the key fields returned (title, citation, dates, repeal status).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is only implied by the phrase 'specific piece of legislation' and the legislationId schema description referencing 'list_legislation'. There is no explicit statement about when to use this tool versus list_legislation or get_case, nor any exclusions. The example in the schema helps but the description itself lacks clear guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_case_databasesList Case DatabasesARead-only
List all courts and tribunals in the CanLII collection with their database IDs.
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Response language | en |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, and the description's 'List' wording is consistent. It adds scope context (all courts/tribunals, database IDs) but does not provide additional behavioral details like pagination or response format.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, starts with the verb, contains zero filler, and fully conveys the operation in a clear front-loaded manner.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Low complexity (one optional param), schema covers all params, readOnly annotation present, and description states the resource scope and output fields; no major gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema fully documents the single optional language parameter (100% coverage, enum en/fr, default en). The description adds no parameter-specific information, so baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description uses specific verb 'List' with resource 'courts and tribunals in the CanLII collection' and output 'database IDs', clearly distinguishing from sibling list_legislation_databases which covers a different resource.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus list_legislation_databases or list_cases; usage is only implied by the clear resource scope. No alternatives or exclusions are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_casesList CasesBRead-only
List decisions from a specific caselaw database. Returns case titles, citations, and IDs.
| Name | Required | Description | Default |
|---|---|---|---|
| offset | No | Starting record index | |
| language | No | Response language | en |
| databaseId | Yes | Database ID from list_case_databases (e.g. "onca", "csc-scc") | |
| resultCount | No | Number of results to return (max 10000) | |
| publishedAfter | No | Filter: published on CanLII after this date (YYYY-MM-DD) | |
| publishedBefore | No | Filter: published on CanLII before this date (YYYY-MM-DD) | |
| decisionDateAfter | No | Filter: decision date after (YYYY-MM-DD) | |
| decisionDateBefore | No | Filter: decision date before (YYYY-MM-DD) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations declare readOnlyHint=true, and the description does not contradict this. The description adds a useful behavioral detail by stating that it returns case titles, citations, and IDs, but it does not disclose pagination behavior, default ordering, or how filters and offset/resultCount affect results. With read-only safety already covered by annotations, this is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler. It front-loads the action and return value, making it easy to scan. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a list endpoint with 8 parameters and no output schema, the description provides only minimal return-value information and no overview of pagination or filter combinations. However, the schema's 100% parameter descriptions and readOnlyHint annotation compensate for some gaps. It is minimally adequate but could benefit from mentioning how to page through results and the role of list_case_databases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and all parameters have descriptions. The tool description does not add additional parameter-level meaning beyond the schema; it only restates that decisions come from a specific database, which aligns with the databaseId parameter. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('List') and identifies the resource ('decisions from a caselaw database'), and it mentions the returned fields (titles, citations, IDs). It is distinguishable from siblings like get_case or list_legislation, though it does not explicitly name an alternative as in the high-calibration example.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided about when to use this tool versus get_case, get_case_citations, or list_case_databases. The phrase 'specific caselaw database' hints that a databaseId is needed, but this is only fully spelled out in the schema, not in the description itself. No when-not or alternative tool is mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_legislationList LegislationARead-only
List statutes or regulations from a specific legislation database.
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Response language | en |
| databaseId | Yes | Legislation database ID from list_legislation_databases (e.g. "ons" for Ontario statutes) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The readOnlyHint annotation already communicates that this is a safe read operation. The description adds that it returns statutes or regulations, providing basic output context. It does not disclose pagination, ordering, or filtering behavior, but for a simple listing with annotations, this is adequate. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single clear sentence, front-loaded with the verb and resource. It contains no redundant words and efficiently conveys the core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple listing tool with two parameters, a clear description, and a readOnlyHint, the provided context is sufficient. The lack of an output schema is not critical since the name and description indicate a list return. The workflow dependency on list_legislation_databases is captured in the schema description, helping completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both language and databaseId are already well-documented. The description's phrase 'from a specific legislation database' aligns with the databaseId parameter but does not add new semantic information beyond the schema. Baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description specifies the action (list) and the resource (statutes or regulations from a specific legislation database), clearly distinguishing it from sibling tools like list_legislation_databases (which lists databases) and get_legislation (which retrieves a single item). The phrase 'specific legislation database' signals the required databaseId.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is implied by the required databaseId and the schema's reference to list_legislation_databases as the source of IDs. However, the description itself does not explicitly state when to use this tool versus alternatives like get_legislation, nor does it mention any exclusions. The guidance is present but only implicitly via schema.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_legislation_databasesList Legislation DatabasesARead-only
List all legislation and regulation databases in the CanLII collection.
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Response language | en |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, and the description adds the behavioral detail that it lists 'all' databases, indicating a comprehensive response. It also specifies the collection scope ('CanLII'), giving the agent context about the data source, but does not detail output format or pagination behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, specific sentence with no filler, front-loads the action verb, and earns its place by clarifying the resource scope.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the low complexity, presence of readOnly annotation, and complete schema coverage, the description sufficiently defines the tool's behavior for an agent. It lacks an output schema but listing tools typically return a simple list, and the description sufficiently scopes the return value.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides full coverage for the single 'language' parameter, including enum values, default, and description. The tool description itself does not address the parameter, which is acceptable since the schema carries all necessary semantic information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the specific verb 'List' and clearly identifies the resource as 'legislation and regulation databases in the CanLII collection,' which distinguishes it from sibling tools like 'list_legislation' and 'list_case_databases.' It unmistakably conveys the tool's function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
While it lacks explicit references to alternatives or exclusions, the description clearly implies usage when one needs to enumerate legislation/regulation databases, making the context of use transparent. No specific 'when not to use' is stated, but the tool's name and description draw a clear boundary.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
7 tool updates
v1.0.3- First observed
get_case - First observed
get_case_citations - First observed
get_legislation - First observed
list_case_databases - First observed
list_cases - First observed
list_legislation - First observed
list_legislation_databases
TDQS
Scored across 7 tools
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.
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.
Seven tools is well-scoped for a legal document retrieval server. Each tool covers an essential operation without redundancy or bloat.
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
Related MCP Connectors
MCP for CanLII: Canadian case law and legislation metadata (federal, provincial, territorial).
Canonical British Columbia Property Intelligence & Risk Screening MCP Server.
Hosted MCP server for finding authoritative primary data sources and official portals.
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server providing AI assistants access to Canadian case law and legislation metadata from CanLII across all jurisdictions, supporting search and citation relationships.76 npm5MIT
- AlicenseAqualityAmaintenanceMCP 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.81MIT
- AlicenseAqualityAmaintenanceMCP server for searching and fetching metadata of Chilean laws, decrees, and resolutions via the BCN Linked Open Data SPARQL endpoint.3Apache 2.0
- AlicenseAqualityAmaintenanceMCP server for Swiss federal legislation metadata via Fedlex, enabling search and retrieval of act details with ELI URIs, SR numbers, and multilingual support.3Apache 2.0