
Canlii
io.github.mohammadfarooqi由 GitHub 账号 mohammadfarooqi 发布v1.1.4更新于 Oct 24, 2026
Search Canadian case law, browse legislation, and check citations via the CanLII API.
概览
一个本地 MCP 服务器,让助手通过 CanLII API 检索加拿大判例法、浏览法规并查看引证关系。
- 可以做什么
- 按关键词或法律概念全文检索 CanLII 的判例、立法和评论,支持英文和法文,并提供快速引证预览和完整引证工具。列出法院和法庭数据库,按日期筛选浏览指定法院的最新判决,获取引文、判决日期、案卷号、关键词和 CanLII 链接等案件元数据。列出立法数据库,按辖区浏览法规和条例,并获取特定法规或条例的元数据。
- 适用场景
- 适合加拿大法律研究:查找相关判例、确认某判决是否仍被援引、按辖区定位法规或条例。当你需要元数据和引证、并打算自行在 CanLII 上阅读判决全文时最合适。
- 运行要求
- 通过 stdio 在本地运行,通常使用 npx,因此需要 Node.js 18 或更高版本。需要在 CANLII_API_KEY 环境变量中提供 CanLII API 密钥,研究用途可免费申请。需要访问 CanLII API 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 Canlii,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
CanLII MCP Server
A Model Context Protocol (MCP) server for searching Canadian legal information via the CanLII API. Search cases, browse legislation, and check citations — all from Claude Desktop or Claude Code.
Features
- Full-text search — search across all of CanLII by keyword, case name, or legal concept
- Case citator — check if a case is still good law by finding what later cases cite it
- Legislation browsing — browse statutes and regulations by jurisdiction
- Bilingual — English and French support across all tools including the citator
- 9 tools — search, browse courts, browse cases, case metadata, full citator, citator preview, legislation databases, browse legislation, legislation metadata
- Built-in rate limiting — serialized request queue respects CanLII's API limits (2 req/sec, 1 concurrent, 5,000/day)
- Input validation — all parameters regex-validated and URI-encoded to prevent injection
- Minimal footprint — 2 runtime dependencies, ~500 lines of code, runs locally as a stdio process
- Security-first — no file system access, no shell execution, only connects to
api.canlii.org
Quick Start
Prerequisites: Node.js 18+ and a CanLII API key (free for research use).
Claude Desktop — add to your config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Restart Claude Desktop after saving.
Claude Code:
From source (for development):
Available Tools (9)
search
Full-text keyword search across all of CanLII — cases, legislation, and commentary. This is the primary entry point for legal research.
get_courts_and_tribunals
List all available court and tribunal databases. Returns database IDs needed by other tools.
Key Ontario databases: onsc (Superior Court), onca (Court of Appeal), oncj (Court of Justice), csc-scc (Supreme Court of Canada).
get_case_law_decisions
Browse case law decisions from a specific court database, ordered by most recently added. Supports date filters.
get_case_metadata
Get full details for a specific case — citation, decision date, docket number, keywords, and CanLII URL for reading the full decision.
get_case_citator
Look up citation relationships for a case. Use citingCases to check if a case is still good law.
get_case_citator_tease
Quick citation preview returning max 5 results. Faster than the full citator for a quick check.
get_legislation_databases
List all legislation databases. Ontario: ons (Statutes), onr (Regulations). Federal: cas (Statutes), car (Regulations).
browse_legislation
List legislation items within a specific database.
get_legislation_regulation_metadata
Get metadata for a specific statute or regulation, including its CanLII URL.
Typical Research Workflow
- Search —
search({ query: "gatekeeping parenting time" })to find relevant cases - Get details —
get_case_metadata(...)to get the full citation and CanLII URL - Check citations —
get_case_citator(..., metadataType: "citingCases")to verify the case is still good law - Read the decision — Click the CanLII URL to read the full text on canlii.org
API Rate Limits
Per CanLII's API terms:
- 5,000 queries per day
- 2 requests per second
- 1 request at a time
- Metadata access only — full document text is not available via the API
The server enforces these limits automatically with a built-in rate limiter.
Development
Project Structure
Contributing
Contributions are welcome! This project aims to make Canadian legal research more accessible through AI tooling.
Ways to contribute:
- Report bugs or unexpected API behavior — open an issue
- Suggest new tools or improvements — start a discussion
- Submit a PR with fixes or new features
To submit a PR:
- Fork this repository
- Create a feature branch (
git checkout -b feature/my-improvement) - Make your changes and test locally (
npm run build && CANLII_API_KEY=your_key npm run start) - Commit and push to your fork
- Open a pull request with a description of what you changed and why
If 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.
Security
This server is designed to be transparent and minimal:
- Only connects to
api.canlii.org— no other network calls, no telemetry, no analytics - API key stays local — passed via environment variable, never logged or included in responses
- All inputs validated — database IDs, case IDs, and dates are regex-validated before use; path segments are URI-encoded
- All API responses validated — parsed through Zod schemas before being returned
- No file system access — the server only makes HTTPS calls to CanLII
- No shell execution — no
child_process,exec, orspawn - 2 runtime dependencies —
@modelcontextprotocol/sdk(official Anthropic MCP SDK) andzod(schema validation) - Rate limiter built in — serialized request queue prevents API abuse
- MIT licensed, fully open source — read every line at src/index.ts (~350 lines) and src/schema.ts (~140 lines)
If you discover a security issue, please see SECURITY.md.
Known Limitations
- 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.
- 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.
- Search results don't include case details — search returns only citations and titles. You need to call
get_case_metadataseparately for each case to get keywords, topics, decision date, and the CanLII URL. - 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.
- Citator tease caps at 5 results — use
get_case_citator(full version) for comprehensive citation analysis. - 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").
- Search endpoint is undocumented — it works but is not in CanLII's official API docs, so it could change without notice.
- Rate limits are strict — 5,000 queries/day, 2 req/sec, 1 concurrent request (enforced automatically by the built-in rate limiter).
License
MIT — see LICENSE.
来源:README.md,提交 259d26f
工具
0版本历史
1- v1.1.4最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分