mcp-isap
# mcp-isap
## Installation
### Run straight from GitHub (no npm package needed)
```bash
npx -y github:pwasniowski/mcp-isap
```
`npx` clones the repository, installs dependencies and builds `dist/` (via the `prepare`
script) on first run, then starts the stdio server. Requires Node.js 20+ and `git`.
### Claude Desktop
Add to `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`,
Windows: `%APPDATA%\Claude\`) and restart Claude Desktop:
```json
{
"mcpServers": {
"isap": {
"command": "npx",
"args": ["-y", "github:pwasniowski/mcp-isap"]
}
}
}
```
Any other MCP client (stdio) uses the same `command` / `args`. When the npm package
`@legal-link/mcp-isap` is published, `npx -y @legal-link/mcp-isap` works as well.
(Building from source - below.)
[](https://modelcontextprotocol.io) [](./LICENSE) [](https://nodejs.org)
MCP server for **Polish legislation** - Dziennik Ustaw (Journal of Laws, DU) + Monitor Polski (MP)
via the official **Sejm ELI API** (`api.sejm.gov.pl/eli`).
## Why
`mcp-saos` (general courts) + `mcp-nsa` (administrative) + `mcp-eu-sparql` (EU)
cover the case-law side. **`mcp-isap` adds legislation** - statutes, regulations,
official announcements, international agreements. This closes the triad:
```
STATUTE + CASE LAW + EU LAW
↓ ↓ ↓
ISAP SAOS+NSA EUR-Lex
↓ ↓ ↓
law firm asks about GDPR
→ 4 connectors in parallel
→ 4 citation sections in the panel
```
Coverage: **96,000+ acts** from 1918 to today. Full ELI support
(European Legislation Identifier).
## Tools
- **`search_acts(title?, year?, publisher?, type?, in_force?, date_from?, date_to?, sort?, exclude_amendments?, limit?, offset?)`** -
search by title fragment / year / publisher / act type / in-force status /
promulgation date range. `publisher`: `DU` (Dziennik Ustaw) or `MP`
(Monitor Polski). With a `title`, results are **ranked** (`sort: "relevance"`,
the default): the base act whose subject is the searched phrase first
(e.g. `o podatku od towarów i usług` -> `DU/2004/535`), then its consolidated-text
announcements (newest first), then other acts, amendments last.
`exclude_amendments: true` drops amending acts ("o zmianie...", "zmieniające...");
`sort: "newest"` keeps the Sejm ELI order. Paginate with `offset`.
- **`get_act(eli)`** - act details by ELI (`DU/2018/1000`).
Returns title, type, status, entry into force, keywords,
links to HTML/PDF text and the ISAP page, the **newest consolidated text**
of a base act, and - for a consolidated-text announcement - amendments
published after it.
- **`get_act_text(eli, page?, search_text?, occurrence?, latest_consolidated?, source?)`** -
the act's plain text, paginated at 5000 characters per page. Source: HTML when
Sejm ELI has it, otherwise the **text layer of the official PDF** (consolidated
texts such as `DU/2026/1263` are PDF-only); `structuredContent.text_format` says which.
Iterate `page` while `structuredContent.pagination.has_more` is true, or pass
`search_text` (e.g. `"Art. 86."`) to get the fragment around a hit in one call
(case-sensitive match first, so `Art. 86.` hits the article heading rather than a
cross-reference; `occurrence` picks further hits).
`structuredContent.text_version` says whether this is a consolidated text or
the wording **as promulgated** - for a base act Sejm ELI serves the original wording,
which is NOT the law in force. Pass `latest_consolidated: true` to jump to the newest
consolidated text automatically; `amended_after_consolidated_eli` lists amendments
that the consolidated text does not include yet. Only when neither HTML nor a
readable PDF exists does the tool return `text_unavailable_use_pdf`.
Example - current wording of VAT art. 86:
```
search_acts(title="o podatku od towarów i usług") -> DU/2004/535 first
get_act_text(eli="DU/2004/535", search_text="Art. 86.", latest_consolidated=true)
-> text of DU/2026/1263 (PDF)
```
Every response includes `structuredContent.citations` with fields:
`title`, `url` (ISAP UI), `eli`, `display_address` (`Dz.U. 2018 poz. 1000`),
`publisher`, `year`, `document_type`, `status`, `in_force`, `promulgation`.
Patron reads this field automatically and renders it in the UI panel as the section
**"Polish legal acts (Dz.U. / M.P. - Sejm ELI)"**.
## Stack
- Node 20+ (built-in `fetch`)
- `@modelcontextprotocol/sdk`
- [`unpdf`](https://github.com/unjs/unpdf) (MIT; bundles Mozilla pdf.js, Apache-2.0) - pure-JS PDF text extraction
- Stdio transport
- 500 ms throttle between requests (2 req/s)
- No scraping - pure REST JSON API
## Build + run
```bash
npm install
npm run build
node dist/index.js
```
## Wiring into Patron
In `patron/backend/mcp-servers.json`:
```json
{
"name": "isap",
"transport": "stdio",
"command": "node",
"args": ["C:/Users/<YOUR-USER>/mcp-isap/dist/index.js"],
"enabled": true
}
```
## Smoke test
```bash
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"s","version":"0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_act","arguments":{"eli":"DU/2018/1000"}}}' \
| node dist/index.js
```
Should return the Personal Data Protection Act of 10 May 2018,
status `IN_FORCE`, a link to ISAP and a structured citation.
## Lineage
API contract derived from [`legal-data-hunter/sources/PL/DziennikUrzedowy`](https://github.com/worldwidelaw/legal-sources)
(Python + REST, MIT). TS implementation from scratch - no source code imported.
## License
MIT - see [LICENSE](./LICENSE). Originally created by MateMatic Solutions
([matematicsolutions/mcp-isap](https://github.com/matematicsolutions/mcp-isap));
maintained at [pwasniowski/mcp-isap](https://github.com/pwasniowski/mcp-isap).
## Part of MateMatic
This connector queries its source live. It is one of the Polish and EU source connectors bundled in [PATRON](https://github.com/matematicsolutions/patron) and works with any MCP client.
- Poland, one server for all sources: [prawo-pl-mcp](https://github.com/matematicsolutions/prawo-pl-mcp) · each source on its own: [mcp-saos](https://github.com/matematicsolutions/mcp-saos) · [mcp-nsa](https://github.com/matematicsolutions/mcp-nsa) · **mcp-isap** (this repo) · [mcp-krs](https://github.com/matematicsolutions/mcp-krs) · [mcp-eureka](https://github.com/matematicsolutions/mcp-eureka) · [kio-orzeczenia-mcp](https://github.com/matematicsolutions/kio-orzeczenia-mcp)
- European Union: [mcp-eu-sparql](https://github.com/matematicsolutions/mcp-eu-sparql) (live) · [mcp-eu-compliance](https://github.com/matematicsolutions/mcp-eu-compliance) (offline corpus)
- A prepared corpus of Polish and EU law with a citation graph: [Repertorium](https://github.com/matematicsolutions/repertorium)
`mcp-saos`, `mcp-nsa`, `mcp-isap`, `mcp-krs` and `mcp-eu-sparql` share one `structuredContent.citations`
contract: each tool returns an array of `{title, url, snippet?, ...metadata}`
that legal agents can render directly in their citation panel.
See [matematicsolutions/.github](https://github.com/matematicsolutions)
for the full org profile.
TDQS
Scored across 3 tools
The three tools map to distinct stages of a workflow: discovery (search_acts), metadata retrieval (get_act), and full-text retrieval (get_act_text). The only plausible confusion is between get_act and get_act_text, but the descriptions make the metadata-vs-content split explicit.
All names follow a consistent snake_case verb_noun pattern (search_acts, get_act, get_act_text). The get_act / get_act_text pairing is a predictable refinement rather than a convention break.
Three tools are a tight, well-justified surface for a read-only legal-acts reference server: one search, one metadata fetch, one text fetch. It is on the lean side, but each tool earns its place and there is no redundancy.
The read-only lifecycle is fully covered: search with rich filters and ranking, metadata by ELI, and paginated full text with in-text search plus a path to consolidated/latest versions. Minor gaps exist (no direct PDF download tool, no enumeration of act types/publishers or status values for building filters), but agents can work around these via search results.