Skip to main content
Glama

fanar-mcp

A Model Context Protocol server for Fanar, the Arabic-centric generative AI platform built by QCRI at Hamad Bin Khalifa University. It gives any MCP client (Claude Desktop, Claude Code, Cursor, and other agent harnesses) Fanar's chat models, cited Islamic question answering, Qur'an and hadith quotation checks, deep research, Arabic-English translation, Arabic speech in both directions, and image generation.

Built for the Islamic finance community first: ask a fiqh question and get the sources, check every quotation in a draft before it is published, and translate classical Arabic texts.

Independent open-source project by Blade Labs. Not affiliated with or endorsed by QCRI or HBKU. Status: alpha.

Tools

Tool

What it does

Fanar model

Default limit per key

fanar_list_models

Models your key may call. Start here: entitlements differ per key

fanar_chat

Chat in Arabic (MSA and dialects) or English, optional step-by-step thinking

Fanar-C-2-27B, Fanar

50 a minute

fanar_islamic_qa

Islamic Q&A with references; madhab and source filters on Sadiq-2

Fanar-Sadiq, Fanar-Sadiq-2

50 a minute

fanar_validate_quotations

Finds and verifies Qur'an and hadith quotations in any text

Fanar-Sadiq-2

200 a minute

fanar_deep_research, fanar_deep_research_result

Structured, cited research report on an Islamic topic (minutes)

Fanar-Sadiq-2

20 a day

fanar_translate

Arabic-English translation, including classical texts

Fanar-3.0-Shaheen-Translate

20 a day

fanar_text_to_speech

Arabic or English speech in ten voices; Qur'an reciters on Sadiq-TTS

Fanar-Aura-TTS-2

20 a day

fanar_transcribe

Arabic (with dialects) or English speech to text; long-form option

Fanar-Aura-STT-1, STT-LF-1

20 a day, 10 long-form

fanar_generate_image

Culturally aware image generation

Fanar-Oryx-IG-2

20 a day

fanar_moderate

Safety and cultural-awareness scores for a prompt and response

Fanar-Guard-2

50 a minute

fanar_poem

Arabic poetry in the classical tradition

Fanar-Diwan

50 a minute

Limits are Fanar's published defaults; every result carries the remaining quota Fanar reports. A tool that needs a model your key lacks returns a clear error with the link to request access.

Prompts: islamic_finance_question (answer with sources and checked quotations) and verify_islamic_quotations (check a text before publishing).

Related MCP server: sanad-mcp

Get a key

Request API access at https://api.fanar.qa/request. Fanar deactivates keys after 90 days without use.

Install and configure

Requires Python 3.10 or later.

pip install fanar-mcp          # or run it without installing: uvx fanar-mcp
uvx --from git+https://github.com/Blade-Labs/fanar-mcp fanar-mcp   # straight from GitHub

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "fanar": {
      "command": "uvx",
      "args": ["fanar-mcp"],
      "env": { "FANAR_API_KEY": "your-key" }
    }
  }
}

Claude Code:

claude mcp add fanar -e FANAR_API_KEY=your-key -- uvx fanar-mcp

Cursor and other clients take the same command (uvx fanar-mcp) and the FANAR_API_KEY variable. For a shared server, run fanar-mcp --transport streamable-http --port 8765.

