{"_id":"@ansvar/portuguese-law-mcp","_rev":"3-78afb488021a21e5ad949504c2016e72","name":"@ansvar/portuguese-law-mcp","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.1":{"name":"@ansvar/portuguese-law-mcp","version":"1.0.1","keywords":["mcp","model-context-protocol","portuguese-law","lei-58-2019","gdpr-implementation","cnpd","nis-transposition","cybercrime","codigo-penal","e-commerce","sociedades-comerciais","legislation","legal","compliance","portugal","ansvar"],"author":{"name":"Ansvar Systems","email":"hello@ansvar.eu"},"license":"Apache-2.0","_id":"@ansvar/portuguese-law-mcp@1.0.1","maintainers":[{"name":"ansvar","email":"jeffrey.von.rotz@ansvar.eu"}],"homepage":"https://ansvar.eu","bugs":{"url":"https://github.com/Ansvar-Systems/portuguese-law-mcp/issues"},"bin":{"portuguese-law-mcp":"dist/index.js"},"dist":{"shasum":"fa6f5e5cb53bc3b1ffa4833e738ddf444da76839","tarball":"https://registry.npmjs.org/@ansvar/portuguese-law-mcp/-/portuguese-law-mcp-1.0.1.tgz","fileCount":117,"integrity":"sha512-aB23uAdZTIttsfWN7jsgfYqnxGYGl//h1Pt/6uc4k62bZe5dcjhq9wRtcU50XO4/jzgnli9ckygRpaQDw1lwYw==","signatures":[{"sig":"MEYCIQCJvgLtFohSQPhtya5dfqrm91EkhrmCRfosDuHBjm/WjgIhAJUUj/DMTdzq/WBA5udKD9jqAWiTxNLvLW5sn3dpCpuA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ansvar%2fportuguese-law-mcp@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1034807},"main":"dist/index.js","type":"module","engines":{"node":">=18"},"gitHead":"c8d2da74b911d8dc7580a8449002784dc84beed9","mcpName":"eu.ansvar/portuguese-law-mcp","scripts":{"dev":"node --import tsx src/index.ts","lint":"tsc --noEmit","test":"vitest run","build":"tsc","start":"node dist/index.js","ingest":"node --import tsx scripts/ingest.ts","build:db":"node --import tsx scripts/build-db.ts","validate":"npm run lint && npm test && npm run test:contract","test:watch":"vitest","postinstall":"test -d dist || npm run build || true","drift:detect":"node --import tsx scripts/drift-detect.ts","test:contract":"vitest run __tests__/contract/","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"ansvar","email":"jeffrey.von.rotz@ansvar.eu"},"overrides":{"ajv":"^8.18.0","undici":"^7.0.0","path-to-regexp":"^8.0.0"},"repository":{"url":"git+https://github.com/Ansvar-Systems/portuguese-law-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"Portuguese law database covering Lei 58/2019 (GDPR implementation), Lei 46/2018 (NIS transposition), Codigo das Sociedades Comerciais, Codigo Penal (cybercrime), DL 7/2004 (eCommerce), and Lei 16/2022 (Electronic Communications) with full-text search","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@ansvar/mcp-sqlite":"^1.0.3","@modelcontextprotocol/sdk":"^1.25.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.9.3","@types/node":"^22.15.29","@vercel/node":"^5.6.4","better-sqlite3":"^12.6.2","@types/better-sqlite3":"^7.6.13"},"_npmOperationalInternal":{"tmp":"tmp/portuguese-law-mcp_1.0.1_1771782002094_0.5039588668195591","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Ansvar MCP servers are now distributed as source from github.com/Ansvar-Systems/portuguese-law-mcp under Apache 2.0. Self-hosting instructions: see the repo README. Hosted gateway: ansvar.eu"},"2.0.0":{"name":"@ansvar/portuguese-law-mcp","version":"2.0.0","keywords":["mcp","model-context-protocol","portuguese-law","lei-58-2019","gdpr-implementation","cnpd","nis-transposition","cybercrime","codigo-penal","e-commerce","sociedades-comerciais","legislation","legal","compliance","portugal","ansvar"],"author":{"name":"Ansvar Systems","email":"hello@ansvar.eu"},"license":"Apache-2.0","_id":"@ansvar/portuguese-law-mcp@2.0.0","maintainers":[{"name":"ansvar","email":"jeffrey.von.rotz@ansvar.eu"}],"homepage":"https://ansvar.eu","bugs":{"url":"https://github.com/Ansvar-Systems/portuguese-law-mcp/issues"},"bin":{"portuguese-law-mcp":"dist/index.js"},"dist":{"shasum":"41a1fcb13770fff7515406e2bc0efd6e24002249","tarball":"https://registry.npmjs.org/@ansvar/portuguese-law-mcp/-/portuguese-law-mcp-2.0.0.tgz","fileCount":125,"integrity":"sha512-swxiMXWEHpYuImpFCFScx1Bp0oImOi/0t4rrx/yf3lnoZCGiaPxtjhPP5Fv3OtxXjV4um4djCeySdOPSlb9SiQ==","signatures":[{"sig":"MEQCIFmr3rr9WOKx0ILNxUSSlFEJvZK3VrILMtLDJN+ydBtCAiBX1LKiQCdzoQ9b2ha6PR4JRVKlqxwW8VYp7KXRQ4I+Vg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ansvar%2fportuguese-law-mcp@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":78963706},"main":"dist/index.js","type":"module","engines":{"node":">=18"},"gitHead":"e38bab8447e86ca684e85acce5793cbe850e96e1","mcpName":"eu.ansvar/portuguese-law-mcp","scripts":{"dev":"node --import tsx src/index.ts","lint":"tsc --noEmit","test":"vitest run","build":"tsc","start":"node dist/index.js","census":"node --import tsx scripts/census.ts","ingest":"node --import tsx scripts/ingest.ts","build:db":"node --import tsx scripts/build-db.ts","validate":"npm run lint && npm test && npm run test:contract","test:watch":"vitest","postinstall":"test -d dist || npm run build || true","drift:detect":"node --import tsx scripts/drift-detect.ts","check-updates":"node --import tsx scripts/check-updates.ts","test:contract":"vitest run __tests__/contract/","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"ansvar","email":"jeffrey.von.rotz@ansvar.eu"},"overrides":{"ajv":"^8.18.0","undici":"^7.0.0","path-to-regexp":"^8.0.0"},"repository":{"url":"git+https://github.com/Ansvar-Systems/portuguese-law-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"Portuguese law database with 1,130 statutes and 56,955 provisions covering full Portuguese consolidated legislation (Leis, Decretos-Lei, Codigos, Portarias) with full-text search","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@ansvar/mcp-sqlite":"^1.0.3","@modelcontextprotocol/sdk":"^1.25.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.9.3","@types/node":"^22.15.29","@vercel/node":"^5.6.4","better-sqlite3":"^12.6.2","@types/better-sqlite3":"^7.6.13"},"_npmOperationalInternal":{"tmp":"tmp/portuguese-law-mcp_2.0.0_1772104473358_0.4633778532914892","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Ansvar MCP servers are now distributed as source from github.com/Ansvar-Systems/portuguese-law-mcp under Apache 2.0. Self-hosting instructions: see the repo README. Hosted gateway: ansvar.eu"}},"time":{"created":"2026-02-22T17:40:01.998Z","modified":"2026-05-02T05:48:17.782Z","1.0.1":"2026-02-22T17:40:02.320Z","2.0.0":"2026-02-26T11:14:34.215Z"},"bugs":{"url":"https://github.com/Ansvar-Systems/portuguese-law-mcp/issues"},"author":{"name":"Ansvar Systems","email":"hello@ansvar.eu"},"license":"Apache-2.0","homepage":"https://ansvar.eu","keywords":["mcp","model-context-protocol","portuguese-law","lei-58-2019","gdpr-implementation","cnpd","nis-transposition","cybercrime","codigo-penal","e-commerce","sociedades-comerciais","legislation","legal","compliance","portugal","ansvar"],"repository":{"url":"git+https://github.com/Ansvar-Systems/portuguese-law-mcp.git","type":"git"},"description":"Portuguese law database with 1,130 statutes and 56,955 provisions covering full Portuguese consolidated legislation (Leis, Decretos-Lei, Codigos, Portarias) with full-text search","maintainers":[{"name":"ansvar","email":"jeffrey.von.rotz@ansvar.eu"}],"readme":"# Portuguese Law MCP Server\n\n**The Diario da Republica alternative for the AI age.**\n\n[![npm version](https://badge.fury.io/js/@ansvar%2Fportuguese-law-mcp.svg)](https://www.npmjs.com/package/@ansvar/portuguese-law-mcp)\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/portuguese-law-mcp?style=social)](https://github.com/Ansvar-Systems/portuguese-law-mcp)\n[![CI](https://github.com/Ansvar-Systems/portuguese-law-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Ansvar-Systems/portuguese-law-mcp/actions/workflows/ci.yml)\n[![Daily Data Check](https://github.com/Ansvar-Systems/portuguese-law-mcp/actions/workflows/check-updates.yml/badge.svg)](https://github.com/Ansvar-Systems/portuguese-law-mcp/actions/workflows/check-updates.yml)\n[![Database](https://img.shields.io/badge/database-pre--built-green)](#whats-included)\n[![Provisions](https://img.shields.io/badge/provisions-56%2C955-blue)](#whats-included)\n\nQuery **1,130 Portuguese statutes** -- from the Constituicao and Codigo Penal to Lei 58/2019 (GDPR), Lei 46/2018 (NIS), and Lei 109/2009 (Cybercrime) -- directly from Claude, Cursor, or any MCP-compatible client.\n\nIf you're building legal tech, compliance tools, or doing Portuguese legal research, this is your verified reference database.\n\nBuilt by [Ansvar Systems](https://ansvar.eu)\n\n---\n\n## Why This Exists\n\nPortuguese legal research requires navigating DRE (Diario da Republica Eletronico), PGDL databases, and EUR-Lex cross-references. Whether you're:\n- A **lawyer** validating citations in a brief or contract\n- A **compliance officer** checking GDPR implementation under Lei 58/2019\n- A **legal tech developer** building tools on Portuguese law\n- A **researcher** tracing EU directive transpositions into Portuguese law\n\n...you shouldn't need multiple browser tabs and manual cross-referencing. Ask Claude. Get the exact provision. With context.\n\nThis MCP server makes Portuguese law **searchable, cross-referenceable, and AI-readable**.\n\n---\n\n## Quick Start\n\n### Use Remotely (No Install Needed)\n\n> Connect directly to the hosted version -- zero dependencies, nothing to install.\n\n**Endpoint:** `https://portuguese-law-mcp.vercel.app/mcp`\n\n| Client | How to Connect |\n|--------|---------------|\n| **Claude.ai** | Settings > Connectors > Add Integration > paste URL |\n| **Claude Code** | `claude mcp add portuguese-law --transport http https://portuguese-law-mcp.vercel.app/mcp` |\n| **Claude Desktop** | Add to config (see below) |\n| **GitHub Copilot** | Add to VS Code settings (see below) |\n\n**Claude Desktop** -- add to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"portuguese-law\": {\n      \"type\": \"url\",\n      \"url\": \"https://portuguese-law-mcp.vercel.app/mcp\"\n    }\n  }\n}\n```\n\n**GitHub Copilot** -- add to VS Code `settings.json`:\n\n```json\n{\n  \"github.copilot.chat.mcp.servers\": {\n    \"portuguese-law\": {\n      \"type\": \"http\",\n      \"url\": \"https://portuguese-law-mcp.vercel.app/mcp\"\n    }\n  }\n}\n```\n\n### Use Locally (npm)\n\n```bash\nnpx @ansvar/portuguese-law-mcp\n```\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```json\n{\n  \"mcpServers\": {\n    \"portuguese-law\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@ansvar/portuguese-law-mcp\"]\n    }\n  }\n}\n```\n\n**Cursor / VS Code:**\n\n```json\n{\n  \"mcp.servers\": {\n    \"portuguese-law\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@ansvar/portuguese-law-mcp\"]\n    }\n  }\n}\n```\n\n## Example Queries\n\nOnce connected, just ask naturally:\n\n- *\"What does Artigo 35 of the Constituicao say about digital rights?\"*\n- *\"Find provisions about dados pessoais in Portuguese law\"*\n- *\"What EU directives does Lei 58/2019 implement?\"*\n- *\"Which Portuguese laws address cybersecurity requirements?\"*\n- *\"Get Artigo 6 of Lei 109/2009 -- acesso ilegitimo\"*\n- *\"Is Lei 67/98 (old data protection law) still in force?\"*\n- *\"What are the penalties for computer fraud under the Codigo Penal?\"*\n\n---\n\n## What's Included\n\n| Category | Count | Details |\n|----------|-------|---------|\n| **Statutes** | 1,130 laws | Full Portuguese consolidated legislation |\n| **Provisions** | 56,955 articles | Full-text searchable with FTS5 |\n| **Legal Definitions** | 84 definitions | Extracted from definition articles |\n| **EU Cross-References** | Auto-extracted | Links to EU directives and regulations |\n| **Database Size** | ~76 MB | Optimized SQLite, portable |\n| **Daily Updates** | Automated | Freshness checks against PGDL |\n\n### Legislation Coverage\n\n| Type | Count |\n|------|-------|\n| **Decreto-Lei** (Government Decree-Law) | 493 |\n| **Lei** (Act of Parliament) | 395 |\n| **Portaria** (Ministerial Order) | 138 |\n| **Resolucao** (Resolution) | 46 |\n| **Decreto** (Decree) | 35 |\n| **Regulamento** (Regulation) | 22 |\n| **Despacho** (Dispatch) | 11 |\n\n### Key Legislation\n\n| Act | Portuguese Name | Significance |\n|-----|----------------|-------------|\n| **Lei 58/2019** | Lei de execucao do RGPD | Portuguese GDPR implementation; age of digital consent at 13 |\n| **Lei 46/2018** | Regime juridico da seguranca do ciberespaco | NIS Directive transposition; CNCS as competent authority |\n| **Lei 109/2009** | Lei do Cibercrime | Budapest Convention transposition; cybercrime offences |\n| **Constituicao** | Constituicao da Republica Portuguesa | Art. 35 -- explicit digital rights and data protection |\n| **Codigo Penal** | Codigo Penal | Privacy violations (Art. 193-194), computer fraud (Art. 221) |\n| **CSC** | Codigo das Sociedades Comerciais | Commercial company law, corporate governance |\n| **DL 7/2004** | Lei do Comercio Eletronico | E-Commerce Directive transposition |\n| **Lei 16/2022** | Lei das Comunicacoes Eletronicas | EECC transposition |\n\n**Verified data only** -- every article is ingested from PGDL (Procuradoria-Geral Distrital de Lisboa), the official consolidated legislation database. Zero LLM-generated content.\n\n---\n\n## Available Tools (13)\n\n### Core Legal Research Tools (8)\n\n| Tool | Description |\n|------|-------------|\n| `search_legislation` | FTS5 search on 56,955 provisions with BM25 ranking |\n| `get_provision` | Retrieve specific article by law identifier + article number |\n| `list_sources` | List all 1,130 laws in the database with metadata |\n| `validate_citation` | Validate citation against database (zero-hallucination check) |\n| `build_legal_stance` | Aggregate citations from multiple statutes |\n| `format_citation` | Format citations per Portuguese conventions (Diario da Republica) |\n| `check_currency` | Check if statute is in force, amended, or repealed |\n| `about` | Server metadata and corpus statistics |\n\n### EU Law Integration Tools (5)\n\n| Tool | Description |\n|------|-------------|\n| `get_eu_basis` | Get EU directives/regulations for Portuguese statute |\n| `get_portuguese_implementations` | Find Portuguese laws implementing EU act |\n| `search_eu_implementations` | Search EU documents with Portuguese implementation counts |\n| `get_provision_eu_basis` | Get EU law references for specific provision |\n| `validate_eu_compliance` | Check implementation status |\n\n---\n\n## Data Sources & Freshness\n\nAll content is sourced from authoritative Portuguese legal databases:\n\n- **[PGDL (pgdlisboa.pt)](https://www.pgdlisboa.pt)** -- Procuradoria-Geral Distrital de Lisboa consolidated legislation\n- **[DRE (dre.pt)](https://dre.pt)** -- Official Diario da Republica Eletronico (INCM)\n- **[EUR-Lex](https://eur-lex.europa.eu/)** -- Official EU law database (cross-references)\n\n### Regulatory Context\n\n- **Data Protection Authority:** CNPD (Comissao Nacional de Protecao de Dados), one of Europe's oldest DPAs, established 1994\n- **Cybersecurity Authority:** CNCS (Centro Nacional de Ciberseguranca), designated under Lei 46/2018\n- **Constitutional Digital Rights:** Art. 35 explicitly addresses \"utilizacao da informatica\" (use of computer data)\n- **Legal System:** Civil law; Portuguese is the sole official language for legislation\n- **Citation Format:** Diario da Republica references; distinction between Lei (Parliament) and Decreto-Lei (Government)\n\n> Full provenance metadata: [`sources.yml`](./sources.yml)\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\nSee [SECURITY.md](.github/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 PGDL/DRE publications. However:\n> - This is a **research tool**, not a substitute for professional legal counsel\n> - **Verify critical citations** against primary sources (dre.pt) for court filings\n> - **EU cross-references** are auto-extracted from statute text, not EUR-Lex full text\n\n**Before using professionally, read:** [DISCLAIMER.md](DISCLAIMER.md) | [PRIVACY.md](PRIVACY.md)\n\n---\n\n## Development\n\n### Setup\n\n```bash\ngit clone https://github.com/Ansvar-Systems/portuguese-law-mcp\ncd portuguese-law-mcp\nnpm install\nnpm run build\nnpm test\n```\n\n### Data Management\n\n```bash\nnpm run census                              # Enumerate all laws from PGDL\nnpm run ingest                              # Full ingestion from census\nnpm run ingest -- --resume                  # Resume interrupted ingestion\nnpm run ingest -- --limit 5                 # Test with 5 laws\nnpm run build:db                            # Rebuild SQLite database\nnpm run check-updates                       # Check for amendments\nnpm run drift:detect                        # Detect data drift\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### Performance\n\n- **Search Speed:** <100ms for most FTS5 queries\n- **Database Size:** ~76 MB (efficient, portable)\n- **Reliability:** 99% ingestion success rate (1,130/1,141 laws)\n\n---\n\n## Contract Tests\n\nThis MCP includes 12 golden contract tests covering:\n- 4 article retrieval tests (Lei 58/2019, Codigo Penal, CSC, Lei 46/2018)\n- 3 search tests (dados pessoais, ciberseguranca, comercio eletronico)\n- 2 citation roundtrip tests (DRE URL patterns, Diario da Republica references)\n- 1 cross-reference test (Lei 58/2019 to GDPR)\n- 2 negative tests (non-existent law, malformed article)\n\nRun with: `npm run test:contract`\n\n---\n\n## License\n\nApache-2.0 -- see [LICENSE](./LICENSE)\n\n### Data Licenses\n\n- **Statute text:** Portuguese Government open data (public domain with attribution)\n- **EU Metadata:** EUR-Lex (EU public domain)\n\n---\n\n## About Ansvar Systems\n\nWe build AI-accelerated compliance and legal research tools. This MCP server makes Portuguese law searchable, cross-referenceable, and AI-readable -- so navigating 1,130 statutes doesn't require manual DRE browsing.\n\n**[ansvar.eu](https://ansvar.eu)**\n\n---\n\n<p align=\"center\">\n  <sub>Built with care by Ansvar Systems</sub>\n</p>\n","readmeFilename":"README.md"}