Skip to main content
Glama
README.md
# @pipeworx/pakistan-law

Pakistan federal statutes and High Court judgments: search the register of
federal Acts, read a single section (for example section 302 of the Pakistan
Penal Code 1860), and search and read judgments of the Islamabad, Sindh,
Peshawar and Balochistan High Courts. Keyless; every tool is a live call per
request.

Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1879+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

## Tools

- `pk_search_acts(query?, year?, category?, limit?)` - find federal Acts by
  words in the title, optionally by year and subject category (Criminal, Civil,
  Family, Labour, Banking, Evidence and others). Returns `act_id`, title,
  category, citation (for example "XLV of 1860") and promulgation date.
- `pk_get_section(act | act_id, section)` - the text of one section, for example
  `{"act":"Penal Code","section":"302"}`. Returns `found:false` with a reason
  when the section cannot be located, never an empty string.
- `pk_get_act(act | act_id)` - page count, opening text and the section
  headings of one Act, to pick a section from.
- `pk_search_judgments(court, query?, year?, reported_only?, limit?)` - search a
  High Court's published judgments: `islamabad`, `sindh`, `peshawar` or
  `balochistan`. Returns case title, case number, law-report citation (PLD,
  SCMR, PCrLJ, YLR, MLD and others), decision date, bench and a judgment link.
  What `query` matches differs by court (Islamabad: headnotes and case details;
  Sindh: party names; Peshawar: case title and remarks; Balochistan: title and
  citation) and every result says so. `lahore` is accepted and returns an
  explicit `available:false` result naming the court (see Not included).
- `pk_get_judgment(judgment_url, offset?, max_chars?)` - the text of one
  judgment from a link returned by the search, in pages (`next_offset`). A scanned
  judgment with no text layer returns `found:false` instead of an empty string;
  some Peshawar judgments are scanned.

## Auth

Keyless.

## Data sources

- Ministry of Law and Justice, Government of Pakistan, The Pakistan Code
  (federal statute register and the Ministry's published Act texts).
- Islamabad High Court, case law (judgments and orders).
- High Court of Sindh, caselaw (judgments and orders).
- Peshawar High Court, reported judgments.
- High Court of Balochistan, reported and significant judgments.

## Not included

- Supreme Court of Pakistan judgments. The Court's website refuses every
  non-browser client (including from Cloudflare's network), and this pack does not
  work around that.
- Lahore High Court judgments. The court's judgments register did not answer
  from Cloudflare's network or from an ordinary laptop connection when tested on
  2026-11-11, and the court's second research site presents a certificate for a
  different host name. `pk_search_judgments` with `court: "lahore"` says so
  plainly rather than returning an empty list.

## Notes

Section text is machine-extracted from the Ministry's published copy, so
footnote numbers and amendment brackets appear as printed and layout can be
rough. Check the official copy before citing. Acts marked "Under Review" in the
register are still the published text.

Judgment-search coverage is whatever each court publishes: Peshawar lists
reported judgments only; Balochistan lists titles and citations only (no decision
date); Sindh's `year` is the year the case was filed; Islamabad lists reported and
unreported judgments and orders. Balochistan's list is assembled from the court's
per-judge pages and cached for six hours per server instance.

## Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

```json
{
  "mcpServers": {
    "pakistan-law": {
      "url": "https://gateway.pipeworx.io/pakistan-law/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/pakistan-law/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.

Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:

```json
{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}
```

Both URLs reach the same gateway and the same 1879+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/pk_search_acts \
  -H 'Content-Type: application/json' \
  -d '{"query":"penal","limit":5}'
```

No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/pk_search_acts`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.

## Run it from npm

`@pipeworx/mcp-pakistan-law` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/pakistan-law/mcp` endpoint shown above. It needs network access;
there is no offline mode.

```json
{
  "mcpServers": {
    "pakistan-law": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-pakistan-law"]
    }
  }
}
```

Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.

It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.

## Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:

```
ask_pipeworx({ question: "your question about Pakistan Law data" })
```

The gateway picks the right tool and fills the arguments automatically.

## More

- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)

## License

MIT