canlii-mcp
An MCP server providing AI assistants access to Canadian case law and legislation metadata from CanLII across all jurisdictions, supporting search and citation relationships.
README
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.
Forked from tomilashy/canlii-mcp. This fork adds bring-your-own-key (BYOK) auth, a
/healthroute, and a hosted endpoint atcanlii-mcp.vaquill.ai. Tools are unchanged.
Note: The CanLII API provides metadata only — titles, citations, dates, keywords, and citation relationships. Full document text is not available through the API.
Use the hosted endpoint (no install)
https://canlii-mcp.vaquill.ai/mcp
Two headers are required for the hosted instance:
Authorization: Bearer <MCP_AUTH_TOKEN>— gates access to the MCP server itselfX-CanLII-Token: <your_canlii_api_key>— your CanLII key. Apply at canlii.org/en/api/. The server never stores your key.
Claude Desktop / Claude Code
{
"mcpServers": {
"canlii": {
"url": "https://canlii-mcp.vaquill.ai/mcp",
"headers": {
"Authorization": "Bearer YOUR_MCP_TOKEN",
"X-CanLII-Token": "YOUR_CANLII_API_KEY"
}
}
}
}
Cursor / VS Code / Windsurf
Same pattern: any client supporting MCP streamable HTTP with custom headers works. For stdio-only clients use mcp-remote to proxy.
Authentication
| Mode | Header | When |
|---|---|---|
| BYOK (preferred) | X-CanLII-Token: <key> |
Hosted / shared deployments |
| Server fallback | (env CANLII_API) |
Self-hosted single-tenant. Required for stdio. |
| MCP gate | Authorization: Bearer <MCP_AUTH_TOKEN> |
Optional. Restricts who may use the hosted endpoint. |
Tools
| Tool | Description |
|---|---|
list_case_databases |
List all courts and tribunals in the CanLII collection |
list_cases |
Browse decisions from a specific court/tribunal database |
get_case |
Get metadata for a specific case (title, citation, date, keywords) |
get_case_citations |
Get cases cited by a case, cases citing it, or legislation it references |
list_legislation_databases |
List all statute and regulation databases |
list_legislation |
Browse statutes or regulations from a specific database |
get_legislation |
Get metadata for a specific piece of legislation |
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.js
Add 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 http
The 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-mcp
Or 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 deploy
Dashboard deploy (Connect to Git)
- Go to Cloudflare Dashboard → Workers & Pages → Create → Connect to Git
- Select your
tomilashy/canlii-mcprepository - On the Set up your application page:
- Project name:
canlii-mcp - Build command:
npm install && npm run build - Deploy command:
npx wrangler deploy(pre-filled)
- Project name:
- Expand Advanced settings:
- Variable name:
CANLII_API - Variable value: your CanLII API key
- Check Encrypt to store it as a secret
- Variable name:
- Click Deploy
The MCP endpoint will be at https://canlii-mcp.<your-subdomain>.workers.dev/mcp.
Configuration
| Environment Variable | Required | Default | Description |
|---|---|---|---|
CANLII_API |
Yes | — | Your CanLII API key |
PORT |
No | 3000 |
HTTP server port (HTTP mode only) |
MCP_AUTH_TOKEN |
No | — | Bearer token for HTTP authentication. If set, all HTTP requests must include Authorization: Bearer <token>. If not set, the server runs without authentication. |
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 mode
Release
This project uses Semantic Versioning via semantic-release. Commit messages follow the Conventional Commits spec:
| Commit prefix | Release type |
|---|---|
fix: |
Patch (1.0.0 → 1.0.1) |
feat: |
Minor (1.0.0 → 1.1.0) |
feat!: or BREAKING CHANGE |
Major (1.0.0 → 2.0.0) |
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。