Skip to main content

lovspor

Ask an AI assistant about Norwegian law and you get a confident answer — statute name, section number, sometimes a quote. Nothing in that loop checks whether the section actually exists. Lovspor does.

Lovspor keeps an open, daily-updated copy of Norwegian law — close to 6,000 acts and central regulations from Lovdata's public data, with full version history — and gives any AI assistant (Claude Desktop, Claude Code, Cursor, any MCP client) tools to search it, quote it, and verify citations against the real text.

What you can ask

Once connected, your assistant answers from the live corpus instead of stale training data:

  • "What changed in skatteloven this year?"
  • "What did husleieloven § 9-6 say in May 2026?" — full version history since April 2026, diffable between any two tracked dates (fetch the corpus with --full-history, see below)
  • "Does this paragraph exist?" — validate_citation answers instead of guessing
  • "Is this quote verbatim?" — verify_quote checks it against the actual text

Quickstart

Requires uv. No clone, no account, no API key.

# 1. Fetch the legal corpus to ~/.cache/lovverk (re-run any time to update)
uvx lovspor fetch-corpus

# 2. Connect your AI client — Claude Code:
claude mcp add lovverk -- uvx lovspor mcp

Other MCP clients (Claude Desktop's claude_desktop_config.json, etc.):

{
  "mcpServers": {
    "lovverk": {
      "command": "uvx",
      "args": ["lovspor", "mcp"]
    }
  }
}

Restart the client and lovverk appears in its MCP list. Fifteen of the sixteen tools work immediately — no key, and no network access beyond your local corpus clone.

The point-in-time tools need the full history. fetch-corpus clones shallow (--depth 1) by default, which keeps the download small and is enough for every current-law tool. On a shallow clone, get_law_at and diff_law_versions reach only as far back as the clone does. Fetch it whole instead:

uvx lovspor fetch-corpus --full-history

The same flag deepens an existing shallow clone in place (git fetch --unshallow), so this is not a decision you have to get right the first time.

Full setup guide, all sixteen tools with examples, troubleshooting and limitations: docs/mcp.md.

What's inside — and what's not

Inside: all current Norwegian acts (lover) and central regulations (sentrale forskrifter) from Lovdata's public-data API, re-synced daily at 04:00 UTC, each with a structured per-act change history. Live count: the corpus_status tool.

Not inside: court decisions, preparatory works (forarbeider), agency circulars (rundskriv), municipal regulations. A rule can be binding and absent here — an empty result is not evidence that no such rule exists.

Optional: search by meaning

semantic_search is the one tool that needs an embedding key (OpenAI; the corpus vectors ship pre-computed — only your query is embedded). Bring your own key via the server's env:

{
  "mcpServers": {
    "lovverk": {
      "command": "uvx",
      "args": ["lovspor", "mcp"],
      "env": { "OPENAI_API_KEY": "sk-...your-own-key..." }
    }
  }
}

It's your key in your own local config file — keep that file private and never commit it. Without a key, semantic_search is simply disabled; the other fifteen tools are unaffected. Details: docs/embeddings.md.

Optional: hosted endpoint

Don't want to self-host? A hosted MCP endpoint runs at https://lovspor.no/mcp — ask for access, or see docs/mcp.md to run the same thing yourself.

How it works

A scheduled workflow pulls Lovdata's public-data tarballs daily, classifies each document as new / updated / renamed / removed, renders deterministic Markdown, and pushes the diff to lovverk — the public corpus repo — as conventional-commit history. lovspor (this repo, on PyPI) is the engine and MCP server; legal text never lives here.

Architecture and design rationale: docs/decisions.md. Release process: docs/releasing.md. Offline evals for the MCP surface: evals/ (repo-only tooling).

Install from source

git clone https://github.com/bartoszkobylinski/lovspor
cd lovspor
./scripts/bootstrap.sh     # uv sync + pre-commit hooks
uv run lovspor --help

Sources

  • https://api.lovdata.no/v1/publicData/get/gjeldende-lover.tar.bz2 — current Norwegian laws
  • https://api.lovdata.no/v1/publicData/get/gjeldende-sentrale-forskrifter.tar.bz2 — current central regulations

Data is licensed under Norsk lisens for offentlige data (NLOD) 2.0.

License

The engine code in this repository is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE. Versions up to and including commit 632dae8 were published under MIT; everything after is AGPL-3.0. The corpus data in lovverk remains NLOD 2.0 and is unaffected.

The legal text produced by this engine is published in the lovverk repository under NLOD 2.0, with attribution to Lovdata.

  • cloveras/lovdata2 — JSON tooling and MCP server for the same Lovdata public data. lovspor is complementary, focused on Markdown rendering, Git-based change tracking, and an MCP server scoped to the lovverk corpus shape.

Metadata

Release files for lovspor 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lovspor 0.6.0
File Size Uploaded Provenance Actions
lovspor-0.6.0.tar.gz 543.3 kB With provenance Details for lovspor-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lovspor 0.6.0
File Interpreter ABI Platform Actions
lovspor-0.6.0-py3-none-any.whl Python 3 none any Details for lovspor-0.6.0-py3-none-any.whl

Total release size: 942.3 kB

Release files / lovspor-0.6.0.tar.gz

Download URL lovspor-0.6.0.tar.gz
Size 543.3 kB
Tags Source
SHA-256 checksum
How to use checksums
44d32349552649567aed71df21d74a929db8b8d4699eb0e97047c2232280c69e
BLAKE2b-256 checksum
How to use checksums
331b0ee64494660c20c3b97ca0ea7808362313dc6d7f0336c3c5a84851bacd15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / lovspor-0.6.0-py3-none-any.whl

Download URL lovspor-0.6.0-py3-none-any.whl
Size 399.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d7a534238abfacb29206acd63329959ab5f883e19c6ef7d078f9c9ccb36a5f3
BLAKE2b-256 checksum
How to use checksums
a8df552ff1391613f678c719b10b6a5bb8ee4446b063bc4b8e50ca6248f44121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for lovspor 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lovspor-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page