Skip to main content
Glama
slapash

JurisCassation MCP Server

by slapash

JurisCassation API

juriscassation.cspj.ma(摩洛哥最高法院判决门户网站)的 GraphQL + REST 封装。

功能特性

  • 实时搜索 — 实时透传至阿拉伯语搜索端点

  • 本地搜索 — 基于 SQLite FTS5 对已抓取的判决进行全文搜索

  • GraphQL API — 类型安全的查询和变更

  • PDF 代理 — 通过加密 ID 缓存并提供判决 PDF 下载

  • 后台抓取器 — 将所有判决索引至本地 SQLite

Related MCP server: Entscheidsuche MCP Server

快速开始

# Docker (GraphQL API on port 5091)
docker compose up -d

# Or direct
pip install -r requirements.txt
python app.py serve --port 8000

# MCP Server (port 5098, SSE transport)
# Via systemd:
sudo systemctl start juriscassation-mcp

# Or direct:
JURIS_API_BASE=http://localhost:5091 python mcp_server.py

API 端点

端点

描述

GET /graphql

GraphQL 调试界面(交互式)

POST /graphql

GraphQL API

GET /api/pdf/{encrypted_id}

下载判决 PDF(代理 + 缓存)

GET /api/stats

本地索引统计信息

GraphQL 模式

查询

# Live search against the Moroccan portal (real-time)
query {
  searchLive(chamberId: 1, sujet: "طلاق", lang: "ar", page: 1) {
    total
    page
    perPage
    items {
      encryptedId
      dossierNumber
      decisionNumber
      decisionDate
      keywordsAr
      pdfUrl
    }
  }
}

# Search the local SQLite index
query {
  searchLocal(query: "طلاق", chamberId: 1, page: 1, perPage: 20) {
    total
    page
    perPage
    items {
      id
      encryptedId
      dossierNumber
      decisionNumber
      decisionDate
      keywordsAr
      pdfUrl
    }
  }
}

# List chambers with decision counts
query {
  chambers {
    id
    nameAr
    nameFr
    nameEn
    decisionCount
  }
}

# Scraper/indexer status
query {
  scraperStatus {
    totalDecisions
    lastScrape
    chambers { id nameFr decisionCount }
  }
}

变更

# Scrape decisions from a chamber (Arabic endpoint with alef wildcard)
mutation {
  scrapeChamber(chamberId: 1, maxPages: 5)
}

# Scrape all pages
mutation {
  scrapeChamber(chamberId: 1, maxPages: 0)
}

法庭分庭

ID

阿拉伯语

法语

英语

1

الغرفة المدنية

Chambre Civile

民事庭

2

غرفة الأحوال الشخصية و الميراث

Statut Personnel & Successions

个人身份与继承庭

3

الغرفة التجارية

Chambre Commerciale

商事庭

4

الغرفة الإدارية

Chambre Administrative

行政庭

5

الغرفة الاجتماعية

Chambre Sociale

社会庭

6

الغرفة الجنائية

Chambre Pénale

刑事庭

7

الغرفة العقارية

Chambre Immobilière

不动产庭

CLI 抓取器

# Scrape chamber 1 (all pages)
python app.py scrape --chamber 1

# Scrape all chambers, max 50 pages each
python app.py scrape --chamber 0 --max-pages 50

# Scrape from page 100 onwards
python app.py scrape --chamber 6 --since-page 100

架构说明

  • 阿拉伯语端点 (/Decisions/RechercheDecisionsRes) 返回 PDF 下载所需的加密 data-id 属性

  • 法语端点 (/Decisions/RechercheDecisionsResFr) 返回数字 idArretCassation ID,但不包含加密 ID

  • PDF 通过 /Decisions/GetArret?encryptedId=... 下载 — 无需身份验证

  • 阿拉伯语搜索中空的 Sujet 返回 0 个结果;我们使用 ا (alef) 作为通配符

  • 上游站点的 SSL 证书存在问题;需要设置 verify=False

环境变量

变量

默认值

描述

JURIS_DB

/data/decisions.db

SQLite 数据库路径

JURIS_PDF_CACHE

/data/pdfs

PDF 缓存目录

JURIS_CONCURRENCY

3

最大并发抓取请求数

JURIS_DELAY

0.5

抓取页面之间的延迟(秒)

MCP 服务器

MCP(模型上下文协议)服务器通过 5098 端口上的 SSE 将所有 API 功能作为 AI 智能体工具公开。

MCP 端点: http://localhost:5098/sse

工具

工具

描述

search_decisions

针对 juriscassation.cspj.ma 的实时搜索

search_local

基于本地 SQLite 索引的 FTS5 搜索

get_decision_pdf

通过加密 ID 检查/下载判决 PDF

list_chambers

列出所有 7 个分庭及其索引数量

scrape_chamber

抓取某个分庭的判决

get_stats

本地索引统计信息

资源

URI

描述

juriscassation://chambers

分庭参考列表 (AR/FR/EN)

juriscassation://stats

当前索引统计信息

MCP 环境变量

变量

默认值

描述

JURIS_API_BASE

http://localhost:5091

GraphQL API 基础 URL

JURIS_DB

/mnt/data/juriscassation/decisions.db

SQLite 路径(用于直接搜索)

MCP_PORT

5098

MCP 服务器端口

MCP_HOST

0.0.0.0

MCP 服务器绑定主机

MCP_TRANSPORT

sse

传输类型 (sse 或 streamable-http)

使用 mcporter 测试

# List tools
npx mcporter list --http-url http://localhost:5098/sse --allow-http --schema

# Search
npx mcporter call search_decisions sujet=طلاق chamber_id=1 --allow-http --http-url http://localhost:5098/sse

部署

该应用已容器化,内部运行在 8000 端口,映射至宿主机 5091 端口。

Related MCP Connectors

Related MCP Servers