New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@ansvar/portuguese-law-mcp

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ansvar/portuguese-law-mcp

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

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Portuguese Law MCP Server

The Diario da Republica alternative for the AI age.

npm version MCP Registry License GitHub stars CI Daily Data Check Database Provisions

Query 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.

If you're building legal tech, compliance tools, or doing Portuguese legal research, this is your verified reference database.

Built by Ansvar Systems

Why This Exists

Portuguese legal research requires navigating DRE (Diario da Republica Eletronico), PGDL databases, and EUR-Lex cross-references. Whether you're:

  • A lawyer validating citations in a brief or contract
  • A compliance officer checking GDPR implementation under Lei 58/2019
  • A legal tech developer building tools on Portuguese law
  • A researcher tracing EU directive transpositions into Portuguese law

...you shouldn't need multiple browser tabs and manual cross-referencing. Ask Claude. Get the exact provision. With context.

This MCP server makes Portuguese law searchable, cross-referenceable, and AI-readable.

Quick Start

Use Remotely (No Install Needed)

Connect directly to the hosted version -- zero dependencies, nothing to install.

Endpoint: https://portuguese-law-mcp.vercel.app/mcp

ClientHow to Connect
Claude.aiSettings > Connectors > Add Integration > paste URL
Claude Codeclaude mcp add portuguese-law --transport http https://portuguese-law-mcp.vercel.app/mcp
Claude DesktopAdd to config (see below)
GitHub CopilotAdd to VS Code settings (see below)

Claude Desktop -- add to claude_desktop_config.json:

{
  "mcpServers": {
    "portuguese-law": {
      "type": "url",
      "url": "https://portuguese-law-mcp.vercel.app/mcp"
    }
  }
}

GitHub Copilot -- add to VS Code settings.json:

{
  "github.copilot.chat.mcp.servers": {
    "portuguese-law": {
      "type": "http",
      "url": "https://portuguese-law-mcp.vercel.app/mcp"
    }
  }
}

Use Locally (npm)

npx @ansvar/portuguese-law-mcp

Claude Desktop -- add to claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "portuguese-law": {
      "command": "npx",
      "args": ["-y", "@ansvar/portuguese-law-mcp"]
    }
  }
}

Cursor / VS Code:

{
  "mcp.servers": {
    "portuguese-law": {
      "command": "npx",
      "args": ["-y", "@ansvar/portuguese-law-mcp"]
    }
  }
}

Example Queries

Once connected, just ask naturally:

  • "What does Artigo 35 of the Constituicao say about digital rights?"
  • "Find provisions about dados pessoais in Portuguese law"
  • "What EU directives does Lei 58/2019 implement?"
  • "Which Portuguese laws address cybersecurity requirements?"
  • "Get Artigo 6 of Lei 109/2009 -- acesso ilegitimo"
  • "Is Lei 67/98 (old data protection law) still in force?"
  • "What are the penalties for computer fraud under the Codigo Penal?"

What's Included

CategoryCountDetails
Statutes1,130 lawsFull Portuguese consolidated legislation
Provisions56,955 articlesFull-text searchable with FTS5
Legal Definitions84 definitionsExtracted from definition articles
EU Cross-ReferencesAuto-extractedLinks to EU directives and regulations
Database Size~76 MBOptimized SQLite, portable
Daily UpdatesAutomatedFreshness checks against PGDL

Legislation Coverage

TypeCount
Decreto-Lei (Government Decree-Law)493
Lei (Act of Parliament)395
Portaria (Ministerial Order)138
Resolucao (Resolution)46
Decreto (Decree)35
Regulamento (Regulation)22
Despacho (Dispatch)11

Key Legislation

ActPortuguese NameSignificance
Lei 58/2019Lei de execucao do RGPDPortuguese GDPR implementation; age of digital consent at 13
Lei 46/2018Regime juridico da seguranca do ciberespacoNIS Directive transposition; CNCS as competent authority
Lei 109/2009Lei do CibercrimeBudapest Convention transposition; cybercrime offences
ConstituicaoConstituicao da Republica PortuguesaArt. 35 -- explicit digital rights and data protection
Codigo PenalCodigo PenalPrivacy violations (Art. 193-194), computer fraud (Art. 221)
CSCCodigo das Sociedades ComerciaisCommercial company law, corporate governance
DL 7/2004Lei do Comercio EletronicoE-Commerce Directive transposition
Lei 16/2022Lei das Comunicacoes EletronicasEECC transposition

