Skip to content

MCP server for Islamic texts: what it does

A free MCP server at https://qurangallery.com/mcp/shamela over 8,594 classical Arabic books: verbatim passages with edition, volume, page, Maktabah link.

On this page

Ask most AI assistants for a hadith or a fiqh ruling and you get a reference recalled from memory. It often looks right. The book exists, the wording is close, the volume and page are plausible — and there is no way to tell, from the answer alone, whether anyone ever printed that page.

The Quran Gallery MCP server changes what your assistant has to work with. It searches an actual library, the Maktabah al-Shamela catalogue of 8,594 classical Arabic works by 3,188 authors, and hands back, for each hit:

  • the book, and which printing it is (editions paginate differently — the page number is meaningless without it)
  • the author and the year they died
  • the printed volume and page, as that printing paginates it
  • the verbatim Arabic of the passage
  • whether the words were found in the main text or an editor’s footnote
  • the edition, editor and publisher, when the library has them, and a link to the page in the Maktabah reader

Your assistant quotes what came back instead of reconstructing it.

Common tasks

Who this is for

Anyone building or using an AI assistant that needs to talk about classical Islamic texts and be checkable: researchers, students, developers of Islamic apps, and anyone who has been burned by a confident citation that turned out not to exist.

You need nothing to start: add https://qurangallery.com/mcp/shamela to your assistant and ask. Keyless use is limited per IP address; an optional free key raises the limits (Limits and errors). The library covers 8,594 works, 3,188 authors and 41 categories, and every tool is read-only.

What it does not do

This matters more than the feature list, so it is here rather than in a footnote.

It cannot stop your assistant from misattributing a passage. What the server guarantees is that the passage, the book and the page are real — that they were retrieved, not composed. It does not guarantee that the sentence your assistant builds around them is a fair reading of the text. A model can still quote a real page and draw a wrong conclusion from it.

It is not a substitute for a scholar. Retrieval quality is not the same as understanding. A passage found in a Hanafi manual is evidence of what that manual says, not a ruling for your situation.

Searches return excerpts; reading tools return pages. A search result is a page-scoped passage with its citation attached. If you need more, shamela_read (unit: 'page') returns a full page and shamela_read (unit: 'range') returns up to twenty consecutive ones. There is no single call that exports a book, and the rate limit is what stands between reading and scraping — please stay on the reading side of that line.

If you want the reasoning behind the design — why search is scoped, why an exact-phrase miss is reported rather than hidden — the Reading a result page covers the parts that affect how you should read the output.

What you get

15 tools, all read-only, the same for every client. Four are ours: shamela_search_library, which requires a named scope and is the right first call for most questions, and search and fetch, the standard pair ChatGPT deep research expects, a quick generic entry (one argument, unscoped), and shamela_verify_quote, which checks whether an Arabic quotation occurs in the library and where. The other 11 are the library server’s own, exposed under their own names: isnād chains, narrator dossiers, boolean and diacritic-exact search, resolving a printed citation back to a page, per-verse tafsir, and reading a page in full.

The server also offers three ready-made prompts (takhrij_hadith, cite_passage, compare_tafsir) and one resource, qurangallery://grounding-rules. It never grades a hadith and gives no rulings.

The short version: start with shamela_search_library, reach for the raw tools when it cannot do what you need.

Queries must be in Arabic. A query with no Arabic words is rejected outright. If you are working from an English question, translate the search terms first — nothing translates them for you.

PageWhat it covers
Getting startedAdd the server to Claude, ChatGPT, Gemini CLI, Cursor or VS Code; run a first search; add a key for more
Connect your client, step by stepChatGPT and Claude with screenshots; Claude Code, Gemini CLI, Cursor, VS Code, GitHub Copilot
The shamela_search_library toolEvery parameter and every field that comes back
The full tool surfaceAll of them, plus prompts and the resource, grouped by what they are for
Choosing a scopeThe twelve scopes, and why shamela_search_library requires one
Reading a resultFootnote vs main text, exact match vs loose match
Grounding rulesThe citation contract: quote only results, matn vs footnote, no invented data
Hadith takhrijLocate a hadith across collections with its isnād, without grading
Limits and errorsRate limits, error responses, what to retry

Next steps

Questions

What is the Quran Gallery MCP server?

A hosted, read-only MCP server at https://qurangallery.com/mcp/shamela. It searches 8,594 classical Arabic works by 3,188 authors from Maktabah al-Shamela and returns verbatim passages with citations.

Is the MCP server free, and do I need a key?

It is free and needs no account or key. A free key raises the rate limits.

What does a search result contain?

The book and its printing, the author and death year, the printed volume and page, the verbatim Arabic, whether the words are in the main text or a footnote, edition data when the library has it, and a link to the page in the Maktabah reader.

Does it stop an AI from misquoting a passage?

No. It guarantees that the passage, book and page are real, not that the sentence your assistant builds around them is a fair reading.

Can I search in English?

No. A query with no Arabic words is rejected, so translate your search terms into Arabic first.

Does it give rulings or grade hadith?

No. It never grades a hadith and gives no fatwa; a passage found in a manual is evidence of what that manual says, not a ruling for your situation.

How many tools does it have?

15, all read-only and the same for every client.

Edit this page on GitHub