Skip to main content
Glama
mcp-saos

mcp-saos

by pwasniowski

mcp-saos

Instalacja (zalecana, Windows / macOS / Linux)

Jednorazowo w terminalu (wymaga Node.js 20+):

npm install -g https://github.com/pwasniowski/mcp-saos/archive/refs/heads/main.tar.gz

Potem w claude_desktop_config.json (sciezke do folderu sprawdzisz komenda npm root -g):

"saos": { "command": "node", "args": ["<npm root -g>/@legal-link/mcp-saos/dist/index.js"] }

Windows, domyslnie: C:\\Users\\<uzytkownik>\\AppData\\Roaming\\npm\\node_modules\\@legal-link\\mcp-saos\\dist\\index.js. Aktualizacja: ta sama komenda npm install -g ..., potem restart Claude.

Gotowy dist/ jest w repozytorium, wiec instalacja niczego nie kompiluje (kilka sekund). Uruchamianie przez npx -y github:... (opisane nizej) tez dziala, ale przy pierwszym starcie bywa wolniejsze niz limit startu Claude Desktop.

Related MCP server: mcp-saos

Installation (one command)

Run straight from GitHub (no npm release needed; npm clones the repo and builds it via prepare):

npx -y github:pwasniowski/mcp-saos

Claude Desktop (claude_desktop_config.json, section mcpServers):

{
  "mcpServers": {
    "mcp-saos": {
      "command": "npx",
      "args": ["-y", "github:pwasniowski/mcp-saos"]
    }
  }
}

Once published to npm as @legal-link/mcp-saos, npx -y @legal-link/mcp-saos works the same way (MCP Registry name: io.github.pwasniowski/mcp-saos).

(Building from source - below.)

MCP License: MIT Node

