brazil-legislation-mcp-server
Overview
Search the Senado Federal catalog for Brazilian federal norms and selected STF constitutional-review decisions. Resolve a citation such as Lei 13.709/2018 (LGPD), read a specific publication or provision, and trace the acts that changed it. Exact state and municipal LexML URNs can return bibliographic metadata. The sources are public and require no API key.
Tools
Tool | Purpose |
Search Portuguese summaries and nicknames or browse a signature year. | |
Resolve citations, nicknames and LexML URNs in a batch. | |
Get norm metadata, publication IDs and change counts. | |
Read an edition, available translation, article or section. | |
Trace later and earlier acts by act or provision. | |
Inspect citation syntax, source coverage, mirror state and Senado vocabularies. |
Related MCP server: FREOA Verifica
Capability reference
For search, changes and vocabulary pages, limit defaults to 25 and clamps to 200. Continue with next_offset and optionally pass back page_token to check continuity. On page_changed, restart at offset 0 without the token.
brlaw_search_norms tool
Searches Portuguese ementas and nicknames with accent-insensitive matching. Filter by Senado
types(including family expansion),number, and either signature year or ISO date bounds. The default sort isrelevancewith a query andnewestwithout one.oldestis also available.Send equal year bounds or two dates in one year, with no
query, to browse live. Other searches require the initialized mirror. The response names the source and gives the live observation time or the mirror's coverage.
brlaw_lookup_citation tool
Resolves the first 25
citationsin input order, preserving the rest inunprocessed. Include a type and year when available. Provision addresses such asArt. 26, § 1º, IIcan follow a citation.Outcomes are
found,ambiguous,not_found,outside_base, andunavailable. A found row gives the Senado ID for subsequent calls.outside_basecovers exact non-federal LexML URNs. Some nickname lookups need the mirror.
brlaw_get_norm tool
Takes
normas a Senado ID, LexML URN, typed citation, or nickname. Returns the official summary, subject indexing, publications, text versions, and recorded change counts. Use a returnedpublication_idto select an edition.include_lexmldefaults to false. When enabled, it can add a bill of origin and doctrine references. Doctrine pages default to 10 rows and continue withlexml.doctrine.next_offset.
brlaw_get_text tool
Defaults to consolidated Portuguese text. The server tries Senado, Câmara and verified Planalto compilations, then the original. Choose
version: "as_published"or an exactpublication_id. Available Senado translations can be requested withlanguage: "en"or"fr".Choose
articlesorsections. Article selection processes up to 10 addresses and returns the rest for a follow-up. Text over 24,000 characters returns an outline. Use its section IDs with the same edition to retrieve complete sections. A repeated section ID returnssame_as_selection, the one-based position of its first result inselections.Results distinguish
whole,outline,selectedandunavailable. Read the served source, date and date basis before citing. An unknown compilation date means freshness is unknown. Dated later acts are recorded changes and do not establish legal effect. The Diário Oficial da União is authoritative.
brlaw_get_changes tool
Set
directiontochanged_by(default),changesorboth. Useview: "by_act"(default) or"by_article". Filter by related-act signature dates, relation kinds, actions or act classes such asstf_ruling.Includes recorded Portuguese relation labels, notes, and affected provisions where the source supplies them. Each item indicates whether the recorded action changes wording.
brlaw_list_reference tool
topic: "overview"(default) gives citation and provision examples, source credits, and index coverage. Choosetypes,publications,relationsoractionsfor vocabulary rows and snapshot provenance.Senado uses
ADConin type filters for the STF action cited as ADC.ADCin those filters stands for Ato Declaratório.
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Cross-year search uses a persistent SQLite FTS5 mirror of the Senado catalog. The November 30, 2026 sweep indexed 244,266 unique IDs across signature years 1808–2026. Use
brlaw_list_referencefor current local coverage and readiness.Reformatted texts retain source links and publication notices. Source credits go to Senado Federal, Câmara dos Deputados, Presidência da República and LexML Brasil.
Getting started
For npm installs, use Node.js 24 or later with built-in SQLite. The portable .mcpb is a stdio bundle and declares the same Node floor for the runtime that the host uses to launch it.
claude mcp add brazil-legislation-mcp-server -- npx -y @cyanheads/brazil-legislation-mcp-serverFor other clients, add this to the MCP config file:
{
"mcpServers": {
"brazil-legislation-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/brazil-legislation-mcp-server"]
}
}
}For local Streamable HTTP:
MCP_TRANSPORT_TYPE=http npx -y @cyanheads/brazil-legislation-mcp-serverConnect to http://127.0.0.1:3010/mcp. For Docker or a source build, see Running the server.
Configuration
Variable | Description | Default |
| Writable directory for the index and reference snapshot. Use the same directory for the CLI and server. |
|
|
|
|
| HTTP bind address. |
|
| HTTP port. |
|
| HTTP MCP path. |
|
| HTTP session mode. |
|
|
|
|
| Minimum log level. |
|
| Enable OpenTelemetry. |
|
See .env.example for common framework overrides.
Running the server
Initialize and refresh the index
Exact citations and single-year listings can use live Senado data from first launch. Initialize the mirror once for cross-year and text searches:
npx -y --package @cyanheads/brazil-legislation-mcp-server brazil-legislation-mirror init
npx -y --package @cyanheads/brazil-legislation-mcp-server brazil-legislation-mirror verify
npx -y --package @cyanheads/brazil-legislation-mcp-server brazil-legislation-mirror refreshinit resumes interrupted work. verify reports integrity and coverage. HTTP schedules a daily refresh for an initialized index. For stdio, run refresh to update the index and reference vocabularies. A refresh covers this year and the previous year, or all years when the last complete sweep is at least seven calendar days old. Keep the data directory across restarts.
Local development
Requires Bun v1.4.4 or higher for project scripts and Node.js 24 or later for the start scripts.
git clone https://github.com/cyanheads/brazil-legislation-mcp-server.git
cd brazil-legislation-mcp-server && bun install
cp .env.example .env
bun run rebuild
bun run start:http
# or bun run start:stdioAfter building, the mirror commands are also available as node dist/mirror-cli.js init, refresh, and verify.
Docker
Initialize a named volume and use it again when starting the server:
docker run --rm -v brlaw-data:/usr/src/app/.mirror \
ghcr.io/cyanheads/brazil-legislation-mcp-server:latest bun run dist/mirror-cli.js init
docker run --rm -p 127.0.0.1:3010:3010 -v brlaw-data:/usr/src/app/.mirror \
ghcr.io/cyanheads/brazil-legislation-mcp-server:latestThe image defaults to HTTP with stateless sessions. Substitute refresh or verify in the lifecycle command as needed. For stdio, run with -i and -e MCP_TRANSPORT_TYPE=stdio in place of the port mapping. To build locally, run docker build -t brazil-legislation-mcp-server ..
Project structure
Directory | Purpose |
| Six MCP tool contracts and handlers. |
| Citation resolution, provision addresses, and change relationships. |
| Norm records, publication retrieval and reference vocabularies. |
| Local SQLite mirror and reference refresh. |
| Edition selection, legal HTML parsing and text provenance. |
| Exact-URN ficha and doctrine metadata. |
| Contract and service tests. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. See docs/design.md for source mappings and mirror behavior.
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Case law search, court decisions and súmulas, across indexed public sources (STF, STJ, TST, state co
Acervo jurídico brasileiro: busca, Markdown, grafo de normas e precedentes, citação verificável.
Search Brazilian case law, súmulas and federal/state legislation with official source links.
Search official Brazilian case law (jurisprudência) from the STJ and STF by terms, party or CNPJ.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables searching and reading federal statutes with linked legal and inline citations, listing published titles, and retrieving complete sections with bounded pagination through hosted HTTP or local stdio.3MIT
- AlicenseAqualityBmaintenanceEnables verified retrieval of Brazilian primary legal sources — legislation, CVM and CMN/BCB norms, and case law — with reproducible evidence, checking whether a provision exists, whether a quoted passage is literal, which wording was in force on a given date, and whether the citations in a document resolve. Each result carries official URLs, capture timestamps and hashes, and the server abstains rather than asserting nonexistence when an official source cannot be reached.13AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables hybrid retrieval and reranking over public Brazilian legislation, returning answers with literal per-sentence citations verified by code through search, answer, health, and source-listing tools over stdio or HTTP.MIT
- AlicenseAqualityBmaintenanceEnables searching, reading, and citing Brazilian legislation from a local read-only corpus clone, with article-level retrieval, faceted counts, coverage gap checks, and signatory lookups.5MIT