Skip to main content
Glama
BenjisCollector

mcp-arabic-toolkit

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

normalise_arabic

NFC-normalises, removes diacritics (harakat/tashkil) and tatweel, and optionally unifies letter variants (alef/yeh/teh-marbuta).

الْعَرَبِيَّةُ

العربية

strip_tashkeel

Removes only the diacritics (and, by default, the tatweel); leaves letters as-is.

كــــتاب

كتاب

transliterate

Documented, deterministic Arabic→Latin romanisation (simplified DIN 31635 / ALA-LC, ASCII digraphs).

كَتَبَ

{"transliteration": "kataba", "scheme": "din31635-simplified-ascii"}

detect_dialect

Heuristic dialect guess (Egyptian/Levantine/Gulf/Maghrebi/MSA) from marker words. Not a trained classifier — see limits below.

شو بدك هلق؟

{"dialect": "levantine", "confidence": 1.0, ...}

count_tokens

Whitespace-token count plus character and Arabic-character statistics.

مرحبا يا عالم

{"tokens": 3, "characters": 13, ...}

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.

  • confidence is a crude ratio (winning hits / total hits), not a calibrated probability.

  • Falls back to MSA with confidence: 0.0 when 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 always al- (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 pytest

Run

# Option A: run the module directly (stdio transport)
python server.py

# Option B: run the installed console script
mcp-arabic-toolkit

Register 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/ -v

The 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

  1. Build and publish the PyPI package so the registry has something to point at:

    python -m build
    twine upload dist/*
  2. Install the registry publisher CLI (mcp-publisher) — see the registry publishing guide.

  3. Authenticate with GitHub so the CLI can verify the io.github.* namespace:

    mcp-publisher login github
  4. Publish 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 tools
count_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.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the exact counts returned (tokens, characters, no-space characters, Arabic characters) and clarifies the definition of tokens. Since no annotations are provided, the description takes on full transparency burden and does so adequately, though it could explicitly state the tool has no side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise, front-loading the purpose, then clarifying key terms, and listing parameters and returns in a structured way. Every sentence serves a purpose with no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple counting tool with one parameter and an output schema, the description adequately explains the return values (dict with specific fields). It could include an example or edge-case handling, but overall it is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The only parameter 'text' receives a minimal description in the Args section ('The text to measure'), adding little beyond the schema title. With 0% schema description coverage, the description should provide more detail (e.g., encoding, length limits), but it does not.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool counts basic statistics (whitespace tokens, characters, Arabic characters). It distinguishes itself from sibling tools like detect_dialect or normalise_arabic, which are about processing, not counting.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clarifies that 'tokens' means whitespace-delimited words, helping avoid misuse. However, it provides no explicit guidance on when to use this tool versus alternatives, nor any exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Describes the heuristic approach (counts marker words, returns best match with crude confidence) and notes it's not a classifier. No annotations exist, so the description carries the full burden, which it meets adequately, though more detail on limitations would improve it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured with Args and Returns sections. It avoids unnecessary verbosity while providing key details. Slight improvement could condense the Args/Returns into prose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity and presence of an output schema description (in text, not input schema), the description covers the heuristic nature, return format, and limitations. It is complete for the task.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'text' is described as 'The Arabic text to classify,' which adds meaning beyond the schema's empty description. Schema coverage is 0%, so the description compensates well, though the parameter is straightforward.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool guesses Arabic dialect using a transparent keyword heuristic. The verb 'guess' and resource 'Arabic dialect' are specific. It distinguishes from siblings which are unrelated (token counting, normalization, etc.).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States it's a rule-based heuristic, not a trained classifier, but lacks explicit guidance on when to use vs alternatives. Users are directed to read full limitations elsewhere, which is helpful but does not provide direct context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
strip_diacriticsNo
strip_tatweelNo
normalise_lettersNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully discloses behavioral traits: it describes Unicode NFC normalization, the effect of each boolean parameter (strip_diacritics, strip_tatweel, normalise_letters), notes that normalise_letters is lossy, and specifies the return type. This compensates for the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points and clear sections (Args, Returns), but includes some redundancy (e.g., explaining tatweel as both 'elongation character' and 'kashida'). Still efficient and informative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no annotations, and an output schema (presumably simple), the description covers all relevant aspects: parameter defaults, optionality, lossiness, normalization steps, and return type. No gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite the input schema having no descriptions (0% coverage), the description adds detailed semantics for each parameter in an 'Args' section, explaining what each boolean controls and the default values, far exceeding schema information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Normalise') and resource ('Arabic text'), lists specific operations (removing diacritics, tatweel, unifying letters), and clearly distinguishes from sibling tools like 'detect_dialect' and 'transliterate' which handle different tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states what the tool does and the optionality of certain transformations (e.g., 'optionally'), but does not explicitly specify when to use this tool over siblings like 'strip_tashkeel' or 'transliterate'. However, the context makes it clear for normalization purposes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
strip_tatweelNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does not disclose behavior beyond its main purpose, such as handling of non-Arabic text, idempotency, or performance. It does specify the return value, which adds some transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a clear docstring format including Args and Returns sections. It is front-loaded with the main purpose. Minor improvement could be merging the first line into the docstring style, but overall well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 parameters, output schema exists), the description is complete enough. It explains both parameters and the return value, enabling correct usage without additional context. Slightly more detail on edge cases would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must add meaning. It explains both parameters: 'text' and 'strip_tatweel' (with default True), and provides a return description, adding significant value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Remove' and the resource 'Arabic diacritics (tashkeel) and, optionally, the tatweel'. It distinguishes the tool from siblings like count_tokens, detect_dialect, normalise_arabic, and transliterate, which perform different tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly state when to use this tool versus alternatives. It implies use for removing diacritics, but lacks guidance on when not to use or mention of alternative tools, though siblings are sufficiently different.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Although no annotations are provided, the description discloses the transliteration scheme (DIN 31635/ALA-LC simplified to ASCII digraphs) and notes that it is deterministic with documented limitations. This adds behavioral context beyond the raw function name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a front-loaded main action, followed by parameter and return documentation in a structured format. It avoids unnecessary detail while covering essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately covers the tool's purpose, parameter, return value (dict with transliterated string and scheme name), and references limitations. Given the tool's simplicity and the presence of an output schema, it is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite low schema parameter description coverage (0%), the description only restates the parameter name 'text' without adding format, constraints, or examples. This fails to compensate for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Transliterate Arabic text into Latin characters', specifying both the verb and the resource. It is distinct from sibling tools (count_tokens, detect_dialect, etc.) which address different Arabic text operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lacks explicit guidance on when to use this tool versus alternatives. While the purpose is clear, it does not provide context-specific recommendations or mention any prerequisites or limitations for use.

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. Dates show when Glama detected each change.

  1. 5 tool updatesv0.2.0
    • First observedcount_tokens
    • First observeddetect_dialect
    • First observednormalise_arabic
    • First observedstrip_tashkeel
    • First observedtransliterate

TDQS

A4.1/5.0
Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BenjisCollector/mcp-arabic-toolkit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server