arabic-nlp-mcp
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., "@arabic-nlp-mcpPrepare this Arabic text for search and deduplication"
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.
Arabic NLP MCP
An MCP v2 server centered on dependable Arabic preprocessing for search, RAG, and deduplication, with additional experimental linguistic tools. It uses typed, closed-world structured outputs. Results identify their method and expose ambiguity, fallback, or coverage rather than presenting heuristic scores as probabilities.
Tools
Tool | Behavior | Important boundary |
| Deterministic Unicode normalization | Options may be lossy; choose them for the downstream task |
| Profiles, mixed-language tokens, audit trail, and stable fingerprint | Primary supported workflow; |
| Weighted token/phrase evidence for Gulf, Egyptian, Levantine, and MSA | Heuristic; returns |
| Explicit | Lexicon scores are not calibrated; transformer support is optional |
| Lexical dictionary lookup with coverage report | Does not infer contextual grammar or case endings |
The default MCP server exposes only the two stable preprocessing tools. The
three linguistic tools are available through the deliberately named
arabic-nlp-mcp-experimental entry point, so clients cannot mistake them for
validated classifiers. All tools reject inputs over 20,000 characters and are annotated read-only,
idempotent, non-destructive, and closed-world in MCP.
Related MCP server: mcp-arabic-toolkit
Install and run
Python 3.10 or newer is required.
python -m pip install .
arabic-nlp-mcpTo opt into the experimental dialect, sentiment, and lexical-diacritization
tools, configure the command as arabic-nlp-mcp-experimental.
Transformer sentiment is intentionally not part of the lightweight core:
python -m pip install ".[transformers]"Example MCP client configuration:
{
"mcpServers": {
"arabic-nlp": {
"command": "python",
"args": ["-m", "arabic_nlp_mcp.server"]
}
}
}Python API
Functions return Pydantic models. Serialize with model_dump() when a plain
dictionary is needed.
from arabic_nlp_mcp.dialect import detect_dialect
from arabic_nlp_mcp.search import prepare_for_search
from arabic_nlp_mcp.sentiment import analyze_sentiment
prepare_for_search("إِنَّ AI رقم ١٢٣").model_dump()
detect_dialect("وين").model_dump() # predicted: mixed
analyze_sentiment("مش حلو", backend="lexicon").model_dump()backend="auto" attempts the transformer and reports fallback_reason if it
uses the lexicon. backend="transformer" raises an error when unavailable; it
never silently falls back.
Search profiles
conservative: compatibility normalization and invisible-format cleanup; preserves Arabic marks, letter variants, and digits.search: additionally strips marks and unifies alef, yeh, Arabic/Persian digits, punctuation, and Latin case. This is the recommended default.aggressive: additionally merges hamza seats and taa marbuta and collapses expressive repetition. Use only when recall matters more than false matches.
The original text is always returned. fingerprint is SHA-256 over normalized
tokens, so equivalent search forms can be deduplicated without storing the
normalized content as an identifier.
For streaming files without loading the corpus into memory:
arabic-nlp search --jsonl < input.txt > prepared.jsonlVerification
python -m pip install -e ".[dev]"
ruff check .
pytest
python -m build
python -m twine check dist/*The test corpus is a regression suite, not an external accuracy benchmark. This project publishes no accuracy, F1, or coverage claim until a licensed, versioned external dataset and reproducible evaluation are added.
Limitations
Dialect identification covers only four broad buckets and code-switching is not modeled. The evidence score is descriptive, not calibrated confidence.
Lexicon sentiment has limited vocabulary and basic local negation. The optional model has its own training-domain limitations.
Diacritization is useful only where dictionary coverage is adequate. It is not a replacement for a contextual morphological model.
Normalization can intentionally remove distinctions such as
ىversusي.
Do not use these heuristic outputs alone for high-stakes decisions.
arabic_prepare_for_search and arabic_normalize are the stable core.
Dialect, sentiment, and lexical diacritization are labeled experimental until
versioned external evaluations justify stronger guarantees.
Contributing and security
See CONTRIBUTING.md, SECURITY.md, and THREAT_MODEL.md. Changes are recorded in CHANGELOG.md. Released under the MIT License.
Available Tools
2 toolsarabic_normalizeCRead-onlyIdempotent
Normalize Arabic text with individually controlled Unicode rules.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| unify_yeh | No | ||
| unify_alef | No | ||
| remove_tatweel | No | ||
| strip_diacritics | No | ||
| unify_teh_marbuta | No | ||
| collapse_repeated_letters | No | ||
| remove_control_characters | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| lossy | Yes | |
| method | No | |
| changed | Yes | |
| original | Yes | |
| warnings | No | |
| normalized | Yes | |
| transformations_applied | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare the tool read-only, idempotent, and non-destructive, so the safety profile is covered. The description adds only the vague notion that Unicode rules are individually controlled, which mostly restates the boolean flags in the schema rather than disclosing meaningful behavioral details like output shape or edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no filler words. It is efficiently worded, but the extreme brevity might underspecify a tool with 8 parameters; still, for pure conciseness it scores well.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 parameters, a visible sibling, and no schema-level descriptions), a one-sentence description is insufficient. It does not explain parameter choices, suggest when normalization is preferable to search preparation, or mention any behavior beyond the bare action, making the overall context incomplete despite annotations and output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description must compensate by explaining parameters, but it does not name or define any of the 8 properties. The phrase 'individually controlled Unicode rules' hints at the boolean toggles but provides no concrete meaning for 'unify_yeh', 'strip_diacritics', or the others, leaving the agent to rely on parameter names alone.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear verb ('Normalize') and resource ('Arabic text'), and the phrase 'individually controlled Unicode rules' signals that the tool applies configurable transformations. However, it does not differentiate this tool from its sibling 'arabic_prepare_for_search', so an agent cannot immediately tell which normalization-oriented tool to pick.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description offers no guidance on when to use this tool versus 'arabic_prepare_for_search', nor does it mention any exclusions or alternative tools. An agent would have to infer usage from the tool name and schema, which is insufficient for selecting between siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
arabic_prepare_for_searchARead-onlyIdempotent
Prepare Arabic/mixed text for search, RAG, and deduplication.
Returns normalized tokens, a stable SHA-256 fingerprint, lossiness, warnings, and the exact transformation audit trail.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| profile | No | search |
Output Schema
| Name | Required | Description |
|---|---|---|
| lossy | Yes | |
| method | No | |
| tokens | Yes | |
| changed | Yes | |
| profile | Yes | |
| original | Yes | |
| warnings | No | |
| fingerprint | Yes | |
| search_text | Yes | |
| transformations_applied | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already carry readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so no safety disclosure is owed. The description adds real behavioral texture beyond that: the transformation is lossy (and therefore reports lossiness), is deterministic enough for its fingerprint to be 'stable', and returns warnings plus a full audit trail. Nothing contradicts the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no filler: the first front-loads purpose and use cases, the second itemizes the returned artifacts. Every clause earns its place and nothing is redundant with the input schema or annotations.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so the listed return fields do not need exhaustive explanation. The main remaining gap is profile selection semantics: with three transformation-strength levels and no guidance on when each is appropriate, an agent cannot reason correctly about the core tradeoff. Given the moderate complexity, the description is adequate but not complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the prose carries the full burden. The description gives no hint of how to choose or interpret the 'profile' parameter — the three enum values ('conservative', 'search', 'aggressive') are left entirely unexplained apart from the 'search' default. It only partly compensates by scoping 'text' to Arabic/mixed input, so the most decision-heavy parameter is undocumented.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action ('Prepare…text') plus a clear resource ('Arabic/mixed text') and concrete use cases (search, RAG, deduplication). It names the returned artifacts (tokens, SHA-256 fingerprint, lossiness, audit trail), making the tool's job unambiguous. It never distinguishes itself from the sibling 'arabic_normalize' explicitly, so it misses the top score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'for search, RAG, and deduplication' gives an implied context for when to reach for this tool. However, the description never mentions the sibling 'arabic_normalize', gives no when-not-to-use guidance, and provides no explicit exclusion criteria, leaving selection between the two tools to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
arabic_normalize - First observed
arabic_prepare_for_search
TDQS
Scored across 2 tools
The two tools have distinct purposes: one performs general normalization with controllable Unicode rules, while the other is specifically for preparing text for search/RAG/deduplication with richer output. There is some conceptual overlap since both involve normalization, but the names and descriptions clearly differentiate the more fundamental operation from the higher-level preparation pipeline.
Both tool names follow a consistent 'arabic_<action>' snake_case pattern, with a clear verb indicating the operation. The prefix 'arabic_' also makes the domain obvious, and the naming style is uniform across the set.
With only two tools, the server feels thin for a general Arabic NLP package. However, the two tools form a coherent pair that could be sufficient for a narrowly focused normalization and search-preparation use case.
The tools cover a normalization-to-search-preparation workflow with outputs like tokens, fingerprints, and audit trails, which addresses common RAG/deduplication needs. Missing are other typical Arabic NLP operations such as stemming, transliteration, named-entity recognition, or morphological analysis, leaving the server somewhat incomplete for a broader NLP scope.
Maintenance
Related MCP Connectors
Arabic-first OCR, translation and document extraction. First call mints a free trial key.
- SnipgetOAuthai.snipget
300+ deterministic data utilities for AI agents: validate, normalize, parse, match, redact.
Sentiment, toxicity, entity extraction, PII, translation, summary, QA, fraud scoring, safety audit.
Toxicity, sentiment, NER, PII detection, and language identification tools
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server for correct Arabic formatting — currency, Hijri dates, number-to-words, RTL fixes and validation across all 22 Arab countries. Zero-dependency.17101 npm3MIT
- AlicenseAqualityDmaintenanceMCP server exposing Arabic text utilities: normalisation, tashkeel stripping, transliteration, heuristic dialect detection, and token counting.5MIT
- AlicenseNot gradedqualityBmaintenanceProvides AI clients with fast, hallucination-free access to the Quran through 13 MCP tools, covering search, navigation, morphology, tafsir, translations, and surah background over stdio and Streamable HTTP.MIT
- 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