mcp-arabic-toolkit
MCP server exposing Arabic text utilities: normalisation, tashkeel stripping, transliteration, heuristic dialect detection, and token counting.
README
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.
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.
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
- 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 github - 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。