Verified data only -- every article is ingested from PGDL (Procuradoria-Geral Distrital de Lisboa), the official consolidated legislation database. Zero LLM-generated content.

Available Tools (13)

ToolDescription
search_legislationFTS5 search on 56,955 provisions with BM25 ranking
get_provisionRetrieve specific article by law identifier + article number
list_sourcesList all 1,130 laws in the database with metadata
validate_citationValidate citation against database (zero-hallucination check)
build_legal_stanceAggregate citations from multiple statutes
format_citationFormat citations per Portuguese conventions (Diario da Republica)
check_currencyCheck if statute is in force, amended, or repealed
aboutServer metadata and corpus statistics

EU Law Integration Tools (5)

ToolDescription
get_eu_basisGet EU directives/regulations for Portuguese statute
get_portuguese_implementationsFind Portuguese laws implementing EU act
search_eu_implementationsSearch EU documents with Portuguese implementation counts
get_provision_eu_basisGet EU law references for specific provision
validate_eu_complianceCheck implementation status

Data Sources & Freshness

All content is sourced from authoritative Portuguese legal databases:

  • PGDL (pgdlisboa.pt) -- Procuradoria-Geral Distrital de Lisboa consolidated legislation
  • DRE (dre.pt) -- Official Diario da Republica Eletronico (INCM)
  • EUR-Lex -- Official EU law database (cross-references)

Regulatory Context

  • Data Protection Authority: CNPD (Comissao Nacional de Protecao de Dados), one of Europe's oldest DPAs, established 1994
  • Cybersecurity Authority: CNCS (Centro Nacional de Ciberseguranca), designated under Lei 46/2018
  • Constitutional Digital Rights: Art. 35 explicitly addresses "utilizacao da informatica" (use of computer data)
  • Legal System: Civil law; Portuguese is the sole official language for legislation
  • Citation Format: Diario da Republica references; distinction between Lei (Parliament) and Decreto-Lei (Government)

Full provenance metadata: sources.yml

Security

This project uses multiple layers of automated security scanning:

ScannerWhat It DoesSchedule
CodeQLStatic analysis for security vulnerabilitiesWeekly + PRs
SemgrepSAST scanning (OWASP top 10, secrets, TypeScript)Every push
GitleaksSecret detection across git historyEvery push
TrivyCVE scanning on filesystem and npm dependenciesDaily

See SECURITY.md for the full policy and vulnerability reporting.

Important Disclaimers

THIS TOOL IS NOT LEGAL ADVICE

Statute text is sourced from official PGDL/DRE publications. However:

  • This is a research tool, not a substitute for professional legal counsel
  • Verify critical citations against primary sources (dre.pt) for court filings
  • EU cross-references are auto-extracted from statute text, not EUR-Lex full text

Before using professionally, read: DISCLAIMER.md | PRIVACY.md

Development

Setup

git clone https://github.com/Ansvar-Systems/portuguese-law-mcp
cd portuguese-law-mcp
npm install
npm run build
npm test

Data Management

npm run census                              # Enumerate all laws from PGDL
npm run ingest                              # Full ingestion from census
npm run ingest -- --resume                  # Resume interrupted ingestion
npm run ingest -- --limit 5                 # Test with 5 laws
npm run build:db                            # Rebuild SQLite database
npm run check-updates                       # Check for amendments
npm run drift:detect                        # Detect data drift

Running Locally

npm run dev                                       # Start MCP server
npx @anthropic/mcp-inspector node dist/index.js   # Test with MCP Inspector

Performance

  • Search Speed: <100ms for most FTS5 queries
  • Database Size: ~76 MB (efficient, portable)
  • Reliability: 99% ingestion success rate (1,130/1,141 laws)

Contract Tests

This MCP includes 12 golden contract tests covering:

  • 4 article retrieval tests (Lei 58/2019, Codigo Penal, CSC, Lei 46/2018)
  • 3 search tests (dados pessoais, ciberseguranca, comercio eletronico)
  • 2 citation roundtrip tests (DRE URL patterns, Diario da Republica references)
  • 1 cross-reference test (Lei 58/2019 to GDPR)
  • 2 negative tests (non-existent law, malformed article)

Run with: npm run test:contract

License

Apache-2.0 -- see LICENSE

Data Licenses

  • Statute text: Portuguese Government open data (public domain with attribution)
  • EU Metadata: EUR-Lex (EU public domain)

About Ansvar Systems

We 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.

ansvar.eu

Built with care by Ansvar Systems

Keywords

mcp

FAQs

Package last updated on 26 Feb 2026

Related posts