
Arabicfmt Mcp
io.github.cc1a2b由 GitHub 帳號 cc1a2b 發布v0.1.1更新於 Oct 24, 2026
Arabic formatting: 22 Arab currencies (Saudi riyal U+20C1), Hijri dates, تفقيط, RTL/bidi fixes.
概覽
本機 MCP 伺服器,封裝 arabicfmt 函式庫,讓助理格式化阿拉伯貨幣、回曆日期、阿拉伯語數字讀法、تفقيط 及 RTL 文字。
- 可以做什麼
- 依 22 個阿拉伯國家貨幣格式化金額,包含符號、小數精度、區間,以及新 Unicode 符號的分段輸出,並為支票和發票提供 تفقيط 金額大寫。把數字轉為阿拉伯語詞彙、序數、分數、時長、檔案大小和相對時間,並把阿拉伯數字字串解析回數值。以固定的 Umm al-Qura 表產生回曆日期。處理阿拉伯語文字:複數形式、排序、slug、搜尋正規化和 RTL/雙向文字隔離。驗證 IBAN 和沙烏地身分證號。
- 適用情境
- 適合助理起草阿拉伯語發票、支票、合約、價目表或在地化介面,需要正確的貨幣符號、小數精度、回曆日期或金額大寫時使用。也適合修正混合方向文字以及處理阿拉伯語搜尋和 slug。
- 執行需求
- 以本機程序透過 stdio 執行,從 npm 套件 arabicfmt-mcp 安裝;需要 Node.js 18 或更新版本。未宣告驗證、環境變數或標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Arabicfmt Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.
來源:README.md,提交 946ad4a
工具
0版本歷史
1- v0.1.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分