{
  "markdown": "# CanLII MCP Server\n\n[![npm version](https://img.shields.io/npm/v/canlii-mcp)](https://www.npmjs.com/package/canlii-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nA [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for searching Canadian legal information via the [CanLII](https://www.canlii.org) API. Search cases, browse legislation, and check citations — all from Claude Desktop or Claude Code.\n\n```bash\nnpx canlii-mcp\n```\n\n## Features\n\n- **Full-text search** — search across all of CanLII by keyword, case name, or legal concept\n- **Case citator** — check if a case is still good law by finding what later cases cite it\n- **Legislation browsing** — browse statutes and regulations by jurisdiction\n- **Bilingual** — English and French support across all tools including the citator\n- **9 tools** — search, browse courts, browse cases, case metadata, full citator, citator preview, legislation databases, browse legislation, legislation metadata\n- **Built-in rate limiting** — serialized request queue respects CanLII's API limits (2 req/sec, 1 concurrent, 5,000/day)\n- **Input validation** — all parameters regex-validated and URI-encoded to prevent injection\n- **Minimal footprint** — 2 runtime dependencies, ~500 lines of code, runs locally as a stdio process\n- **Security-first** — no file system access, no shell execution, only connects to `api.canlii.org`\n\n## Quick Start\n\n**Prerequisites:** Node.js 18+ and a [CanLII API key](https://www.canlii.org/en/feedback/feedback.html) (free for research use).\n\n**Claude Desktop** — add to your config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"canlii\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"canlii-mcp\"],\n      \"env\": {\n        \"CANLII_API_KEY\": \"your_api_key_here\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Desktop after saving.\n\n**Claude Code:**\n\n```bash\nclaude mcp add canlii -e CANLII_API_KEY=your_key -- npx -y canlii-mcp\n```\n\n**From source** (for development):\n\n```bash\ngit clone https://github.com/mohammadfarooqi/canlii-mcp.git\ncd canlii-mcp\nnpm install && npm run build\n```\n\n## Available Tools (9)\n\n### search\n\nFull-text keyword search across all of CanLII — cases, legislation, and commentary. This is the primary entry point for legal research.\n\n```\nsearch({ query: \"material change in circumstances Ontario\", resultCount: 10 })\n```\n\n### get_courts_and_tribunals\n\nList all available court and tribunal databases. Returns database IDs needed by other tools.\n\nKey Ontario databases: `onsc` (Superior Court), `onca` (Court of Appeal), `oncj` (Court of Justice), `csc-scc` (Supreme Court of Canada).\n\n### get_case_law_decisions\n\nBrowse case law decisions from a specific court database, ordered by most recently added. Supports date filters.\n\n```\nget_case_law_decisions({ databaseId: \"onsc\", resultCount: 20 })\n```\n\n### get_case_metadata\n\nGet full details for a specific case — citation, decision date, docket number, keywords, and **CanLII URL** for reading the full decision.\n\n```\nget_case_metadata({ databaseId: \"onsc\", caseId: \"2021onsc8582\" })\n```\n\n### get_case_citator\n\nLook up citation relationships for a case. Use `citingCases` to check if a case is still good law.\n\n```\nget_case_citator({ databaseId: \"csc-scc\", caseId: \"1996canlii190\", metadataType: \"citingCases\" })\n```\n\n### get_case_citator_tease\n\nQuick citation preview returning max 5 results. Faster than the full citator for a quick check.\n\n```\nget_case_citator_tease({ databaseId: \"csc-scc\", caseId: \"1996canlii190\", metadataType: \"citingCases\" })\n```\n\n### get_legislation_databases\n\nList all legislation databases. Ontario: `ons` (Statutes), `onr` (Regulations). Federal: `cas` (Statutes), `car` (Regulations).\n\n### browse_legislation\n\nList legislation items within a specific database.\n\n```\nbrowse_legislation({ databaseId: \"ons\" })\n```\n\n### get_legislation_regulation_metadata\n\nGet metadata for a specific statute or regulation, including its CanLII URL.\n\n## Typical Research Workflow\n\n1. **Search** — `search({ query: \"gatekeeping parenting time\" })` to find relevant cases\n2. **Get details** — `get_case_metadata(...)` to get the full citation and CanLII URL\n3. **Check citations** — `get_case_citator(..., metadataType: \"citingCases\")` to verify the case is still good law\n4. **Read the decision** — Click the CanLII URL to read the full text on canlii.org\n\n## API Rate Limits\n\nPer CanLII's API terms:\n- **5,000 queries per day**\n- **2 requests per second**\n- **1 request at a time**\n- Metadata access only — full document text is not available via the API\n\nThe server enforces these limits automatically with a built-in rate limiter.\n\n## Development\n\n```bash\nnpm run build    # Compile TypeScript\nnpm run start    # Run the server (needs CANLII_API_KEY env var)\n```\n\n### Project Structure\n\n```\nsrc/\n  index.ts     # MCP server — tools, rate limiter, stdio transport\n  schema.ts    # Zod schemas for CanLII API responses\n```\n\n## Contributing\n\nContributions are welcome! This project aims to make Canadian legal research more accessible through AI tooling.\n\n**Ways to contribute:**\n- Report bugs or unexpected API behavior — [open an issue](https://github.com/mohammadfarooqi/canlii-mcp/issues)\n- Suggest new tools or improvements — [start a discussion](https://github.com/mohammadfarooqi/canlii-mcp/issues)\n- Submit a PR with fixes or new features\n\n**To submit a PR:**\n1. Fork this repository\n2. Create a feature branch (`git checkout -b feature/my-improvement`)\n3. Make your changes and test locally (`npm run build && CANLII_API_KEY=your_key npm run start`)\n4. Commit and push to your fork\n5. Open a pull request with a description of what you changed and why\n\nIf you find issues with the CanLII API responses, schema mismatches, or have ideas for new tools that would help legal researchers, please open an issue — even if you're not sure how to fix it. We'll investigate together.\n\n## Security\n\nThis server is designed to be transparent and minimal:\n\n- **Only connects to `api.canlii.org`** — no other network calls, no telemetry, no analytics\n- **API key stays local** — passed via environment variable, never logged or included in responses\n- **All inputs validated** — database IDs, case IDs, and dates are regex-validated before use; path segments are URI-encoded\n- **All API responses validated** — parsed through Zod schemas before being returned\n- **No file system access** — the server only makes HTTPS calls to CanLII\n- **No shell execution** — no `child_process`, `exec`, or `spawn`\n- **2 runtime dependencies** — `@modelcontextprotocol/sdk` (official Anthropic MCP SDK) and `zod` (schema validation)\n- **Rate limiter built in** — serialized request queue prevents API abuse\n- **MIT licensed, fully open source** — read every line at [src/index.ts](src/index.ts) (~350 lines) and [src/schema.ts](src/schema.ts) (~140 lines)\n\nIf you discover a security issue, please see [SECURITY.md](SECURITY.md).\n\n## Known Limitations\n\n- **No decision body text** — full-text *search* works (searching across case titles, citations, and content), but the API cannot return the full text of a decision. You must click the CanLII URL to read the decision on canlii.org. Paragraph numbers and direct quotes need to be verified by reading the source.\n- **Search is keyword-based, not semantic** — queries like \"mother gatekeeping sole decision-making\" may return mixed results. Refine queries and check case titles before drilling into metadata.\n- **Search results don't include case details** — search returns only citations and titles. You need to call `get_case_metadata` separately for each case to get keywords, topics, decision date, and the CanLII URL.\n- **No treatment indicators** — the citator shows what cases cite a decision, but does not indicate whether it was followed, distinguished, or overturned. You need to read the citing cases to determine treatment.\n- **Citator tease caps at 5 results** — use `get_case_citator` (full version) for comprehensive citation analysis.\n- **Search has no database/jurisdiction filter** — you cannot limit search results to a specific court or province server-side; add jurisdiction keywords to your query instead (e.g., \"custody Ontario\" instead of just \"custody\").\n- **Search endpoint is undocumented** — it works but is not in CanLII's official API docs, so it could change without notice.\n- **Rate limits are strict** — 5,000 queries/day, 2 req/sec, 1 concurrent request (enforced automatically by the built-in rate limiter).\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n",
  "bytes": 8587,
  "sha": "d79a7883e5eb846ffb66136896d8a1a5e48494d70433d7f8bbbaca687e6f6b7a",
  "repo_slug": "mohammadfarooqi/canlii-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_mohammadfarooqi_canlii_02abba20/readme"
}