
Arabicfmt Mcp
io.github.cc1a2bPublished by GitHub account cc1a2bv0.1.1Updated Oct 24, 2026
Arabic formatting: 22 Arab currencies (Saudi riyal U+20C1), Hijri dates, تفقيط, RTL/bidi fixes.
Overview
A local MCP server exposing the arabicfmt library so an assistant can format Arab currencies, Hijri dates, Arabic number words, tafqit and RTL text.
- What you can do
- Format money in the 22 Arab League currencies, including symbols, precision, ranges and typed parts for new Unicode signs, plus tafqit spelling for cheques and invoices. Convert numbers to Arabic words, ordinals, fractions, durations, file sizes and relative times, and parse Arabic-digit strings back to numbers. Produce Hijri dates with deterministic Umm al-Qura tables. Clean up Arabic text: plurals, collation, slugs, search normalization and RTL/bidi isolation. Validate IBANs and Saudi national IDs.
- When to use it
- Useful when an assistant drafts Arabic invoices, cheques, contracts, price lists or localized interfaces and needs correct currency symbols, decimal precision, Hijri dates or spelled-out amounts. Also handy for fixing mixed-direction text and Arabic search or slug handling.
- Requirements
- Runs as a local process over stdio, installed from the npm package arabicfmt-mcp; Node.js 18 or later is required. No authentication, environment variables or headers are declared.
Installation
In SourceWeft
- Open Arabicfmt Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
arabicfmt
Arabic-first formatting for JavaScript & TypeScript
Currency symbols · Hijri/Islamic calendar · number-to-words · تفقيط · 6 plural forms · RTL/bidi —
correct for all 22 Arab League countries, with zero dependencies and full TypeScript types.
أرقامٌ وعملاتٌ وتواريخُ هجريةٌ ولغةٌ عربيةٌ سليمة — في سطرٍ واحد.
[npm version] [downloads] [jsDelivr hits] [gzipped size] [zero dependencies] [types included]
arabicfmt is the only JavaScript library that handles the entire Arabic formatting stack in one zero-dependency package — currency symbols, number precision, Hijri/Islamic calendar dates, RTL bidirectional text, Arabic number-to-words and تفقيط — with full TypeScript types. Works in Node, the browser, Deno, Bun and React Native.
New in 0.1.5: every currency sign from the Unicode 17.0/18.0 transition — SAR
U+20C1, MVRU+20C2, AEDU+20C3, OMRU+20C4— plus the tooling to actually render them: typed parts, a generated@font-face, price ranges and a date-aware transition registry.
What other libraries get wrong
Install
Requirements: Node.js ≥ 18 · TypeScript ≥ 4.7 (optional) · zero runtime dependencies.
Browser / CDN — no build step
Every release is mirrored on the jsDelivr and unpkg CDNs automatically. Import the browser-ready ESM bundle straight from a URL — no install, no bundler:
Subpaths work too — e.g. https://cdn.jsdelivr.net/npm/arabicfmt/dist/currency/index.js for just the currency module. Pin a version for production, e.g. [email protected].
Quick start
Currency formatting
Symbol strategy: symbolMode
The Saudi riyal received its own Unicode symbol (U+20C1) in September 2025. Most libraries either emit the wrong ligature (U+FDFC, the Iranian rial) or fall back to SAR. arabicfmt gives you full control:
Unicode 18.0 (16 September 2026): the AED (U+20C3), OMR (U+20C4) and MVR (U+20C2) signs are now
live, andautoprefers them. Need maximum compatibility today? UsesymbolMode: "text". The Saudi riyal keeps its safe text default by design. See the transition section for the full table.
Correct decimal precision — all 22 Arab League countries
Generated from CLDR 48.2.0 at build time and verified on every build:
All currency options
Price ranges
Pass rangeSeparator for anything other than the default spaced en dash
({ rangeSeparator: " إلى " }), and isolate: true to wrap the whole range
when it sits inside a mixed-direction sentence.
Rendering the new signs
A brand-new sign needs two things a string cannot give you: a webfont scoped to its codepoint, and a way to wrap only the symbol in the element that uses that font. Both are one call each.
1. The parts API — the currency counterpart to
Intl.NumberFormat.prototype.formatToParts:
needsFont is true exactly when the part holds a dedicated Unicode sign, so a
component never has to pattern-match a finished string (which is how bidi bugs
start):
Part types mirror Intl (integer, group, decimal, fraction,
minusSign, plusSign, literal) plus four arabicfmt adds: currency,
parenthesis (accounting), isolate (bidi controls) and rangeSeparator.
2. The @font-face rule — generated, with the unicode-range that makes it
free on pages that never print a sign:
Because the range is scoped to those codepoints, the browser downloads the font only when one of them is actually painted — body text is untouched. Put the family first in your stack and the rest falls through:
signUnicodeRange() returns just the range string ("U+20C1, U+20C2, U+20C3, U+20C4") for CSS-in-JS. Both helpers reject anything that would break out of
the rule, so a URL from config can't inject CSS.
Number formatting
Number to Arabic words (arabicToWords)
Convert integers to their Arabic word representation — handles gender agreement and all six scale levels.
Spell money in words — التفقيط
spellCurrency is the tafqit every Arabic invoice, cheque and contract needs: it turns a numeric amount into its full legal Arabic wording, splitting major and minor units and inflecting every noun for correct grammatical agreement (singular / dual / plural / accusative).
Full Arabic noun paradigms are bundled for all 22 Arab League currencies (SAR, AED, KWD, BHD, QAR, OMR, JOD, EGP, IQD, LYD, TND, DZD, MAD, SDG, LBP, SYP, YER, SOS, DJF, KMF, MRU). Inspect or extend them via the exported CURRENCY_WORDS table.
Ordinal numbers — الأعداد الترتيبية
Duration — spelled Arabic
formatDuration turns a time span into its spoken Arabic form, with correct
dual/plural/accusative agreement on every unit — something Intl.DurationFormat
(still barely supported) does not give you.
largest (default 2) caps how many units appear, biggest first. Want to drive
the noun agreement yourself? countedNoun(n, forms) is exported for any custom
counted noun.
File size — Arabic data units
Units scale through بايت · كيلوبايت · ميجابايت · جيجابايت · تيرابايت · بيتابايت,
with base: 1024 (binary, default) or base: 1000 (decimal).
Arabic plural rules (6 forms)
Arabic has six plural forms — more than any other major language. Standard i18n libraries handle 1–2 forms and break for Arabic.
Hijri / Islamic calendar dates
Two engines with an identical API:
Month and weekday name tables
Bidirectional (RTL) text helpers
Stop phone numbers and English words from scrambling Arabic sentences:
Text normalization for Arabic search
Match Arabic text despite diacritics, alef variants, hamza and taa marbuta differences:
List formatting
Join values into a grammatical Arabic list. Wraps Intl.ListFormat and degrades gracefully on runtimes without it.
Transliteration & URL slugs
Romanize Arabic script to readable Latin, or turn it into URL-safe slugs for routes, filenames and CMS permalinks. Deterministic — short vowels appear only when the text is vowelled (carries tashkeel).
Note: this is a pragmatic, reversible-ish romanization, not a strict academic transliteration (DIN 31635 / ISO 233). It is built for slugs, search keys and readable IDs.
Validation — IBAN & Saudi ID
Real checksums, not regex guesses. isValidIBAN runs the ISO 7064 mod-97
algorithm with SWIFT-registry length checks; isValidSaudiId runs the Luhn
check digit and classifies citizen vs. resident.
Registry lengths are enforced for SA, AE, KW, BH, QA, JO, LB, EG, IQ, PS, TN, MR, LY (plus common partners). Unknown-country IBANs are validated by checksum and the general 15–34 length bound, never accepted on structure alone.
Framework usage
React / Next.js
Vue 3
Node.js / Express
Locale auto-detection
Subpath imports — tree-shakeable
Pick only what you need for the smallest possible bundle:
Measured cost of each entry point (esbuild --bundle --minify, gzipped — v0.1.5):
The complete Arabic formatting stack costs less than a single small image.
Full API reference
Every public function, by module. Full signatures and options are in the sections above and in the bundled TypeScript types.
MCP server — use arabicfmt from AI agents
AI agents (Claude Desktop, Claude Code, Cursor) can call arabicfmt directly through the
arabicfmt-mcp Model Context Protocol server —
21 tools (format_currency, format_currency_range, currency_transition,
spell_currency, format_hijri, arabic_to_words, isolate_foreign,
validate_iban, …). Add it to your client's mcpServers config:
Source and full tool list: mcp/.
Examples
Runnable scripts for every feature live in examples/:
Engineering
Unicode currency-sign transition
Complete as of Unicode 18.0 — released 16 September 2026
Four currencies moved from an ad-hoc abbreviation to a dedicated Unicode sign in
this cycle, and arabicfmt carries all four. Note what is not on this list:
Kuwait has never issued a dinar sign — KWD is still د.ك / KD, and
transitionStatus("KWD") returns "none".
The rufiyaa is not an Arab League currency, but it was encoded in the same batch
and sits between the dirham and rial in the Currency Symbols block — carrying it
keeps the range contiguous, so one unicode-range covers the whole transition.
Because system-font coverage for brand-new signs still varies, symbolMode: "text" always returns the safe abbreviation, and the Saudi riyal keeps the text
symbol as its auto default by design.
The transition as data
Encoding is not rendering. A sign exists in the standard months or years before system fonts draw it, and every product shipping in that window has to decide what to print. That timeline is queryable:
transitionStatus takes a moment in time, so a historical invoice can be
re-rendered with the symbol that was correct on its own date.
Live demo
arabicfmt.vercel.app — the whole library, interactive and computed live in your browser. Change any input and watch the Arabic update in real time: currency studio, تفقيط, Hijri converter, plurals, RTL fixes and more.
[arabicfmt interactive playground]
Run it locally:
Contributing
Issues and pull requests are welcome on GitHub.
License
MIT — free for commercial and personal use.
Author & more projects
Built and maintained by cc1a2b.
If arabicfmt saves you time, please star it on GitHub — it helps other Arabic developers find it. Explore my other open-source projects, or open an issue with ideas, bugs and feature requests.
Source: README.md at commit 946ad4a
Tools
0Version history
1- v0.1.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts