Install
$ agentstack add mcp-alhwyn-canlii-mcp ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
[](https://mseep.ai/app/alhwyn-canlii-mcp)
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 and npm
- Cloudflare Workers account (for deployment)
Setup
1. Clone and Install Dependencies
git clone
cd canlii-mcp
npm install
2. Configure Environment Variables
Create a .env file or configure your Cloudflare Workers environment with:
CANLII_API=your_canlii_api_key_here
For Cloudflare Workers deployment, set the environment variable using:
wrangler secret put CANLII_API
3. Local Development
npm run dev
This will start the server locally at http://localhost:8787
4. Deploy to Cloudflare Workers
npm run deploy
Available Tools
1. getcourtsand_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. getlegislationdatabases
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. getlegislationregulation_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. getcaselaw_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. getcasemetadata
Get detailed metadata for a specific court case.
Parameters:
language(required): "en" or "fr"databaseId(required): Database identifiercaseId(required): Case identifier- Optional date filters
7. getcasecitator
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 to Claude Desktop
- Install the mcp-remote proxy:
``bash npm install -g mcp-remote ``
- In Claude Desktop, go to Settings > Developer > Edit Config and add:
{
"mcpServers": {
"canlii": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8787/sse"]
}
}
}
For deployed servers, replace the URL with your Cloudflare Workers URL:
https://your-worker-name.your-account.workers.dev/sse
- Restart Claude Desktop
Connecting to Cloudflare AI Playground
- Go to https://playground.ai.cloudflare.com/
- Enter your MCP server URL:
https://your-worker-name.your-account.workers.dev/sse - The CanLII tools will be available in the playground
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 dev- Start local development servernpm run deploy- Deploy to Cloudflare Workersnpm run format- Format code with Biomenpm run lint:fix- Fix linting issuesnpm run type-check- Run TypeScript type checking
Project Structure
src/
├── index.ts # Main MCP server implementation
├── schema.ts # Zod schemas for API responses
└── worker-configuration.d.ts # TypeScript declarations
API 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
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Alhwyn
- Source: Alhwyn/canlii-mcp
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.