An MCP (Model Context Protocol) server for Polish case law - a connector to SAOS (System Analizy Orzeczen Sadowych - the courts' public case-law database, run by Fundacja ePanstwo).

Part of the MateMatic "Polish legal AI" project. It runs as a separate process communicating over stdio; the chat template (a fork of mike) calls it through the MCP protocol.

What SAOS is

An open database of Polish court judgments. Public REST API, no key required.

Coverage caveat: common courts (COMMON) are broad and current (2024-2026 well populated). The other court types are archival in SAOS (measured live 2026-12-01):

courtType

Newest judgment in SAOS

Newer case law

SUPREME (Sad Najwyzszy)

2016-06-22

https://www.sn.pl/orzecznictwo

CONSTITUTIONAL_TRIBUNAL

2015-12-09

https://ipo.trybunal.gov.pl

NATIONAL_APPEAL_CHAMBER (KIO)

2018-09-06

https://orzeczenia.uzp.gov.pl

When search gets one of these courtTypes with a dateFrom past that date, the response starts with an explicit UWAGA POKRYCIE notice and structuredContent.coverage_notice (an empty result there does NOT mean the court issued nothing). Verify anything critical against sn.pl, orzeczenia.ms.gov.pl, trybunal.gov.pl.

The database covers: common courts (COMMON), the Sad Najwyzszy (Supreme Court, SUPREME), the Trybunal Konstytucyjny (Constitutional Tribunal, CONSTITUTIONAL_TRIBUNAL), the KIO (National Appeal Chamber, NATIONAL_APPEAL_CHAMBER). Administrative courts (WSA/NSA) - no data in SAOS.

MCP tools

Tool

Description

search

Full-text and filtered search (court, judge, legal basis, dates)

get_judgment

Full judgment by ID from SAOS

search_by_case

Shortcut: search by case number (e.g. "I ACa 772/13")

saos_cite_check

Citator: is the judgment still good law? Finds later citing judgments and scans them for overruling language near the signature

saos_cite_check - the citator

Give it a case number (a placeholder here; use a real one):

{ "caseNumber": "III CZP NN/RR" }

It searches SAOS full-text for later judgments citing that signature, scans their reasoning for departure phrases ("odstepuje od pogladu wyrazonego", "nie podziela pogladu", "traci moc uchwala", "uchwala skladu siedmiu sedziow" and others) within ~500 characters of the signature, and returns one of four verdicts: przelamanie_wykryte, uchwala_skladu_powiekszonego, nadal_cytowany, brak_cytowan_w_saos. Each hit includes a +-200 character fragment for human verification.

Every phrase on the list was verified against live SAOS data - the evidence table, the algorithm and the honest-limits section are in docs/CITE-CHECK.md. The short version: no hits does NOT mean the judgment is still good law, and every response says so.

Requirements

  • Node.js >= 18

  • npm >= 9

  • Internet access (live API saos.org.pl)

Installation and build

git clone https://github.com/pwasniowski/mcp-saos
cd mcp-saos
npm install
npm run build

After npm run build, the entry point is dist/index.js.

Standalone run (test)

node dist/index.js
# the server listens on stdin/stdout, diagnostic logs go to stderr

Wiring into the chat template (fork of mike) - mcp-servers.json

Add an entry to your client's MCP configuration (e.g. mcp-servers.json):

{
  "name": "saos",
  "transport": "stdio",
  "command": "node",
  "args": ["C:/Users/<YOUR-USER>/mcp-saos/dist/index.js"],
  "enabled": true
}

Provide the absolute path to dist/index.js. On Windows use forward slashes / or double backslashes \\.

Tests

npm run build
npm test            # offline: drift test + unit tests (parser, window scan, phrase patterns)
node test/smoke.mjs # live: 5 checks against the real SAOS API, including the citator

The smoke test checks tools/list (4 tools), search, search_by_case, a Constitutional Tribunal lookup and saos_cite_check on a Supreme Court resolution with known later treatment.

Architecture

stdin  -->  MCP JSON-RPC (stdio transport)  -->  src/index.ts
                                                      |
                                            SAOS REST API
                                     https://www.saos.org.pl/api
                                            /search/judgments
                                            /judgments/{id}
stdout <--  formatted text responses  <--

No external dependencies for HTTP/JSON - requests go through the built-in node:https. The only production dependency: @modelcontextprotocol/sdk.

Limitations and known pitfalls

  • pageSize has a hard lower limit of 10 (SAOS returns HTTP 400 for less) - the server automatically enforces a minimum of 10.

  • courtType=ADMINISTRATIVE returns empty results - SAOS does not index WSA/NSA.

  • Judgment type is shown in Polish with the SAOS code: wyrok (SENTENCE), postanowienie (DECISION), uchwala (RESOLUTION), uzasadnienie (REASONS), zarzadzenie (REGULATION). SAOS itself labels some documents REGULATION although their text starts with "UZASADNIENIE" (e.g. IX U 1095/25) - the server keeps the source value and adds a warning line instead of "fixing" the data.

  • Dates in the database may contain OCR artifacts (e.g. "3013-12-04") - the case number is more reliable than the judgmentDate field.

  • Coverage is uneven by court type - the server states the relevant caveats in every tool response.

  • saos_cite_check is a heuristic. It reads the top citing judgments only, its phrase list cannot cover every way a court departs from a line of case law, and no hits does not confirm the judgment is current.

License

MIT - see the LICENSE file for details. Judgment data: Fundacja ePanstwo, open license (public API with no usage restrictions).

Part of MateMatic

This connector queries its source live. It is one of the Polish and EU source connectors bundled in PATRON and works with any MCP client.

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 for the full org profile.

Available Tools

4 tools
get_judgmentA
Read-onlyIdempotent

Pobiera pelne orzeczenie z SAOS po jego numerycznym ID. Zwraca metadane (sygnatura, sad, data, sklad, podstawy prawne), streszczenie (jesli dostepne) oraz pierwsze 2000 znakow tresci. ID orzeczenia pochodzi z wynikow narzedzia 'search' lub 'search_by_case'. Bledy: missing_arg (brak id), not_found (id poza baza), upstream_error.

Inputs: id (required).

saos_cite_checkA
Read-onlyIdempotent

Citator 'czy wyrok zyje': dla podanej sygnatury szuka POZNIEJSZYCH orzeczen, ktore ja cytuja (pelnotekstowo w SAOS), i skanuje ich uzasadnienia pod frazy przelamania linii orzeczniczej (np. 'odstepuje od pogladu wyrazonego', 'nie podziela pogladu', 'traci moc uchwala', 'uchwala skladu siedmiu sedziow') w oknie ~500 znakow wokol wystapienia sygnatury. Werdykt: przelamanie_wykryte / uchwala_skladu_powiekszonego / nadal_cytowany / brak_cytowan_w_saos. To heurystyka - kazde trafienie ma fragment tekstu do recznej weryfikacji, a brak trafien NIE potwierdza aktualnosci orzeczenia. Bledy: missing_arg (nieczytelna sygnatura), invalid_court_type, upstream_error.

Inputs: caseNumber (required), maxScan, deepScan, courtType.

search_by_caseA
Read-onlyIdempotent

Skrot: szuka orzeczenia po sygnaturze akt (np. 'I ACa 772/13', 'IV CSK 123/15', 'KIO/UZP 100/12'). Odpowiednik search z parametrem caseNumber. Jesli sygnatura nie znajdzie sie w SAOS, sprawa moze byc z sadu administracyjnego (WSA/NSA - nieindeksowane) lub jeszcze nieopublikowana w bazie. Bledy: missing_arg (brak caseNumber), upstream_error.

Inputs: caseNumber (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation4/5

    get_judgment (fetch by ID) and saos_cite_check (citator) are clearly distinct from the search tools. The only overlap is search vs search_by_case, which the description openly frames as a shortcut equivalent to search with a caseNumber parameter — helpful, but still two doors into the same room.

    Naming Consistency3/5

    Names mix conventions: bare verb 'search', verb_noun 'get_judgment' and 'search_by_case', and a prefixed compound 'saos_cite_check'. All are readable and snake_case, but there is no single predictable pattern an agent can rely on.

    Tool Count3/5

    Four tools for a legal-judgment database is on the thin side; the surface is tight and purposeful, but a single search-plus-fetch-plus-citator trio leaves little room for browsing or metadata-only queries.

    Completeness3/5

    Core lifecycle (find by text/case number, fetch judgment, check subsequent citations) is covered, but get_judgment returns only the first 2000 characters of the body with no way to retrieve the remainder, and there is no pagination, court enumeration, or bulk/metadata listing. These are workable but real dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides access to Polish court judgments from the SAOS database. Enables search and retrieval of judgments with full-text search, filtering, and detailed case information.
      3
      20 npm
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for querying live Polish court case law (orzecznictwo) via the SAOS API, offering tools to search judgments, fetch full cases, find judgments citing specific statutory provisions, and check Constitutional Tribunal citations.
      7
      Apache 2.0
    • A
      license
      Not graded
      quality
      F
      maintenance
      MCP server providing access to Polish law statutes, provisions, case law, and EU law integrations, enabling natural language legal research, citation validation, and cross-referencing.
      46 npm
      8
      Apache 2.0