canlii-mcp
Provides access to the CanLII API for searching and retrieving Canadian legal information, including court decisions, legislation, and citations.
README
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 <repository-url>
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. 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 identifier- Optional 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 to Claude Desktop
-
Install the mcp-remote proxy:
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
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。
