mcp-arabic-toolkit
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-arabic-toolkit Normalise the Arabic text 'الْعَرَبِيَّةُ'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-arabic-toolkit
A small Model Context Protocol (MCP) server
exposing practical Arabic text utilities. Built with the official mcp Python
SDK (FastMCP).
Demonstrates: MCP server authoring / tool development
All tools are implemented for real -- deterministic string processing plus one
clearly-labelled heuristic. The pure logic lives in
arabic_tools.py (no mcp dependency), so it is
independently unit-tested; server.py is a thin MCP wrapper.
Tools
Tool | Description | Example input | Example output |
| NFC-normalises, removes diacritics (harakat/tashkil) and tatweel, and optionally unifies letter variants (alef/yeh/teh-marbuta). |
|
|
| Removes only the diacritics (and, by default, the tatweel); leaves letters as-is. |
|
|
| Documented, deterministic Arabic→Latin romanisation (simplified DIN 31635 / ALA-LC, ASCII digraphs). |
|
|
| Heuristic dialect guess (Egyptian/Levantine/Gulf/Maghrebi/MSA) from marker words. Not a trained classifier — see limits below. |
|
|
| Whitespace-token count plus character and Arabic-character statistics. |
|
|
About detect_dialect (read this)
detect_dialect is an honest heuristic, not a machine-learning model. It
counts hand-picked marker words/particles per dialect and returns the highest
scorer. Known limits:
Only five coarse groups (Egyptian, Levantine, Gulf, Maghrebi, MSA).
Unreliable on short input, mixed-dialect text, and code-switching.
confidenceis a crude ratio (winning hits / total hits), not a calibrated probability.Falls back to MSA with
confidence: 0.0when no markers are found.
For production-grade detection, train a supervised classifier (e.g. fastText or a fine-tuned transformer) on a labelled corpus such as MADAR or NADI.
About transliterate
The romanisation is deterministic and documented but intentionally simple:
No vowel inference — short vowels are produced only from explicit harakat.
No context-sensitive rules — the article
الis alwaysal-(no sun-letter assimilation), and hamzat al-wasl is not elided.Shadda doubles the preceding consonant; sukun emits no vowel.
One-way (Arabic → Latin); not round-trippable.
Related MCP server: arabicfmt-mcp
Install
Requires Python 3.10+.
# Clone, then install the package (editable for local development):
pip install -e .This pulls in the mcp SDK and registers a mcp-arabic-toolkit console script.
The tests themselves need only pytest (no mcp SDK):
pip install pytestRun
# Option A: run the module directly (stdio transport)
python server.py
# Option B: run the installed console script
mcp-arabic-toolkitRegister with an MCP client
To use it from Claude Desktop (or any MCP client), add an entry to the client's MCP server config:
{
"mcpServers": {
"arabic-toolkit": {
"command": "python",
"args": ["/absolute/path/to/mcp-arabic-toolkit/server.py"]
}
}
}Test
python -m pytest tests/ -vThe suite (tests/test_tools.py) imports the pure logic directly and covers
every tool with concrete examples (diacritic/tatweel removal, letter
unification, transliteration with and without harakat, each dialect, and token
counting).
Quick local check
python -c "import arabic_tools; print(arabic_tools.normalise_arabic('الْعَرَبِيَّةُ'))"
# -> العربيةPublishing to the MCP registry
This package ships a server.json manifest compatible with the
official MCP registry.
Exact metadata (server.json)
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"name": "io.github.benjiscollector/mcp-arabic-toolkit",
"description": "MCP server exposing Arabic text utilities: normalisation, tashkeel stripping, transliteration, a heuristic dialect detector, and token counting.",
"status": "active",
"repository": {
"url": "https://github.com/BenjisCollector/mcp-arabic-toolkit",
"source": "github"
},
"version": "0.2.0",
"packages": [
{
"registryType": "pypi",
"registryBaseUrl": "https://pypi.org",
"identifier": "mcp-arabic-toolkit",
"version": "0.2.0",
"transport": { "type": "stdio" }
}
]
}The server name uses the io.github.<owner>/<repo> namespace, which the
registry verifies against GitHub ownership during publish.
Steps
Build and publish the PyPI package so the registry has something to point at:
python -m build twine upload dist/*Install the registry publisher CLI (
mcp-publisher) — see the registry publishing guide.Authenticate with GitHub so the CLI can verify the
io.github.*namespace:mcp-publisher login githubPublish from the directory containing
server.json:mcp-publisher publish
To list this server on the community modelcontextprotocol/servers README as well, see SUBMISSION.md for the exact entry text and PR steps.
License
MIT — see LICENSE.
Available Tools
5 toolscount_tokensA
Count basic statistics: whitespace tokens, characters, Arabic characters.
"Tokens" means whitespace-delimited words (not an LLM subword tokenizer).
Args: text: The text to measure.
Returns: A dict with token, character, no-space character, and Arabic-character counts.
Inputs: text (required). Returns: result
detect_dialectA
Guess the Arabic dialect using a transparent keyword heuristic.
This is a rule-based heuristic, NOT a trained classifier. It counts
hand-picked marker words per dialect (Egyptian, Levantine, Gulf, Maghrebi,
MSA) and returns the best match with a crude confidence. See
:func:arabic_tools.detect_dialect for the full documented limitations.
Args: text: The Arabic text to classify.
Returns: A dict with the predicted dialect, label, crude confidence, per-dialect scores, and a note documenting that this is a heuristic.
Inputs: text (required). Returns: result
normalise_arabicA
Normalise Arabic text by removing diacritics, tatweel, and (optionally) unifying letter variants.
Unicode-normalises to NFC.
Optionally removes Arabic diacritics (harakat / tashkil).
Optionally removes the tatweel (kashida) elongation character.
Optionally collapses alef/yeh/teh-marbuta variants (off by default; lossy).
Args: text: The Arabic (or mixed) text to normalise. strip_diacritics: Remove harakat / tashkil marks. Defaults to True. strip_tatweel: Remove the tatweel (kashida) character. Defaults to True. normalise_letters: Collapse alef/yeh/teh-marbuta variants. Default False.
Returns: The normalised text.
Inputs: text (required), strip_diacritics, strip_tatweel, normalise_letters. Returns: result
strip_tashkeelA
Remove Arabic diacritics (tashkeel) and, optionally, the tatweel.
Args: text: The Arabic (or mixed) text to clean. strip_tatweel: Also remove the tatweel character. Defaults to True.
Returns: The text with diacritics (and optionally tatweel) removed.
Inputs: text (required), strip_tatweel. Returns: result
transliterateA
Transliterate Arabic text into Latin characters.
Uses a documented, deterministic Arabic -> Latin scheme (loosely DIN 31635 /
ALA-LC, simplified to ASCII digraphs). See :func:arabic_tools.transliterate
for the full documented limitations.
Args: text: The Arabic text to transliterate.
Returns: A dict with the transliterated string and the scheme name.
Inputs: text (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a distinct purpose: counting tokens, dialect detection, normalization, diacritic stripping, and transliteration. The slight overlap between normalise_arabic and strip_tashkeel is clarified by descriptions, making them clearly distinguishable.
Most tool names follow a verb_noun pattern (count_tokens, detect_dialect, normalise_arabic, strip_tashkeel). 'transliterate' is a single verb without an object, which is a minor inconsistency, but overall the pattern is clear and predictable.
5 tools is well-scoped for an Arabic text processing toolkit. Each tool covers a common, meaningful operation without being too few or too many.
The toolkit covers essential Arabic text operations: counting, dialect detection, normalization, diacritic removal, and transliteration. Minor gaps exist (e.g., no stemming or morphological analysis), but for a small toolkit it is reasonably complete.
Related MCP Connectors
MCP server for Speech-to-Text
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for Translation Services
Document conversion MCP server: PDF to Markdown, image OCR, spreadsheet parsing.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceModular MCP server providing text preprocessing and NLP tools for AI agent ecosystems.MIT
- AlicenseAqualityCmaintenanceMCP server for correct Arabic formatting — currency, Hijri dates, number-to-words, RTL fixes and validation across all 22 Arab countries. Zero-dependency.17140 npm3MIT
- AlicenseAqualityDmaintenanceMCP server that provides grounded Arabic dictionary lookup, enabling AI agents to search word roots, inflections, and meanings from real dictionary data.32MIT
- AlicenseNot gradedqualityCmaintenanceProvides Arabic UI/UX design tools as an MCP server, offering RTL conversion, Arabic typography validation, cultural palettes, and anti-AI-slop auditing for AI-assisted design workflows.MIT