Skip to main content

MCP server for Pakistani law — 967 federal statutes and 1,414 Supreme Court judgments, full text, corpus-based with a strict citation contract.

Project description

pk-eli-mcp

MCP server for Pakistani law: 967 federal statutes and 1,414 Supreme Court of Pakistan judgments, full text, with a strict citation contract on every response.

Pakistan publishes no machine-readable legal API, so this connector is corpus-based: it serves two public HuggingFace mirrors of official sources instead of querying a government endpoint live.

Collection Source Snapshot License
Federal statutes (967) Pakistan_Laws_Dataset, collected from pakistancode.gov.pk PDFs (Ministry of Law and Justice) 2025-01-30 ODC-BY 1.0
Supreme Court judgments (1,414) supreme-court-of-pak-judgments 2024-07-26 MIT

Honest limits, stated up front: both collections are static snapshots. Amendments after 2025-01-30 and judgments after 2024-07-26 are absent, and the judgment corpus is a subset of the Court's output. Every response repeats this in dataset_note. Verify currency against pakistancode.gov.pk and scp.gov.pk before relying on a provision.

Tools

Tool What it does
pk_search_laws Keyword search over the 967 federal statutes (title-weighted). First call downloads the 47 MB corpus once, then serves from cache.
pk_get_law Full statute text by law_id (truncated at ~300,000 characters).
pk_case_search Server-side full-text search over the Supreme Court judgments.
pk_get_decision One judgment's full text, by row_idx or registry case_id.

Citation contract

Pakistan has not deployed ELI. Every response still carries the fleet contract:

  • eli_uri - a stable, resolvable URL: the canonical pakistancode.gov.pk PDF for statutes, the dataset row URI for judgments. Never invented; see eli_note.
  • human_readable_citation - e.g. THE PRIVATISATION COMMISSION ORDINANCE, 2000 or Supreme Court of Pakistan, Crl.A. 93/2013.
  • source_url - where a human can read the same document.

Install

uvx pk-eli-mcp          # or: pip install pk-eli-mcp

Claude Code:

claude mcp add pk-eli-mcp -- uvx pk-eli-mcp

Or drop .mcp.json.example into your project as .mcp.json.

Configuration

Env Default Purpose
PK_ELI_CACHE_DIR ~/.matematic/cache/pk-eli Corpus file + HTTP cache
PK_ELI_AUDIT_DIR ~/.matematic/audit JSONL audit log (one line per tool call)

Development

python -m venv .venv && .venv/Scripts/pip install -e ".[dev]"   # Linux/macOS: .venv/bin/pip
ruff check src tests
pytest tests/test_instructions_drift.py tests/test_corpus.py   # offline
pytest tests/test_smoke.py                                     # live (downloads the corpus)

Governance

Read-only by design: the server can search and fetch, never write. Every tool call appends an audit line (~/.matematic/audit/pk-eli-mcp.jsonl) with a SHA-256 input hash, duration and status. See CONSTITUTION.md for the rules this connector is built under and DISCOVERY.md for how the sources were chosen.

License

Apache-2.0 for this code. The datasets keep their own licenses (ODC-BY 1.0 and MIT); the underlying texts are Government of Pakistan public legal documents.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pk_eli_mcp-0.1.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pk_eli_mcp-0.1.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file pk_eli_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: pk_eli_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pk_eli_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70ae4373635ef7e8f32256f470191843d20b0c5e25d1161a82f01129f97bd4c8
MD5 dae79950be196aef265ee0e16b42f1a0
BLAKE2b-256 ea57441a10b9521d27654f07199575ba6699af5e750fc19aa0124cb9c9d31b6a

See more details on using hashes here.

File details

Details for the file pk_eli_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pk_eli_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pk_eli_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40db5a3926f936b718c287d28304c1aca8c9d3751983086ccb92cd82e82b1801
MD5 44791cda0ece73b4b01f846ac0a189c0
BLAKE2b-256 d4083b48e7eb312f4d129648c049a4c7049a6feaebd354eac1e4b9ec832e0e1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page