# chile-kit > The toolkit for building software in Chile: RUT, CLP, IVA, regions and communes, banks, UF/UTM and Santiago dates. Zero-dependency TypeScript package `chile-kit` (ESM, Node >= 22.12, browsers, Edge) plus an MCP server `chile-kit-mcp`. Install: `npm install chile-kit`. Every module is a subpath export (`chile-kit/rut`, `/clp`, …) and also re-exported from the package root. All functions are pure and synchronous except `/indicators`. Formatters accept `null`/`undefined` and never throw on bad display input. MCP server for agents: `npx -y chile-kit-mcp` (stdio). Claude Code: `claude mcp add chile-kit -- npx -y chile-kit-mcp`. Tools (each with an output schema): validate_rut, format_rut, rut_check_digit, format_clp, normalize_phone, whatsapp_link, search_communes, get_region, list_banks, iva_from_net, iva_from_gross, get_indicators, format_date_chile. get_indicators returns `{ values, errors? }` and falls back to the official CMF API when the server has `CMF_API_KEY`; search_communes returns `{ communes }`. On native Windows use `cmd /c npx -y chile-kit-mcp`. ## API - `/rut`: `isValidRut(rut): boolean` (modulo-11 verifier, body 1-9 digits, not all zeros); `normalizeRut(rut): string | null` ("12.345.678-k" → "12345678K", for storage; null when not RUT-shaped, e.g. "hola"); `formatRut(rut): string` ("123456785" → "12.345.678-5"); `rutCheckDigit(body)` → "0"-"9" | "K" | null (dots allowed); `isValidRut(rut, { minBody })` (e.g. 1_000_000 to reject short typos for people); `formatRutInput(value)` progressive formatting for an input's onChange ("1234567" → "123.456-7", caps at 9 digits + verifier). - `/clp`: `formatCLP(n)` → "$1.234.567" (rounded, no decimals; negative "$-5.000"); `formatNumber(n)` → "1.234,5"; `fmtClp(n)` / `fmtNumber(n)` return "—" for null, undefined, NaN, Infinity. Output is identical on every runtime (no Intl). - `/iva`: `IVA_RATE = 0.19`; `ivaFromNet(net, rate?)`, `grossFromNet(net, rate?)`, `netFromGross(gross, rate?)`, `ivaFromGross(gross, rate?)`, `splitGross(gross, rate?)` → `{ net, iva, gross }` with net + iva = gross; `lineAmount({ unitPrice, quantity?, discount? })`; `invoiceTotals(lines, rate?)` → `{ lines, net, exempt, iva, total }` with IVA computed once on the net; `roundClp(n)` half away from zero. All amounts are integer pesos, within ±Number.MAX_SAFE_INTEGER (RangeError beyond, and for NaN/Infinity). - `/phone`: `normalizeChileanPhone(input)` → "+56912345678" or null (mobiles only); `formatChileanPhone(input)` → "+56 9 1234 5678" (unparseable input returned as-is); `isValidChileanMobile(input)`. - `/wa`: `buildWaLink(phone, text?)` → "https://wa.me/56912345678?text=…" or null when there are no digits. - `/name`: `titleCaseName(raw)` → "María de los Ángeles Pérez" (Spanish particles lowercase, O'Higgins, María-José, keeps acronyms in mixed-case input). - `/date`: always America/Santiago, same output on server and client. `formatChileDate(input, "short" | "medium" | "long" | "full")` → "04-12-2026" | "4 dic 2026" | "4 de diciembre de 2026" | "viernes, 4 de diciembre de 2026"; `formatChileTime(input, { seconds? })` → "14:05"; `formatChileDateTime(input, style?)` → "04-12-2026 14:05"; `toChileISODate(input)` → "2026-12-04"; `chileToday()`; `getChileDateParts(input)`; `CHILE_TIME_ZONE`. Input: Date, epoch ms or ISO string; a date-only "2026-12-04" is a Chilean calendar date (midnight in Santiago, no day shift); invalid gives "". - `/zod` (needs zod 4 as a peer): `rutSchema` and `personRutSchema` (→ normalized RUT), `phoneSchema` (→ E.164), `clpSchema` (whole non-negative pesos), `regionCodeSchema` (→ "13"), `communeCodeSchema` (→ "13120"); Spanish error messages. - `/regions`: `REGIONS` (16, north to south: `{ id: "RM", code: "13", iso: "CL-RM", name, abbreviation, romanNumber }`), `PROVINCES` (56: `{ code: "131", name, regionCode }`), `COMMUNES` (346: `{ id: "nunoa", code: "13120", name: "Ñuñoa", provinceCode, regionCode }`); `getRegion(codeOrIdOrIsoOrRoman)`, `findRegion(name)`, `getProvince(code)`, `getCommune(cutOrSlug)`, `findCommune(name)` (accent/case-insensitive, knows alternative spellings), `searchCommunes(query, { region?, limit? })`, `getCommunesByRegion(region)`, `getCommunesByProvince(code)`, `getProvincesByRegion(region)`. Codes are official CUT (Decreto 1115, 2018). - `/banks`: `BANKS` (`{ code: "012", name, shortName: "BancoEstado", brands }`, CMF codes), `getBank(code, { banks? })`, `findBank(nameOrBrand, { banks? })` (pass `[...BANKS, myBank]` to extend) ("Banco" optional; Banco Security, code 049, merged into BICE 028 in 2025 and resolves to it), `ACCOUNT_TYPES` (checking "Cuenta corriente", demand "Cuenta vista", rut "CuentaRUT", savings "Cuenta de ahorro"), `getAccountType(id)`. - `/indicators`: `getIndicator(code, options?)` with code "uf" | "utm" | "dolar" | "euro" → `Promise<{ code, name, value, date }>` (value in CLP, date YYYY-MM-DD); `getIndicators(codes?, options?)` → record by code. Options: `date` (YYYY-MM-DD), `cache` (`{ get, set }`, default in-memory 1 h, `null` disables), `fetchOptions` (passed to fetch, e.g. `{ next: { revalidate: 3600 } }`), `timeoutMs`, `signal`, `fetch`, `baseUrl`, `source` and `fallback` (`IndicatorSource` or list, tried in order on IndicatorError). Sources: `mindicadorSource()` (default, community-run, no SLA) and `cmfSource({ apiKey })` (official CMF API, free key; recommended as primary or fallback for production). Throws `IndicatorError` with `reason` "network" | "timeout" | "http" | "invalid-response" | "not-found" (`timeoutMs`, default 10 s, covers headers and body). Source: mindicador.cl. ## Docs - [Home](https://gvelasquez760.github.io/chile-kit/) - [RUT](https://gvelasquez760.github.io/chile-kit/rut/) - [CLP](https://gvelasquez760.github.io/chile-kit/clp/) - [IVA](https://gvelasquez760.github.io/chile-kit/iva/) - [Phones](https://gvelasquez760.github.io/chile-kit/phone/) - [WhatsApp links](https://gvelasquez760.github.io/chile-kit/wa/) - [Names](https://gvelasquez760.github.io/chile-kit/name/) - [Regions and communes](https://gvelasquez760.github.io/chile-kit/regions/) - [Banks](https://gvelasquez760.github.io/chile-kit/banks/) - [Indicators](https://gvelasquez760.github.io/chile-kit/indicators/) - [Dates](https://gvelasquez760.github.io/chile-kit/date/) - [MCP server](https://gvelasquez760.github.io/chile-kit/mcp/) - [Next.js](https://gvelasquez760.github.io/chile-kit/nextjs/) - [Zod schemas](https://gvelasquez760.github.io/chile-kit/zod/) - [For AI coding agents: skill, Cursor rules, prompts](https://gvelasquez760.github.io/chile-kit/agents/) - [Guías en español](https://gvelasquez760.github.io/chile-kit/es/): [Validar RUT](https://gvelasquez760.github.io/chile-kit/es/validar-rut/), [Dígito verificador](https://gvelasquez760.github.io/chile-kit/es/digito-verificador/), [RUT en un input](https://gvelasquez760.github.io/chile-kit/es/formatear-rut-input/), [Calcular IVA](https://gvelasquez760.github.io/chile-kit/es/calcular-iva/), [Pesos chilenos](https://gvelasquez760.github.io/chile-kit/es/formatear-pesos-chilenos/), [Valor UF](https://gvelasquez760.github.io/chile-kit/es/valor-uf/), [Teléfonos](https://gvelasquez760.github.io/chile-kit/es/validar-telefono/), [Regiones y comunas](https://gvelasquez760.github.io/chile-kit/es/regiones-comunas-json/), [Fechas de Chile](https://gvelasquez760.github.io/chile-kit/es/fechas-chile-nextjs/) - [Source and README](https://github.com/gvelasquez760/chile-kit) - [Full docs in one file (llms-full.txt)](https://gvelasquez760.github.io/chile-kit/llms-full.txt)