Environment variables: FANAR_API_KEY (required), FANAR_BASE_URL (default https://api.fanar.qa/v1), FANAR_MCP_OUTPUT_DIR (where audio and images are saved; default ~/fanar-mcp-output).

Responsible use

  • Answers from fanar_islamic_qa are cited answers, not fatwas. Show the references, note differences between schools, and refer binding questions to a qualified scholar or Shariah board.

  • A quotation that fanar_validate_quotations leaves untagged was not verified. Treat it as unverified.

  • Your use of the API is governed by Fanar's own terms. Read them before using Fanar in a commercial product.

  • The server never logs or returns your API key.

Development

pip install -e ".[test]"
pytest                        # offline tests, no network or key needed
FANAR_API_KEY=... python scripts/smoke.py   # live check through a real MCP client

License

Apache-2.0. See LICENSE.

Available Tools

12 tools
fanar_chatB

Chat with a Fanar language model. Fanar-C-2-27B is the Fanar 2.0 27B model for Arabic (MSA and Gulf, Levantine and Egyptian dialects) and English; "Fanar" is the default alias. Set thinking=true for step-by-step reasoning. About 50 requests a minute.

Inputs: prompt (required), model, system, thinking, +2 more.

fanar_deep_researchA

Start a Fanar-Sadiq-2 deep research job: a structured report on an Islamic topic, with headings and cited sources. It takes minutes (quick about 3-6, standard about 7-10); poll it with fanar_deep_research_result. Requires Fanar-Sadiq-2 on the key. About 20 jobs a day.

Inputs: topic (required), depth, web_search.

fanar_deep_research_resultB

Fetch the status, progress or finished report of a Fanar-Sadiq-2 deep research job.

Inputs: job_id (required).

fanar_generate_imageA

Generate a culturally aware image with Fanar Oryx and save it; returns the file path and the prompt as Fanar revised it. About 20 requests a day.

Inputs: prompt (required), revise, filename.

fanar_islamic_qaA

Ask Fanar-Sadiq an Islamic question and get an answer grounded in cited sources such as the Qur'an, hadith collections and fatwa collections. Show the references with the answer and present it as a cited answer, never as a fatwa. Fanar-Sadiq-2 adds madhab and source filters when your key is entitled to it. About 50 requests a minute.

Inputs: question (required), model, madhab, max_tokens, +3 more.

fanar_list_modelsA

List the Fanar models this API key may call. Entitlements differ per key: for example Fanar-Sadiq-2, which powers the quotation validator and deep research, must be enabled by Fanar.

Inputs: no named parameters.

fanar_moderateA

Score a prompt and response pair with FanarGuard for safety and cultural awareness, in Arabic or English. Requires Fanar-Guard-2 on the key.

Inputs: prompt (required), response (required).

fanar_poemC

Compose Arabic poetry in the classical tradition with Fanar-Diwan. Requires Fanar-Diwan on the key.

Inputs: prompt (required).

fanar_text_to_speechA

Speak Arabic or English text with a Fanar Aura voice and save it as an audio file; returns the file path. Qur'an recitation by a named reciter needs Fanar-Sadiq-TTS-1. About 20 requests a day.

Inputs: text (required), model, voice, filename, +2 more.

fanar_transcribeA

Transcribe Arabic (including dialects) or English audio from a local file with Fanar Aura. long_form=true uses the long-audio model (about 10 requests a day); otherwise about 20 a day.

Inputs: audio_path (required), output, long_form.

fanar_translateA

Translate between Arabic and English with Fanar's Shaheen models, including classical Arabic such as hadith and fiqh texts. About 20 requests a day; keep each request under about 4,000 words.

Inputs: text (required), langpair (required), model, preprocessing.

fanar_validate_quotationsA

Detect and verify Qur'an and hadith quotations inside any text: an LLM answer, a draft, an article. Verified quotations come back tagged and linked to canonical sources; a quotation left untagged could not be confirmed and must be treated as unverified. Requires Fanar-Sadiq-2 on the key. About 200 requests a minute.

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 12 tools

    Disambiguation4/5

    Each tool targets a distinct modality or task (chat, QA, translation, TTS, STT, image, moderation, poetry), and the deep_research/deep_research_result pair is clearly start-vs-poll. The only mild overlap is fanar_chat vs fanar_islamic_qa, since both answer questions with a language model, though the descriptions do distinguish grounded-citation QA from general chat.

    Naming Consistency4/5

    All tools use a consistent fanar_ snake_case prefix with a predictable verb/noun structure (list_models, validate_quotations, generate_image, deep_research_result). A few names are bare verbs or nouns (chat, translate, transcribe, moderate, poem) rather than verb_noun, but the convention is still readable and uniform.

    Tool Count5/5

    Twelve tools is well-scoped for a multimodal AI API, with one tool per capability and a clean async pair for deep research. No redundant or filler tools appear to pad the count.

    Completeness4/5

    The surface covers the major modalities (chat, QA, quotation validation, research, image, translation, TTS, STT, moderation, poetry) plus model listing and a full start/poll lifecycle for deep research. Minor gaps exist, such as no job cancellation/listing or embedding endpoint, but core workflows are covered.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides 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.
      26
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Serves a scholar-approved Islamic corpus of Qur'an and hadith passages to any MCP client with server-side refusal enforcement. Enables natural-language questioning, retrieval, policy checking, and honest corpus coverage reporting while preventing fabricated answers.
      6
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables bilingual Arabic/English knowledge assistance through MCP, including knowledge base inspection, document retrieval, arithmetic evaluation, and Hijri-Gregorian calendar conversion.
      -
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants and developers to query Quranic verses, Hadith, Tafsir, and classical Islamic heritage texts through a single federated MCP endpoint with unified tools and caching.
      -