🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ansvar/spanish-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/spanish-law-mcp

Complete Spanish law database — 12,191 consolidated statutes (300K+ provisions) from BOE covering all national and regional legislation with Spanish full-text search

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
1
Created
Source

Spanish Law MCP Server

The BOE alternative for the AI age.

npm License CI MCP Registry OpenSSF Scorecard Database Provisions

Query 12,191 Spanish laws -- from the LOPDGDD and Codigo Penal to the Ley de Sociedades de Capital, LSSI, and more -- directly from Claude, Cursor, or any MCP-compatible client.

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

Built by Ansvar Systems -- Stockholm, Sweden

Why This Exists

Spanish legal research is scattered across the BOE (Boletin Oficial del Estado), Noticias Juridicas, and commercial platforms like vLex. Whether you're:

  • A lawyer validating citations in a brief or contract under Spanish law
  • A compliance officer checking LOPDGDD digital rights provisions or ENS security requirements
  • A legal tech developer building tools on Spanish legislation
  • A researcher tracing legislative history across leyes organicas and reales decretos

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

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

Example Queries

Once connected, just ask naturally:

  • "Que dice la LOPDGDD sobre el consentimiento?"
  • "Buscar disposiciones sobre proteccion de datos en la legislacion espanola"
  • "What does the ENS say about security categories?"
  • "Find cybercrime provisions in the Codigo Penal (Art. 197)"
  • "Is the Ley de Sociedades de Capital still in force?"
  • "What EU directives does the LOPDGDD implement?"
  • "Validate this legal citation"
  • "Build a legal stance on AEPD enforcement powers"

Deployment Tier

MEDIUM -- dual tier, free database bundled in npm package.

TierPlatformDatabaseContent
FreeVercel (Hobby) / npm (stdio)Core legislation (~120-200 MB)Key laws (LOPDGDD, ENS, Codigo Penal cybercrime, LSSI, Ley de Sociedades de Capital, NIS2 transposition), FTS search, EU cross-references
ProfessionalAzure Container Apps / Docker / LocalFull database (~700 MB - 1.1 GB)+ All leyes organicas and ordinarias, AEPD decisions and guidance, Tribunal Supremo/Constitucional summaries, reales decretos, autonomous community cross-references

The full database is larger due to the comprehensive scope of Spanish legislation and the extensive body of AEPD enforcement decisions. The free tier contains all key data protection, cybersecurity, cybercrime, e-commerce, and company law legislation from BOE.

Data Sources

SourceAuthorityMethodUpdate FrequencyLicenseCoverage
BOEAgencia Estatal Boletin Oficial del EstadoXML Download / APIDailyGovernment Open Data (Ley 37/2007)All national legislation, codes, reales decretos, and official publications

Full provenance metadata: sources.yml

Quick Start

Use Remotely (No Install Needed)

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

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

ClientHow to Connect
Claude.aiSettings > Connectors > Add Integration > paste URL
Claude Codeclaude mcp add spanish-law --transport http https://spanish-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": {
    "spanish-law": {
      "type": "url",
      "url": "https://spanish-law-mcp.vercel.app/mcp"
    }
  }
}

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

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

Use Locally (npm)

npx @ansvar/spanish-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": {
    "spanish-law": {
      "command": "npx",
      "args": ["-y", "@ansvar/spanish-law-mcp"]
    }
  }
}

Cursor / VS Code:

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

Tools

ToolDescriptionFree TierProfessional
get_provisionRetrieve a specific article from a Spanish law or codeYesYes
search_legislationFull-text search across all Spanish legislation (Spanish)YesYes
list_lawsList all available laws with metadataYesYes
get_law_structureGet table of contents / structure of a law or codeYesYes
get_provision_eu_basisCross-reference Spanish law to EU directives/regulationsYesYes
search_reales_decretosSearch reales decretos and regulatory instrumentsNo (upgrade)Yes
get_aepd_guidanceRetrieve AEPD decisions and guidanceNo (upgrade)Yes

Key Legislation Covered

LawIdentifierDomainKey Topics
LOPDGDDLey Organica 3/2018Data ProtectionPersonal data processing, digital rights, AEPD oversight, consent, GDPR implementation, international transfers
ENSReal Decreto 311/2022CybersecurityNational security framework for public sector, security categories, CCN-CERT, mandatory controls, certification
NIS2 TranspositionLey 2024-xxxCybersecurityEssential/important entity obligations, incident reporting, supply chain security
Codigo Penal (cybercrime)Art. 197 ff.CybercrimeDiscovery and disclosure of secrets, unauthorized access, data interception, system interference
Ley de Sociedades de CapitalReal Decreto Legislativo 1/2010Company LawSA and SL companies, corporate governance, directors' duties, capital requirements
LSSILey 34/2002e-CommerceInformation society services, hosting provider liability, electronic contracts, commercial communications

