# Lex API MX

> Lex API MX is a free MCP server for legal and government. Current Mexican federal law with official source, SHA-256 checksum and validity dates. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** API, CLI
- **Website:** https://lexapi.mx
- **Repository:** https://github.com/julio-patron/lexapi-mx/tree/HEAD/packages/lex-mcp-server
- **MCP Registry name:** io.github.Julio-Patron/lex-api-mx
- **Categories:** legal and government
- **Listing updated:** 2026-11-14

## About

The server exposes a corpus of 300 federal Mexican norms, with 42,247 current articles, each stored with the URL of its official source, a SHA-256 hash of its text and a validity period. The site lists the Constitution, 9 codes, 201 laws and 89 regulations, drawn from sources such as the Cámara de Diputados and the DOF. That lets an agent cite an article and let a reader check it.

It is a light open-source adapter (MIT) that holds no corpus itself. Each call goes to the Lex API MX REST API with your key. Tools include resolve_legal_citation for queries like artículo 47 LFT, search_mexican_law, get_norm_structure, map_legal_topic, get_legal_article, list_legal_norms, get_legal_norm, get_legal_article_history and get_corpus_status. Text reads require a date, either vigente or YYYY-MM-DD, and jurisdiction is federal only for now.

It runs locally through uvx from PyPI and needs a free API key from a confirmed email account. Errors come back with the action to take, and a rate-limit wait of 30 seconds or less is retried up to twice.

## Features

- **Citation resolver:** Turn a citation like artículo 47 LFT into the full article.
- **Verifiable text:** Every article carries its official source URL and SHA-256 checksum.
- **Validity dates:** Reads take a date so you get the text in force at that time.
- **Norm structure index:** A compact index of books, titles and chapters, about 15 KB for the labour law.
- **Article history:** Retrieve preserved versions with source and validity.
- **Same account as REST:** MCP and API share permissions and usage limits.

## Good for

- Cite the exact article on grounds for dismissal in the labour law
- Search federal law on a topic across 300 norms
- Check an article's text against its checksum
- See how an article changed over time

## Install

### Claude Code (Terminal)

```sh
claude mcp add lex-api-mx --env LEX_API_MX_KEY='<LEX_API_MX_KEY>' -- uvx lex-api-mx-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "lex-api-mx": {
      "command": "uvx",
      "args": [
        "lex-api-mx-mcp"
      ],
      "env": {
        "LEX_API_MX_KEY": "<LEX_API_MX_KEY>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "lex-api-mx": {
      "command": "uvx",
      "args": [
        "lex-api-mx-mcp"
      ],
      "env": {
        "LEX_API_MX_KEY": "<LEX_API_MX_KEY>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "lex-api-mx": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "lex-api-mx-mcp"
      ],
      "env": {
        "LEX_API_MX_KEY": "<LEX_API_MX_KEY>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "lex-api-mx": {
      "command": "uvx",
      "args": [
        "lex-api-mx-mcp"
      ],
      "env": {
        "LEX_API_MX_KEY": "<LEX_API_MX_KEY>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "lex-api-mx": {
      "command": "uvx",
      "args": [
        "lex-api-mx-mcp"
      ],
      "env": {
        "LEX_API_MX_KEY": "<LEX_API_MX_KEY>"
      }
    }
  }
}
```

## Tools

- `resolve_legal_citation`: Resolve a citation or situation to a verifiable legal package
- `search_mexican_law`: Search current articles by text, norm or subject
- `get_norm_structure`: Index of a norm's divisions and article numbers
- `map_legal_topic`: Citations for a limited catalogue of topics
- `get_legal_article`: Full article by UUID with source and validity
- `list_legal_norms`: Paged catalogue of norms and slugs
- `get_legal_norm`: Current metadata of a norm
- `get_legal_article_history`: Preserved versions of an article
- `get_corpus_status`: Public status of the corpus

## FAQ

### Is it free?

Yes. API and MCP are free by account and share usage limits.

### What does it need?

uv and an API key created on lexapi.mx after confirming your email.

### Which jurisdictions are covered?

Federal only for now.

### How big is the corpus?

300 norms and 42,247 current articles.

### Is Lex API MX free?

Yes. Lex API MX is free to use.

### How do I add Lex API MX to Claude Code?

Run this command in your terminal: claude mcp add lex-api-mx --env LEX_API_MX_KEY='<LEX_API_MX_KEY>' -- uvx lex-api-mx-mcp

### What are the best alternatives to Lex API MX?

The closest alternatives to Lex API MX are NY LLC Publication (FileMyPublication), TribuJus, SupplyClub Catalog, SynomosAI Governance MCP and MedXpert 标准检索连接器.

## Alternatives

- [NY LLC Publication (FileMyPublication)](https://ai-powered.com/mcp/ny-llc-publication-filemypublication): NY LLC Publication (FileMyPublication) is a free MCP server for legal and government.
- [TribuJus](https://ai-powered.com/mcp/tribujus): TribuJus is an open-source MCP server for legal and government.
- [SupplyClub Catalog](https://ai-powered.com/mcp/supplyclub-catalog): SupplyClub Catalog is a free MCP server for legal and government.
- [SynomosAI Governance MCP](https://ai-powered.com/mcp/synomosai-governance-mcp-2): SynomosAI Governance MCP is an open-source MCP server for security.
- [MedXpert 标准检索连接器](https://ai-powered.com/mcp/medxpert-2): MedXpert 标准检索连接器 is a free MCP server for legal and government.
- [SigPen](https://ai-powered.com/mcp/sigpen): SigPen is a freemium MCP server for files and documents.
- [SOMMON Office](https://ai-powered.com/mcp/sommon-office): SOMMON Office is a paid MCP server for communication.
- [MedXpert 全球法规连接器 (reg-connector)](https://ai-powered.com/mcp/medxpert-reg-connector): MedXpert 全球法规连接器 (reg-connector) is a free MCP server for legal and government.

---
Source: https://ai-powered.com/mcp/lex-api-mx
