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

Civil

2

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

Statut Personnel & Successions

Personal Status & Inheritance

3

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

Chambre Commerciale

Commercial

4

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

Chambre Administrative

Administrative

5

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

Chambre Sociale

Social

6

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

Chambre Pénale

Criminal

7

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

Chambre Immobilière

Real Estate

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(Model Context Protocol) 서버는 모든 API 기능을 포트 5098에서 SSE를 통해 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