Database Estimates

ComponentFree TierFull (Professional)
Core codes and key laws~80-140 MB~80-140 MB
All leyes and reales decretos--~400-600 MB
AEPD decisions and guidance--~100-200 MB
Case law summaries--~80-150 MB
Cross-references and metadata~5 MB~15 MB
Total~120-200 MB~700 MB - 1.1 GB

Delivery strategy: Free-tier DB bundled in npm package (Strategy A -- fits within Vercel 250 MB function limit). If final size exceeds 250 MB after ingestion, switch to Strategy B (runtime download from GitHub Releases).

Regulatory Context

  • Supervisory Authority: AEPD (Agencia Espanola de Proteccion de Datos) -- issues massive fines, among the highest in the EU (EUR 8.15M to CaixaBank, EUR 6M to BBVA)
  • LOPDGDD is a Ley Organica (requiring absolute majority in Congress), giving it enhanced constitutional status above ordinary laws
  • ENS (Esquema Nacional de Seguridad) is Spain's comprehensive national security framework for the public sector, updated in 2022 with new security controls and certification requirements
  • CCN-CERT (Centro Criptologico Nacional) handles public sector cybersecurity incidents under the ENS framework
  • INCIBE-CERT handles private sector and citizen cybersecurity incidents
  • Spain has 17 Autonomous Communities with their own legislative powers; BOE covers national legislation
  • Four co-official languages: Castilian (es), Catalan (ca), Basque (eu), Galician (gl)
  • Spain is an EU founding member and GDPR/RGPD compliance is a core regulatory requirement

Development

# Clone the repository
git clone https://github.com/Ansvar-Systems/spanish-law-mcp.git
cd spanish-law-mcp

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run contract tests
npm run test:contract

# Build database (requires raw data in data/ directory)
npm run build:db

# Build free-tier database
npm run build:db:free

# Run drift detection
npm run drift:detect

# Full validation
npm run validate

Architecture

spanish-law-mcp/
├── .github/
│   ├── workflows/
│   │   ├── ci.yml                    # Test + lint + security scan
│   │   ├── publish.yml               # npm publish on version tags
│   │   ├── check-source-updates.yml  # Data freshness monitoring
│   │   └── drift-detect.yml          # Upstream drift detection
│   ├── SECURITY.md
│   ├── SECURITY-SETUP.md
│   └── ISSUE_TEMPLATE/
│       └── data-error.md
├── data/
│   └── .gitkeep
├── fixtures/
│   ├── golden-tests.json             # 12 contract tests
│   ├── golden-hashes.json            # 6 drift detection anchors
│   └── README.md
├── scripts/
│   ├── build-db.ts
│   ├── build-db-free.ts
│   ├── download-free-db.sh
│   ├── ingest.ts
│   ├── drift-detect.ts
│   └── check-source-updates.ts
├── src/
│   ├── server.ts
│   ├── db.ts
│   └── tools/
│       ├── get-provision.ts
│       ├── search-legislation.ts
│       ├── list-laws.ts
│       ├── get-law-structure.ts
│       ├── get-provision-eu-basis.ts
│       ├── search-reales-decretos.ts
│       └── get-aepd-guidance.ts
├── __tests__/
│   ├── unit/
│   ├── contract/
│   │   └── golden.test.ts
│   └── integration/
├── sources.yml
├── server.json
├── package.json
├── tsconfig.json
├── vercel.json
├── CHANGELOG.md
├── LICENSE
└── README.md

Notes on Spanish Data Protection Landscape

LOPDGDD (Ley Organica 3/2018) has several distinctive features:

  • Ley Organica status -- constitutional-grade legislation requiring absolute majority to amend
  • Digital rights title (Title X) -- unique among EU member states, guaranteeing rights such as digital disconnection at work, digital education, and digital testament
  • Age of digital consent set at 14 (lowest in the EU, vs. GDPR default of 16)
  • AEPD is one of the most active and aggressive DPAs in Europe with significant fine history

ENS (Esquema Nacional de Seguridad) is comprehensive:

  • Mandatory for all public sector entities and their supply chain
  • Three security categories (BASIC, MEDIUM, HIGH) with increasing requirements
  • CCN-STIC guidelines provide detailed technical implementation guidance
  • ENS certification is increasingly required for government IT contracts

Spain is the EU's fourth largest economy and the distinctive combination of LOPDGDD digital rights provisions with ENS security requirements creates a unique compliance landscape.

Security

Report vulnerabilities to security@ansvar.eu (48-hour acknowledgment SLA).

See SECURITY.md for full disclosure policy.

Maintained by: Ansvar Systems Engineering Contact: hello@ansvar.eu

Keywords

mcp

FAQs

Package last updated on 27 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts