{
  "markdown": "# Swedish Law MCP Server\n\n<!-- ANSVAR-CTA-BEGIN -->\n> **The Swedish law corpus is now served through the Ansvar Gateway.** Connect your AI assistant (Claude, Copilot, Cursor, custom MCP client) to `https://gateway.ansvar.eu/mcp` — one OAuth connection, free tier available, covering this corpus plus EU regulations, national law across 28 audited jurisdictions, and CVE/security intelligence, every result with a verbatim source citation. Start at https://ansvar.eu/docs/quickstart\n\n### Connect\n\n**Claude Code** (one line):\n\n```bash\nclaude mcp add ansvar --transport http https://gateway.ansvar.eu/mcp\n```\n\n**Claude Desktop / Cursor** — add to `claude_desktop_config.json` (or `mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"ansvar\": {\n      \"type\": \"url\",\n      \"url\": \"https://gateway.ansvar.eu/mcp\"\n    }\n  }\n}\n```\n\n**Claude.ai** — Settings → Connectors → Add custom connector → paste `https://gateway.ansvar.eu/mcp`\n\nFirst request opens an OAuth signup flow (setup details: [ansvar.eu/docs/quickstart](https://ansvar.eu/docs/quickstart)). After signup, your client is bound to your account; tier (free / premium / team / company) determines fan-out, quota, and which downstream MCPs are reachable.\n\n---\n\n## Self-host this MCP\n\nYou can also clone this repo and build the corpus yourself. The schema,\nfetcher, and tool implementations all live here. What is not in the repo is\nthe pre-built database — TDM and standards-licensing constraints on the\nupstream sources mean we host the corpus on Ansvar infrastructure rather\nthan redistribute it as a public artifact.\n\nBuild your own: run this repo's ingestion script (entry-point varies per\nrepo — typically `scripts/ingest.sh`, `npm run ingest`, or `make ingest`;\ncheck the repo root).\n<!-- ANSVAR-CTA-END -->\n\n\n**The Riksdagen alternative for the AI age.**\n\n[![MCP Registry](https://img.shields.io/badge/MCP-Registry-blue)](https://registry.modelcontextprotocol.io)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![GitHub stars](https://img.shields.io/github/stars/Ansvar-Systems/swedish-law-mcp?style=social)](https://github.com/Ansvar-Systems/swedish-law-mcp)\n[![CI](https://github.com/Ansvar-Systems/swedish-law-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Ansvar-Systems/swedish-law-mcp/actions/workflows/ci.yml)\n[![Daily Data Check](https://github.com/Ansvar-Systems/swedish-law-mcp/actions/workflows/check-updates.yml/badge.svg)](https://github.com/Ansvar-Systems/swedish-law-mcp/actions/workflows/check-updates.yml)\n[![Database](https://img.shields.io/badge/database-pre--built-green)](docs/EU_INTEGRATION_GUIDE.md)\n[![Provisions](https://img.shields.io/badge/provisions-58%2C570-blue)](docs/EU_INTEGRATION_GUIDE.md)\n\nQuery **6,041 Swedish statutes** with **58,570 provisions** -- from Dataskyddslagen and Brottsbalken to Aktiebolagslagen, Miljöbalken, and more -- directly from Claude, Cursor, or any MCP-compatible client.\n\nIf you're building legal tech, compliance tools, or doing Swedish legal research, this is your verified reference database.\n\nBuilt by [Ansvar Systems](https://ansvar.eu) -- Stockholm, Sweden\n\n---\n\n## Why This Exists\n\nSwedish legal research is scattered across Riksdagen, SFS publications, lagen.nu, and EUR-Lex. Whether you're:\n- A **lawyer** validating citations in a brief or contract\n- A **compliance officer** checking if a statute is still in force\n- A **legal tech developer** building tools on Swedish law\n- A **researcher** tracing legislative history from proposition to statute\n\n...you shouldn't need 47 browser tabs and manual PDF cross-referencing. Ask Claude. Get the exact provision. With context.\n\nThis MCP server makes Swedish law **searchable, cross-referenceable, and AI-readable**.\n\n---\n\n## Quick Start\n\n### Use Locally (npm — recommended)\n\n**Claude Desktop** — add to `claude_desktop_config.json`:\n\n**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n**Cursor / VS Code:**\n\n### Hosted via Ansvar Gateway (B2B, OAuth)\n\nFor organisations that want a single OAuth-gated endpoint covering this MCP plus the rest of the Ansvar fleet (multi-jurisdiction law, EU regulations, sector regulators, case law), use the [Ansvar Gateway](https://gateway.ansvar.eu) — a single MCP endpoint that routes and fans out across the full catalogue. Tier-gated (`premium`, `team`, `company`); requires an Ansvar account.\n\n## Example Queries\n\nOnce connected, just ask naturally:\n\n- *\"What does Dataskyddslagen 3 kap. 5 § say about consent?\"*\n- *\"Is PUL (1998:204) still in force?\"*\n- *\"Find provisions about personuppgifter in Swedish law\"*\n- *\"What EU directives does DSL implement?\"*\n- *\"Which Swedish laws implement the GDPR?\"*\n- *\"Get the preparatory works for Dataskyddslagen\"*\n- *\"Compare incident reporting requirements across NIS2 Swedish implementations\"*\n- *\"Validate the citation NJA 2020 s. 45\"*\n- *\"Find Labour Court cases about discrimination from 2020-2023\"*\n\n---\n\n## What's Included\n\n| Category | Count | Details |\n|----------|-------|---------|\n| **Statutes** | 6,041 statutes | Comprehensive Swedish legislation |\n| **Provisions** | 58,570 sections | Full-text searchable with FTS5 |\n| **Preparatory Works** | 6,735 documents | Propositions (Prop.) and SOUs |\n| **EU Cross-References** | 668 references | 228 EU directives and regulations |\n| **Legal Definitions** | 0 (free tier) | Table reserved, extraction not enabled in current free build |\n| **Database Size** | ~125 MB | Optimized SQLite, portable |\n| **Daily Updates** | Automated | Freshness checks against Riksdagen |\n\n**Verified data only** -- every citation is validated against official sources (Riksdagen, lagen.nu, EUR-Lex). Zero LLM-generated content.\n\n---\n\n## See It In Action\n\n### Why This Works\n\n**Verbatim Source Text (No LLM Processing):**\n- All statute text is ingested from Riksdagen/SFS official sources\n- Provisions are returned **unchanged** from SQLite FTS5 database rows\n- Zero LLM summarization or paraphrasing -- the database contains regulation text, not AI interpretations\n\n**Smart Context Management:**\n- Search returns ranked provisions with BM25 scoring (safe for context)\n- Provision retrieval gives exact text by SFS number + chapter/section\n- Cross-references help navigate without loading everything at once\n\n**Technical Architecture:**\n```\nRiksdagen API → Parse → SQLite → FTS5 snippet() → MCP response\n                  ↑                      ↑\n           Provision parser       Verbatim database query\n```\n\n### Traditional Research vs. This MCP\n\n| Traditional Approach | This MCP Server |\n|---------------------|-----------------|\n| Search Riksdagen by SFS number | Search by plain Swedish: *\"personuppgifter samtycke\"* |\n| Navigate multi-chapter statutes manually | Get the exact provision with context |\n| Manual cross-referencing between laws | `build_legal_stance` aggregates across sources |\n| \"Is this statute still in force?\" → check manually | `check_currency` tool → answer in seconds |\n| Find EU basis → dig through EUR-Lex | `get_eu_basis` → linked EU directives instantly |\n| Check 5+ sites for updates | Daily automated freshness checks |\n| No API, no integration | MCP protocol → AI-native |\n\n**Traditional:** Search Riksdagen → Download SFS PDF → Ctrl+F → Cross-reference with proposition → Check EUR-Lex for EU basis → Repeat\n\n**This MCP:** *\"What EU law is the basis for DSL 3 kap. 5 § about consent?\"* → Done.\n\n---\n\n## Available Tools (18)\n\nSee [TOOLS.md](TOOLS.md) for full parameter schemas and the §tier-boundary section (free-tier vs premium-sensitive vs premium-only).\n\n### Core Legal Research Tools (8)\n\n| Tool | Description |\n|------|-------------|\n| `search_legislation` | FTS5 search on 58,570 provisions with BM25 ranking |\n| `get_provision` | Retrieve specific provision by SFS + chapter/section |\n| `search_case_law` | FTS5 search on case law with court/date filters (premium-sensitive) |\n| `get_preparatory_works` | Get linked propositions and SOUs for a statute (premium-sensitive) |\n| `validate_citation` | Validate citation against database (zero-hallucination check) |\n| `build_legal_stance` | Aggregate citations from statutes, case law, prep works (premium-sensitive) |\n| `format_citation` | Format citations per Swedish conventions (full/short/pinpoint) |\n| `check_currency` | Check if statute is in force, amended, or repealed |\n\n### EU Law Integration Tools (5)\n\n| Tool | Description |\n|------|-------------|\n| `get_eu_basis` | Get EU directives/regulations for Swedish statute |\n| `get_swedish_implementations` | Find Swedish laws implementing EU act |\n| `search_eu_implementations` | Search EU documents with Swedish implementation counts |\n| `get_provision_eu_basis` | Get EU law references for specific provision |\n| `validate_eu_compliance` | Check implementation status (future, requires EU MCP) |\n\n### Versioning Tools (3, premium-only)\n\n| Tool | Description |\n|------|-------------|\n| `get_provision_history` | Provision version history showing amendments over time |\n| `diff_provision` | Diff two versions of a provision |\n| `get_recent_changes` | Recent statute changes within a time window |\n\n### Server Metadata Tools (2)\n\n| Tool | Description |\n|------|-------------|\n| `list_sources` | Data provenance metadata per source |\n| `about` | Server stats, freshness, build date, tier, dataset summary |\n\n---\n\n## EU Law Integration\n\n**668 cross-references** linking 309 Swedish statutes to EU law, with bi-directional lookup.\n\n| Metric | Value |\n|--------|-------|\n| **EU References** | 668 cross-references |\n| **EU Documents** | 228 unique directives and regulations |\n| **Swedish Statutes with EU Refs** | 309 (12.8% of statutes) |\n| **Directives** | 89 |\n| **Regulations** | 139 |\n| **EUR-Lex Integration** | Automated metadata fetching |\n\n### Most Referenced EU Acts\n\n1. **eIDAS Regulation** (910/2014) - 20 references\n2. **E-Signatures Directive** (1999/93) - 15 references\n3. **GDPR** (2016/679) - 15 references\n4. **Data Protection Directive** (1995/46) - 14 references\n5. **Market Surveillance Regulation** (2019/1020) - 14 references\n\nSee [EU_INTEGRATION_GUIDE.md](docs/EU_INTEGRATION_GUIDE.md) for detailed documentation and [EU_USAGE_EXAMPLES.md](docs/EU_USAGE_EXAMPLES.md) for practical examples.\n\n---\n\n## Data Sources & Freshness\n\nAll content is sourced from authoritative Swedish legal databases:\n\n- **[Riksdagen](https://riksdagen.se/)** -- Swedish Parliament's official legal database\n- **[Svensk Forfattningssamling](https://svenskforfattningssamling.se/)** -- Official statute collection\n- **[Lagen.nu](https://lagen.nu)** -- Case law database (CC-BY Domstolsverket)\n- **[EUR-Lex](https://eur-lex.europa.eu/)** -- Official EU law database (metadata only)\n\n### Automated Freshness Checks (Daily)\n\nA [daily GitHub Actions workflow](.github/workflows/check-updates.yml) monitors all data sources:\n\n| Source | Check | Method |\n|--------|-------|--------|\n| **Statute amendments** | Riksdagen API date comparison | All 6,041 statutes checked |\n| **New statutes** | Riksdagen SFS publications (90-day window) | Diffed against database |\n| **Case law** | lagen.nu feed entry count | Compared to database |\n| **Preparatory works** | Riksdagen proposition API (30-day window) | New props detected |\n| **EU reference staleness** | Git commit timestamps | Flagged if >90 days old |\n\nThe workflow supports `auto_update: true` dispatch for automated sync, rebuild, version bump, and npm publishing.\n\n---\n\n## Security\n\nThis project uses multiple layers of automated security scanning:\n\n| Scanner | What It Does | Schedule |\n|---------|-------------|----------|\n| **CodeQL** | Static analysis for security vulnerabilities | Weekly + PRs |\n| **Semgrep** | SAST scanning (OWASP top 10, secrets, TypeScript) | Every push |\n| **Gitleaks** | Secret detection across git history | Every push |\n| **Trivy** | CVE scanning on filesystem and npm dependencies | Daily |\n| **Docker Security** | Container image scanning + SBOM generation | Daily |\n| **Socket.dev** | Supply chain attack detection | PRs |\n| **OSSF Scorecard** | OpenSSF best practices scoring | Weekly |\n| **Dependabot** | Automated dependency updates | Weekly |\n\nSee [SECURITY.md](SECURITY.md) for the full policy and vulnerability reporting.\n\n---\n\n## Important Disclaimers\n\n### Legal Advice\n\n> **THIS TOOL IS NOT LEGAL ADVICE**\n>\n> Statute text is sourced from official Riksdagen/SFS publications. However:\n> - This is a **research tool**, not a substitute for professional legal counsel\n> - **Court case coverage is limited** -- do not rely solely on this for case law research\n> - **Verify critical citations** against primary sources for court filings\n> - **EU cross-references** are extracted from Swedish statute text, not EUR-Lex full text\n\n**Before using professionally, read:** [DISCLAIMER.md](DISCLAIMER.md) | [PRIVACY.md](PRIVACY.md)\n\n### Client Confidentiality\n\nQueries go through the Claude API. For privileged or confidential matters, use on-premise deployment. See [PRIVACY.md](PRIVACY.md) for Advokatsamfundet compliance guidance.\n\n---\n\n## Documentation\n\n- **[EU Integration Guide](docs/EU_INTEGRATION_GUIDE.md)** -- Detailed EU cross-reference documentation\n- **[EU Usage Examples](docs/EU_USAGE_EXAMPLES.md)** -- Practical EU lookup examples\n- **[Security Policy](SECURITY.md)** -- Vulnerability reporting and scanning details\n- **[Disclaimer](DISCLAIMER.md)** -- Legal disclaimers and professional use notices\n- **[Privacy](PRIVACY.md)** -- Client confidentiality and data handling\n\n---\n\n## Development\n\n### Branching Strategy\n\nThis repository uses a `dev` integration branch. **Do not push directly to `main`.**\n\n```\nfeature-branch → PR to dev → verify on dev → PR to main → deploy\n```\n\n- `main` is production-ready. Only receives merges from `dev` via PR.\n- `dev` is the integration branch. All changes land here first.\n- Feature branches are created from `dev`.\n\n### Setup\n\n```bash\ngit clone https://github.com/Ansvar-Systems/swedish-law-mcp\ncd swedish-law-mcp\nnpm install\nnpm run build\nnpm test\n```\n\n### Running Locally\n\n```bash\nnpm run dev                                       # Start MCP server\nnpx @anthropic/mcp-inspector node dist/index.js   # Test with MCP Inspector\n```\n\n### Data Management\n\n```bash\nnpm run ingest -- <sfs-number> <output.json>   # Ingest statute from Riksdagen\nnpm run ingest:auto-all -- --scope all-laws --dry-run  # Coverage audit against Riksdagen\nnpm run ingest:auto-all -- --scope all-laws   # Ingest full law-like corpus from Riksdagen\nnpm run ingest:cases:full-archive              # Ingest case law (full archive)\nnpm run sync:cases                             # Ingest case law (incremental)\nnpm run sync:prep-works                        # Sync preparatory works\nnpm run extract:definitions                    # Extract legal definitions\nnpm run build:db                               # Rebuild SQLite database\nnpm run check-updates                          # Check for amendments\n```\n\n### Performance\n\n- **Search Speed:** <100ms for most FTS5 queries\n- **Database Size:** ~125 MB (efficient, portable)\n- **Reliability:** 100% ingestion success rate\n\n---\n\n## More Ansvar MCPs\n\nFull fleet coverage at [ansvar.eu/coverage](https://ansvar.eu/coverage).\n## Contributing\n\nContributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\nPriority areas:\n- Court case law expansion (currently limited coverage)\n- EU Regulations MCP integration (full EU law text, CJEU case law)\n- Historical statute versions and amendment tracking\n- Lower court decisions (Tingsrätt, Hovrätt)\n\n---\n\n## Roadmap\n\n- [x] **Statute expansion** -- 785% growth from 81 to 717 statutes (v1.1.0)\n- [x] **EU law integration** -- 668 cross-references to 228 EU directives/regulations (v1.1.0)\n- [ ] Court case law expansion (scraper updated, re-ingestion needed for 12K-18K cases)\n- [ ] Lower court coverage (Tingsrätt, Hovrätt archives)\n- [ ] Historical statute versions (amendment tracking)\n- [ ] English translations for key statutes\n- [ ] Web API for programmatic access\n\n---\n\n## Citation\n\nIf you use this MCP server in academic research:\n\n```bibtex\n@software{swedish_law_mcp_2025,\n  author = {Ansvar Systems AB},\n  title = {Swedish Law MCP Server: Production-Grade Legal Research Tool},\n  year = {2025},\n  url = {https://github.com/Ansvar-Systems/swedish-law-mcp},\n  note = {Comprehensive Swedish legal database with 6,041 statutes and EU law cross-references}\n}\n```\n\n---\n\n## License\n\nApache License 2.0. See [LICENSE](./LICENSE) for details.\n\n### Data Licenses\n\n- **Statutes & Propositions:** `SE-Statutory-PD` -- Swedish statutory public domain. Upphovsrättslagen (1960:729) §9 excludes författningar (laws and regulations), beslut av myndighet (decisions of public authorities), yttranden av svensk myndighet (official statements), and official translations of these works from copyright protection. Verified verbatim 2026-05-17 -- see [`docs/audits/2026-05-17-eu-copyright-statutory-works-batch-3-BG-HR-SK-SI-SE.md`](https://github.com/Ansvar-Systems/Ansvar-Architecture-Documentation/blob/main/docs/audits/2026-05-17-eu-copyright-statutory-works-batch-3-BG-HR-SK-SI-SE.md). Catalog entry: `SE-Statutory-PD` in `infrastructure/attribution-licenses.json`.\n- **Case Law:** CC-BY Domstolsverket (via lagen.nu) -- court decisions also covered by Upphovsrättslagen §9, with Domstolsverket compilation under CC-BY\n- **EU Metadata:** EUR-Lex (EU public domain, Decision 2011/833/EU)\n\n---\n\n## About Ansvar Systems\n\nWe build AI-accelerated compliance and legal research tools for the European market. This MCP server started as our internal reference tool for Swedish law -- turns out everyone building for the Swedish market has the same research frustrations.\n\nSo we're open-sourcing it. Navigating 6,041 statutes shouldn't require a law degree.\n\n**[ansvar.eu](https://ansvar.eu)** -- Stockholm, Sweden\n\n---\n\n<p align=\"center\">\n  <sub>Built with care in Stockholm, Sweden</sub>\n</p>\n",
  "bytes": 17989,
  "sha": "051e114cf553dc12162c0e4a4f99457d38884df4a0bb0b43eb018b1e7b877cad",
  "repo_slug": "ansvar-systems/swedish-law-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_eu_ansvar_swedish_law_mcp_f5e810da/readme"
}