CanLII MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
CanLII MCP Server
A Model Context Protocol (MCP) server that provides access to the CanLII (Canadian Legal Information Institute) API. This server allows AI assistants to search and retrieve Canadian legal information including court decisions, legislation, and legal citations.
Prerequisites
A CanLII API key (obtain from CanLII API)
Node.js 22+ and npm (for local development)
An Apify account (for hosting)
Related MCP server: canlii-mcp
Hosting on Apify
The server runs as an Apify Actor in Standby mode, exposing an MCP Streamable HTTP endpoint at /mcp.
In Apify Console, go to Actors → Develop new → Link Git repository and select this repository (or run
apify pushfrom a local checkout with the Apify CLI).In the Actor's Source → Environment variables, add
CANLII_APIwith your CanLII API key and tick Secret.Click Build. Standby mode is enabled by
.actor/actor.json.Your MCP endpoint is
https://<your-username>--canlii-mcp.apify.actor/mcp. Requests must include your Apify API token asAuthorization: Bearer <APIFY_TOKEN>.
Local Development
npm install
npm run build
CANLII_API=your_canlii_api_key_here PORT=8080 npm startThe MCP endpoint is then available at http://localhost:8080/mcp.
Available Tools
1. get_courts_and_tribunals
Retrieves a list of available courts and tribunals databases.
Parameters:
language(required): "en" or "fr"Optional date filters:
publishedBefore,publishedAfter,modifiedBefore,modifiedAfter,changedBefore,changedAfter,decisionDateBefore,decisionDateAfter
2. get_legislation_databases
Gets available legislation databases (statutes, regulations, etc.).
Parameters:
language(required): "en" or "fr"Optional date filters (same as above)
3. browse_legislation
Browse legislation within a specific database.
Parameters:
language(required): "en" or "fr"databaseId(required): Database code (e.g., "cas" for Canada Statutes, "car" for Canada Regulations)Optional date filters
4. get_legislation_regulation_metadata
Get detailed metadata for a specific piece of legislation.
Parameters:
language(required): "en" or "fr"databaseId(required): Database identifierlegislationId(required): Specific legislation ID
5. get_case_law_decisions
Retrieve case law decisions from a specific database.
Parameters:
language(required): "en" or "fr"databaseId(required): Database identifieroffset(required): Starting record numberresultCount(required): Number of results (max 10,000)Optional date filters
6. get_case_metadata
Get detailed metadata for a specific court case.
Parameters:
language(required): "en" or "fr"databaseId(required): Database identifiercaseId(required): Case identifierOptional date filters
7. get_case_citator
Get citation information for cases (what cases cite this case, what this case cites, etc.).
Parameters:
language(required): "en" or "fr"databaseId(required): Database identifiercaseId(required): Case identifiermetadataType(required): "citedCases", "citingCases", or "citedLegislations"Optional date filters
Connecting an MCP Client
Add the server as a remote (Streamable HTTP) MCP server, using the Apify Standby URL and your Apify token. For example, in Claude Desktop (Settings > Developer > Edit Config) via mcp-remote:
{
"mcpServers": {
"canlii": {
"command": "npx",
"args": [
"mcp-remote",
"https://<your-username>--canlii-mcp.apify.actor/mcp",
"--header",
"Authorization: Bearer ${APIFY_TOKEN}"
],
"env": { "APIFY_TOKEN": "<your-apify-token>" }
}
}
}Usage Examples
Finding Court Decisions
// Get available courts and tribunals
await get_courts_and_tribunals({
language: "en",
});
// Browse recent decisions from Supreme Court of Canada
await get_case_law_decisions({
language: "en",
databaseId: "scc-csc",
offset: 0,
resultCount: 10,
});Searching Legislation
// Get legislation databases
await get_legislation_databases({
language: "en",
});
// Browse federal statutes
await browse_legislation({
language: "en",
databaseId: "cas",
});
// Get specific act metadata
await get_legislation_regulation_metadata({
language: "en",
databaseId: "cas",
legislationId: "criminal-code",
});Case Citations
// Get case metadata
await get_case_metadata({
language: "en",
databaseId: "scc-csc",
caseId: "2023scc1",
});
// Find cases that cite this case
await get_case_citator({
language: "en",
databaseId: "scc-csc",
caseId: "2023scc1",
metadataType: "citingCases",
});Development
Scripts
npm run build- Compile TypeScript todist/npm start- Start the compiled servernpm run dev- Build and startnpm run format- Format code with Biomenpm run lint:fix- Fix linting issuesnpm run type-check- Run TypeScript type checking
Project Structure
.actor/
├── actor.json # Apify Actor config (Standby mode, MCP path)
└── input_schema.json
src/
├── main.ts # HTTP entry point (Streamable HTTP at /mcp)
├── server.ts # MCP server and CanLII tools
└── schema.ts # Zod schemas for API responses
Dockerfile # Apify Actor imageAPI Rate Limits
Be aware of CanLII API rate limits and usage terms. The API is intended for research and educational purposes.
Contributing
Fork the repository
Create a feature branch
Make your changes
Run tests and linting
Submit a pull request
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP for CanLII: Canadian case law and legislation metadata (federal, provincial, territorial).
Search U.S. case law, fetch opinions, and ask matter-aware legal questions over your documents.
Resolve, search and verify legal citations against the official sources, with provenance.
Verify legal citations and search case law and legislation from your AI assistant.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI agents to search AustLII (Australian Legal Information Institute) for real Australian legislation and case law. Provides citations with direct links for legal research and verification.-
- AlicenseAqualityCmaintenanceSearch Canadian case law, browse legislation, and check citations via the CanLII API.966 npm6MIT
- AlicenseAqualityCmaintenanceAn MCP server providing AI assistants access to Canadian case law and legislation metadata from CanLII across all jurisdictions, supporting search and citation relationships.716 npm7MIT
- AlicenseNot gradedqualityDmaintenanceProvides access to the CanLII API for searching and retrieving Canadian legal information, including court decisions, legislation, and citations.28MIT