canlii-mcp

canlii-mcp

Provides access to the CanLII API for searching and retrieving Canadian legal information, including court decisions, legislation, and citations.

Category
访问服务器

README

MseeP.ai Security Assessment Badge

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 identifier
  • legislationId (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 identifier
  • offset (required): Starting record number
  • resultCount (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 identifier
  • caseId (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 identifier
  • caseId (required): Case identifier
  • metadataType (required): "citedCases", "citingCases", or "citedLegislations"
  • Optional date filters

Connecting to Claude Desktop

  1. Install the mcp-remote proxy:

    npm install -g mcp-remote
    
  2. 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
  1. Restart Claude Desktop

Connecting to Cloudflare AI Playground

  1. Go to https://playground.ai.cloudflare.com/
  2. Enter your MCP server URL: https://your-worker-name.your-account.workers.dev/sse
  3. 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 server
  • npm run deploy - Deploy to Cloudflare Workers
  • npm run format - Format code with Biome
  • npm run lint:fix - Fix linting issues
  • npm 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选