Global law
The law of nearly every country on earth, any date: read it, see what changed it, check citations.
Search and read the NYC Charter, Administrative Code and Rules of the City of New York
Las listas se ordenan por una puntuación de uso (sobre 100) con estas partes
| Popularidad | 19/80 | Estrellas de GitHub o descargas semanales: la mayor cuenta 60, la menor 20 |
|---|---|---|
| Actualidad | 12/12 | Puntuación completa con una versión o cambio de código en 30 días |
| Sigue respondiendo | 0/8 | El endpoint en la nube respondió en la última revisión |
| Puntuación de uso | 31/100 |
Calidad: Pasó 3/3 revisiones básicas (se muestra, no ordena) · Impulso: 18 (Solo se usa en la pestaña En auge)
Elige la app de IA que usas y copia la configuración.
Que tu IA lo instale con una frase
Instala NYC Charter, Laws and Rules. Sigue https://mcp.popnx.com/i/betanyc-nyc-charter-laws-rules.md, enséñame los comandos y espera mi OK antes de ejecutarlos.Pégala en una IA que trabaje en tu equipo (como Claude Code o Cursor). Lee nuestros pasos, te muestra los comandos y espera tu OK. Sin clave ni registro. · Ver el texto completo que lee tu IA
Pasó 3/3 revisiones · Funciona en tu computadora · ✓ Comandos revisados el 14 nov 2026
Primero: ¿qué IA usas?
Elige tu app y los pasos aparecen abajo.
Funciona con Claude, pero hay que preparar algo antes
Instala Node.js en tu computadora primero (una sola vez) · Solo en la app de Claude para computadora (Windows o Mac), no en la web ni en el móvil
Copia este mensaje en un chat de Claude. La IA revisa tu equipo, te dice qué archivo va a cambiar y espera tu visto bueno cada vez.
Instala el MCP server NYC Charter, Laws and Rules para Claude en este equipo, en este orden: 1) Comprueba Node.js con node -v. Si falta, dime que lo instale desde https://nodejs.org/en/download; no lo instales tú. 2) Usa solo esta configuración (ya revisada por PopNx MCP): { "mcpServers": { "nyc-charter-laws-rules": { "command": "npx", "args": [ "-y", "@betanyc/nyc-charter-laws-rules" ] } } } 3) Dime la ruta completa del archivo que vas a cambiar o el comando que vas a ejecutar y espera mi visto bueno. 4) No hace falta clave. 5) Haz lo acordado y comprueba que las herramientas de NYC Charter, Laws and Rules aparecen de verdad.Este mensaje no lleva tu clave. Si hace falta una, la IA te pedirá que la pegues tú en el archivo o en el campo de la app.
¿Ya está instalado? Compruébalo primero · Abre la Terminal, escribe este comando y pulsa Enter
node -vMac: pulsa ⌘ + Espacio, escribe Terminal y pulsa Enter
Windows: abre Inicio, escribe Windows PowerShell y elige Abrir
Si no está instalado: Abre la página oficial de descargas, elige la versión LTS y el instalador de clics: .pkg en Mac · .msi en Windows. Haz doble clic y sigue hasta el final. No necesitas ningún comando curl
Abrir la página de descarga de Node.js ↗
Al terminar, cierra la Terminal, ábrela de nuevo y ejecuta el mismo comando. Debe aparecer un número de versión: node -v
Se instala una vez y sirve para todo lo que usa Node.js
SettingsDeveloperEdit Config
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": [
"-y",
"@betanyc/nyc-charter-laws-rules"
]
}
}
}Usa NYC Charter, Laws and Rules y dime qué puedes hacer por mí; luego muéstrame una cosa✓ Si Claude dice que está usando NYC Charter, Laws and Rules o muestra una herramienta de NYC Charter, Laws and Rules en la respuesta, ya está conectado
El comando de arriba funciona sin estos valores. Añádelos solo si quieres cambiar algo, según la descripción del autor.
NYC_LAWS_INDEX_DIR Sirve el índice desde este directorio (con la misma estructura que data/index/json/) en lugar del incluido. NYC_CLR_FOOTER Opcional. Cantidad de aviso legal que incluye cada respuesta: completo y luego compacto (predeterminado) o completo Descripciones traducidas automáticamente; los nombres de variables quedan como en el original. Si dudas, mira el original.
Nombres de menú comprobados con la ayuda de Anthropic el 11 nov 2026 · tu pantalla puede variar un poco según la versión
ChatGPT todavía no puede conectar NYC Charter, Laws and Rules
NYC Charter, Laws and Rules se instala en tu computadora, pero ChatGPT solo conecta servidores que funcionan en la web
A · Usa una app que pueda conectar NYC Charter, Laws and Rules
B · Otros en Derecho y datos públicos que funcionan con ChatGPT
Elegidos entre los más usados de la misma categoría, solo los que se conectan con una dirección y sin clave
Funciona con Claude Code, pero hay que preparar algo antes
Instala Node.js en tu computadora primero (una sola vez)
Copia este mensaje en un chat de Claude Code. La IA revisa tu equipo, te dice qué archivo va a cambiar y espera tu visto bueno cada vez.
Instala el MCP server NYC Charter, Laws and Rules para Claude Code en este equipo, en este orden: 1) Comprueba Node.js con node -v. Si falta, dime que lo instale desde https://nodejs.org/en/download; no lo instales tú. 2) Usa solo esta configuración (ya revisada por PopNx MCP): claude mcp add --scope user nyc-charter-laws-rules -- npx -y @betanyc/nyc-charter-laws-rules 3) Dime la ruta completa del archivo que vas a cambiar o el comando que vas a ejecutar y espera mi visto bueno. 4) No hace falta clave. 5) Haz lo acordado y comprueba que las herramientas de NYC Charter, Laws and Rules aparecen de verdad.Este mensaje no lleva tu clave. Si hace falta una, la IA te pedirá que la pegues tú en el archivo o en el campo de la app.
¿Ya está instalado? Compruébalo primero · Abre la Terminal, escribe este comando y pulsa Enter
node -vMac: pulsa ⌘ + Espacio, escribe Terminal y pulsa Enter
Windows: abre Inicio, escribe Windows PowerShell y elige Abrir
Si no está instalado: Abre la página oficial de descargas, elige la versión LTS y el instalador de clics: .pkg en Mac · .msi en Windows. Haz doble clic y sigue hasta el final. No necesitas ningún comando curl
Abrir la página de descarga de Node.js ↗
Al terminar, cierra la Terminal, ábrela de nuevo y ejecuta el mismo comando. Debe aparecer un número de versión: node -v
Se instala una vez y sirve para todo lo que usa Node.js
Mac: pulsa Command+Espacio y escribe Terminal · Windows: abre PowerShell
claude mcp add --scope user nyc-charter-laws-rules -- npx -y @betanyc/nyc-charter-laws-rulesDeberías ver NYC Charter, Laws and Rules en la lista como conectado
Usa NYC Charter, Laws and Rules y dime qué puedes hacer por mí; luego muéstrame una cosa✓ Si Claude Code dice que está usando NYC Charter, Laws and Rules o muestra una herramienta de NYC Charter, Laws and Rules en la respuesta, ya está conectado
El comando de arriba funciona sin estos valores. Añádelos solo si quieres cambiar algo, según la descripción del autor.
NYC_LAWS_INDEX_DIR Sirve el índice desde este directorio (con la misma estructura que data/index/json/) en lugar del incluido. NYC_CLR_FOOTER Opcional. Cantidad de aviso legal que incluye cada respuesta: completo y luego compacto (predeterminado) o completo Descripciones traducidas automáticamente; los nombres de variables quedan como en el original. Si dudas, mira el original.
Nombres de menú comprobados con la ayuda de Anthropic el 11 nov 2026 · tu pantalla puede variar un poco según la versión
Funciona con Cursor, pero hay que preparar algo antes
Instala Node.js en tu computadora primero (una sola vez)
Copia este mensaje en un chat de Cursor. La IA revisa tu equipo, te dice qué archivo va a cambiar y espera tu visto bueno cada vez.
Instala el MCP server NYC Charter, Laws and Rules para Cursor en este equipo, en este orden: 1) Comprueba Node.js con node -v. Si falta, dime que lo instale desde https://nodejs.org/en/download; no lo instales tú. 2) Usa solo esta configuración (ya revisada por PopNx MCP): { "mcpServers": { "nyc-charter-laws-rules": { "command": "npx", "args": [ "-y", "@betanyc/nyc-charter-laws-rules" ] } } } 3) Dime la ruta completa del archivo que vas a cambiar o el comando que vas a ejecutar y espera mi visto bueno. 4) No hace falta clave. 5) Haz lo acordado y comprueba que las herramientas de NYC Charter, Laws and Rules aparecen de verdad.Este mensaje no lleva tu clave. Si hace falta una, la IA te pedirá que la pegues tú en el archivo o en el campo de la app.
¿Ya está instalado? Compruébalo primero · Abre la Terminal, escribe este comando y pulsa Enter
node -vMac: pulsa ⌘ + Espacio, escribe Terminal y pulsa Enter
Windows: abre Inicio, escribe Windows PowerShell y elige Abrir
Si no está instalado: Abre la página oficial de descargas, elige la versión LTS y el instalador de clics: .pkg en Mac · .msi en Windows. Haz doble clic y sigue hasta el final. No necesitas ningún comando curl
Abrir la página de descarga de Node.js ↗
Al terminar, cierra la Terminal, ábrela de nuevo y ejecuta el mismo comando. Debe aparecer un número de versión: node -v
Se instala una vez y sirve para todo lo que usa Node.js
Usa NYC Charter, Laws and Rules y dime qué puedes hacer por mí; luego muéstrame una cosa✓ Si Cursor dice que está usando NYC Charter, Laws and Rules o muestra una herramienta de NYC Charter, Laws and Rules en la respuesta, ya está conectado
El comando de arriba funciona sin estos valores. Añádelos solo si quieres cambiar algo, según la descripción del autor.
NYC_LAWS_INDEX_DIR Sirve el índice desde este directorio (con la misma estructura que data/index/json/) en lugar del incluido. NYC_CLR_FOOTER Opcional. Cantidad de aviso legal que incluye cada respuesta: completo y luego compacto (predeterminado) o completo Descripciones traducidas automáticamente; los nombres de variables quedan como en el original. Si dudas, mira el original.
Nombres de menú comprobados con la ayuda de Cursor el 11 nov 2026 · tu pantalla puede variar un poco según la versión
Funciona con VS Code, pero hay que preparar algo antes
Instala Node.js en tu computadora primero (una sola vez)
Copia este mensaje en un chat de VS Code. La IA revisa tu equipo, te dice qué archivo va a cambiar y espera tu visto bueno cada vez.
Instala el MCP server NYC Charter, Laws and Rules para VS Code en este equipo, en este orden: 1) Comprueba Node.js con node -v. Si falta, dime que lo instale desde https://nodejs.org/en/download; no lo instales tú. 2) Usa solo esta configuración (ya revisada por PopNx MCP): { "servers": { "nyc-charter-laws-rules": { "type": "stdio", "command": "npx", "args": [ "-y", "@betanyc/nyc-charter-laws-rules" ] } } } 3) Dime la ruta completa del archivo que vas a cambiar o el comando que vas a ejecutar y espera mi visto bueno. 4) No hace falta clave. 5) Haz lo acordado y comprueba que las herramientas de NYC Charter, Laws and Rules aparecen de verdad.Este mensaje no lleva tu clave. Si hace falta una, la IA te pedirá que la pegues tú en el archivo o en el campo de la app.
¿Ya está instalado? Compruébalo primero · Abre la Terminal, escribe este comando y pulsa Enter
node -vMac: pulsa ⌘ + Espacio, escribe Terminal y pulsa Enter
Windows: abre Inicio, escribe Windows PowerShell y elige Abrir
Si no está instalado: Abre la página oficial de descargas, elige la versión LTS y el instalador de clics: .pkg en Mac · .msi en Windows. Haz doble clic y sigue hasta el final. No necesitas ningún comando curl
Abrir la página de descarga de Node.js ↗
Al terminar, cierra la Terminal, ábrela de nuevo y ejecuta el mismo comando. Debe aparecer un número de versión: node -v
Se instala una vez y sirve para todo lo que usa Node.js
Usa NYC Charter, Laws and Rules y dime qué puedes hacer por mí; luego muéstrame una cosa✓ Si VS Code dice que está usando NYC Charter, Laws and Rules o muestra una herramienta de NYC Charter, Laws and Rules en la respuesta, ya está conectado
El comando de arriba funciona sin estos valores. Añádelos solo si quieres cambiar algo, según la descripción del autor.
NYC_LAWS_INDEX_DIR Sirve el índice desde este directorio (con la misma estructura que data/index/json/) en lugar del incluido. NYC_CLR_FOOTER Opcional. Cantidad de aviso legal que incluye cada respuesta: completo y luego compacto (predeterminado) o completo Descripciones traducidas automáticamente; los nombres de variables quedan como en el original. Si dudas, mira el original.
Nombres de menú comprobados con la ayuda de VS Code el 11 nov 2026 · tu pantalla puede variar un poco según la versión
Otras apps que usan MCP, como Windsurf, Zed o Gemini CLI, añaden servidores de forma distinta. Míralo en la lista de apps
Ver todas las apps que usan MCP →
La configuración JSON está en “Para desarrolladores”, abajo
Claude Code
claude mcp add --scope user nyc-charter-laws-rules -- npx -y @betanyc/nyc-charter-laws-rulesClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": [
"-y",
"@betanyc/nyc-charter-laws-rules"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"nyc-charter-laws-rules": {
"command": "npx",
"args": [
"-y",
"@betanyc/nyc-charter-laws-rules"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"nyc-charter-laws-rules": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@betanyc/nyc-charter-laws-rules"
]
}
}
}NYC_LAWS_INDEX_DIR envNYC_CLR_FOOTER envDescripciones traducidas automáticamente; los nombres de variables quedan como en el original. Si dudas, mira el original.
Esta configuración se genera a partir de la ficha del creador en el registro. Si el README dice otra cosa, sigue el README.
Según cómo se conecta este servidor y la documentación de cada app, comprobado el 10 nov 2026.
Se ejecutan en tu computadora en
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Se ejecuta en tu computadora; la lista de herramientas aparece en tu app de IA después de instalarlo.
Revisamos información que cualquiera puede ver; no hemos leído el código. Las revisiones que no aplican no se cuentan. · Revisado el 19 nov 2026
El nombre en el registro se verificó con la cuenta de GitHub BetaNYC, dueña del repo
Último cambio de código: hace 3 días
Usa MIT
Este se ejecuta en tu computadora; no hay endpoint en internet
Se ejecuta en tu computadora y usa ajustes locales en su lugar
Se ejecuta en tu computadora; solo podemos leer listas de herramientas de endpoints en internet
Sin entradas en OSV.dev para @betanyc/nyc-charter-laws-rules@0.5.0
Solo revisa esta versión del paquete, no todas sus dependencias · revisado 15 nov 2026
Si lo creaste tú, pega este código en tu README. La insignia enlaza a esta página.
[](https://mcp.popnx.com/en/servers/betanyc-nyc-charter-laws-rules)Pregunta, comparte un consejo o avisa de que no funciona. Ordenado por lo que la gente marcó como útil.
Aún no hay publicaciones. Sé la primera persona en preguntar o compartir.
Lo publicado aquí lo escriben usuarios, no el equipo de PopNx.
Aún no hay reseñas
Comparado con todos los servidores activos de esta categoría en el registro. Las estrellas solo cuentan cuando quien lo publica es dueño del repo.
Superó 3 de 3 revisiones básicas aplicables. No hemos leído el código. Antes de agregar una clave o un token, revisa qué acceso pide el servidor y usa una clave que tenga solo los permisos que necesitas.
El registro no indica ninguna clave obligatoria, aunque algunos servidores te piden iniciar sesión la primera vez que los usas.
Se ejecuta en tu computadora. Tu app de IA lo inicia cuando hace falta, y los datos no pasan por los servidores del creador (a menos que el propio servidor llame a un servicio en línea).
El repo de GitHub cambió por última vez hace 3 días, y la última versión (0.5.0) llegó al registro hace 5 días.
Las apps compatibles con MCP, como Claude Desktop, Claude Code, Cursor y VS Code. También necesitas Node.js en tu computadora.
En la misma categoría: Global law, Open Legal Data (Germany), LibreJustice, InfraNode, Fedlex Connector
Misma categoría, otros creadores, comandos ya revisados. Primero los oficiales, luego por estrellas.
Cómo leer una tarjeta:↓ Descargas por semanai★ Estrellas de GitHubiTres pilares: reseñas · revisiones · usoiActualizado = fecha en que se publicó la última versión en el registroi
The law of nearly every country on earth, any date: read it, see what changed it, check citations.
German court decisions (Rechtsprechung) and laws (Gesetze) with citation graph and citation checks.
Search French-language and European case law and French legal texts (codes, statutes, treaties).
Keyless open data for 84 German cities: 12 lean read-only MCP tools covering 67 data types.
Search Swiss federal legislation: laws, articles, amendments via the Fedlex SPARQL endpoint.
| Este NYC Charter, Laws and Rules | Global law | Open Legal Data (Germany) | LibreJustice | InfraNode | Fedlex Connector | |
|---|---|---|---|---|---|---|
| Dónde se ejecuta | Se instala en tu equipo | Funciona en la nube, sin instalar nada | Funciona en la nube, sin instalar nada | Funciona en la nube, sin instalar nada | Funciona en la nube, sin instalar nada | Funciona en la nube, sin instalar nada |
| Necesita clave | No | No | No | No | No | No |
| Se añade con + en Claude | No | No | No | No | No | No |
| Revisiones básicas | 3/3 | 4/4 | 4/4 | 4/4 | 4/4 | 4/4 |
| Licencia | MIT | NOASSERTION | MIT | Apache-2.0 | Apache-2.0 | MIT |
| Precio | Sin coste en el registro | Sin coste en el registro | Sin coste en el registro | Sin coste en el registro | Sin coste en el registro | Sin coste en el registro |
Copiado tal cual del repo del creador. PopNx MCP no lo ha revisado ni lo respalda. Se quitaron HTML, imágenes y scripts. Los enlaces llevan fuera de este sitio.
The single place to access, process, and query New York City's three primary legal documents:
This repo includes:
data/index/json/) for machine usedata/index/markdown/) for human browsing — readable directly on GitHubClone the repo and everything is ready to use. No setup required to browse or query the current index. Run npm run fetch-data && npm run build-index only when you want to refresh from AML.
Vibe coded with Claude by BetaNYC.
[What's changed](WHATS-CHANGED.md): new tools, corrections and other changes a reader would notice, newest first. Daily law text updates are in CHANGELOG.md.
No API key is required. The Charter, Administrative Code, and Rules are served from an offline corpus bundled with the package, so this server works out of the box — no signup, no token, no environment variables to set.
The bundled text is as of the release. An npm install carries the law text from the day that version was published. When the daily refresh picks up new law text, it also publishes a new patch release automatically (see Releases), so the law text in npx -y @betanyc/nyc-charter-laws-rules is normally at most a day behind main's. Code changes ship with the next release. Automatic releases pause while a hand-bumped version is waiting to be published or a release run has failed. get_version reports the dates you are actually serving. To serve main's index directly, see Getting current law text.
Exposes 7 tools over MCP:
| Tool | Description |
|---|---|
search | Keyword search across all three documents (short keyword queries work best) |
get_section | Retrieve a specific section by citation (e.g. § 259, Chapter 11) |
list_titles | List the top-level chapters or titles of a document |
get_title | Retrieve all sections within a chapter or title |
get_version | Return the currency date for each document — so responses can be grounded in exactly how current the law is |
whats_changed | What changed in this server, newest first, from WHATS-CHANGED.md: new tools and corrections |
about_betanyc | Who built this server, where its code is, and where to report a bug in this server or ask for a new feature |
searchKeyword search across the NYC Charter, Administrative Code, and Rules. It is keyword matching, not a question-answering engine, so short keyword queries work best: sidewalk shed rather than "How long can a sidewalk shed stay up?"
"open data" and open data search the same phrase. If any section contains it, those results are returned, relevance-ranked: heading matches rank above citation matches, which rank above body-text matches, and whole-word matches rank above substring matches.how, what, can, a, the, up, about, …) are dropped. The full list is SEARCH_STOPWORDS in src/corpus.ts. Each remaining term matches at the start of a word, with a trailing plural s ignored, so tanks finds "tank" and shed does not find "established". Sections are ranked by how many terms they contain, then by the same heading > citation > body weights.No section contains the exact query; showing sections containing all of: building, owners, required, drinking, water, tanks.No section matched every term; showing sections matching some of: …, or Only 1 section matched every term (listed first); the rest match some of: long, sidewalk, shed, stay.There is no term weighting yet, so a long definitions section that contains every word can outrank the section you want. Ranked full-text search is a separate, later change.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | yes | — | Search term or phrase |
corpus | string | no | all | charter, admin_code, rules, or all |
limit | number | no | 10 | Max results (max 50) |
search("open data")
search("landlord inspection", corpus="admin_code", limit=20) search("board of health", corpus="rules") search("How long can a sidewalk shed stay up?") # term fallback; first line says so
get_sectionRetrieve a specific section by citation or heading fragment. Input is normalized (with or without §, any case, extra whitespace). If the same citation exists in more than one document (e.g. charter Chapter 3 vs a rules chapter, or a rules section number repeated across titles), a disambiguation list is returned — re-run with the corpus parameter.
| Parameter | Type | Required | Description |
|---|---|---|---|
citation | string | yes | Section citation or heading (e.g. § 259, Section 20-f, 11-602.1, Chapter 11) |
corpus | string | no | charter, admin_code, or rules (default: all three) |
get_section("§ 259")
get_section("11-602.1") get_section("Chapter 11", corpus="charter")
list_titlesList the top-level chapters or titles of a document.
| Parameter | Type | Required | Description |
|---|---|---|---|
corpus | string | yes | charter, admin_code, or rules |
list_titles("charter")
list_titles("rules")
get_titleRetrieve chapter/title records matching an identifier. Matching is whole-token (Chapter 1 does not match Chapter 10). Note: the index is flat — deep hierarchy (every section nested within a title) is not indexed, so this returns matching chapter/title-level records, not full title contents. Title-level indexing is a tracked future feature.
| Parameter | Type | Required | Description |
|---|---|---|---|
corpus | string | yes | charter, admin_code, or rules |
title | string | yes | Chapter or title identifier (e.g. Chapter 11) |
get_title("charter", "Chapter 11")
get_title("admin_code", "Title 6")
get_versionReturn the currency date for each document. Each corpus updates on its own schedule — the Charter and Administrative Code track enacted local laws, while the Rules update independently as agencies adopt new rules.
No parameters required.
get_version()
Example response:
NYC Charter: Current through Local Law 2026/112, enacted June 19, 2026, (854 sections; indexed 2026-06-29T12:33:00.864Z)
Administrative Code: Current through Local Law 2026/112, enacted June 19, 2026, (12587 sections; indexed 2026-06-29T12:33:09.801Z) Rules of NYC: Current through rules effective July 1, 2026. (8671 sections; indexed 2026-07-01T12:43:45.635Z)
whats_changedWhat changed in this server, newest first, from WHATS-CHANGED.md, which ships with the package. Covers new tools, corrections and other changes a reader would notice; daily law text updates are not listed (see CHANGELOG.md). Corrections say what to re-check if you used the old answer. Returns text plus structuredContent matching the tool's outputSchema.
| Parameter | Type | Required | Description |
|---|---|---|---|
since | string | no | YYYY-MM-DD: changes on or after this date |
tag | string | no | Site, Data, MCP or Correction (any case) |
limit | integer | no | 1 to 50, default 10 |
whats_changed()
whats_changed(tag="Correction")
about_betanycWho built the server (BetaNYC, a project of the Fund for the City of New York), its version and repository, where to report a bug in this server or ask for a new feature, and links to BetaNYC. No parameters.
whats_changed and about_betanyc are the two tools BetaNYC is adding to each of its MCP servers. src/betanyc-tools.ts is a copy of the canonical file in BetaNYC's workspace; never edit the copy. Their text ends with the one-line disclaimer (the full one with NYC_CLR_FOOTER=full), and they do not use up the full footer meant for the first law answer.
npm test
npm test builds the TypeScript source first (pretest script), then runs the full suite with node --test. Every test file in the table below runs together. On a laptop the whole run, build included, takes about 4 seconds (measured October 2026).
| File | What it covers |
|---|---|
test/extract-text.test.js | Unit tests for the extractText, normalize, childrenByTag, getAttr, and tagOf helpers in scripts/lib/extract-text.js. Covers inline-LINK document order (issue #3 regression), entity decoding, ALP-marker stripping, enumeration-marker repair, empty/self-closing elements, deep nesting, whitespace-only text nodes, and helper edge cases. |
test/content-leak.test.js | Regression tests for the content-leak fix (PR-A0): undecoded nbsp entities, [ALP S-xxx] editorial markers, and leading-digit run-ons (1Each). Includes scope guards confirming that inline labels with no after them in the source ((6)the) are left untouched. |
test/corpus-invariants.test.js | Invariant assertions over the committed data/index/json/*.json (every section across charter, admin\_code, and rules). Asserts: no run-together text, no subdivision label fused to the next word (a.There, issue #27), no leaked XML tags, no undecoded entities, no double spaces, no leading/trailing whitespace, and structural integrity against versions.json counts. Collects all violations before asserting, with corpus/id/citation/snippet in the failure message. |
test/mcp-tools.test.js | In-process tests for the MCP handler functions (searchCorpus, getSection, listTitles, getTitle, getVersions) imported from dist/corpus.js. Grounded in real index data: verifies § 292 text content (the issue-#3 corrected phrase), negative lookups, version presence, and title listing. |
test/search-fallback.test.js | Plain-language questions (issue #30). Unit tests for stopword and question-word stripping (queryTerms) and surrounding-quote removal (stripSurroundingQuotes). Exact ranks, counts and first-line notices run against a synthetic 8-section index committed at test/fixtures/search-index/, served through NYC_LAWS_INDEX_DIR in a child process: ranking by terms matched, word-start matching (shed is not found in "established"), plural s, the all-terms and widened notices, phrase results unchanged, quoted queries matched as phrases. Against the real index only behavior is checked (fallback used, notice first, terms listed, results non-empty), so a daily refresh cannot turn it red. |
test/index-dir.test.js | The NYC_LAWS_INDEX_DIR override (issue #26), each case in a child process: unset and blank serve the bundled index; a set directory serves its versions and section text; relative paths resolve against the working directory; a directory without versions.json fails at startup naming the variable, with no silent fallback. Also starts the server over stdio and checks that serverInfo.version matches package.json and that get_version reports the override. |
| test/footer-modes.test.js | Disclaimer footer modes (issue #25). NYC_CLR_FOOTER parsing (unset, blan