# MCP for developers: Hosted MCP server or your own RAG or OpenITI corpus?

Source: https://qurangallery.com/docs/mcp/vs-own-rag-and-openiti

> Qdrant, pgvector or web search instead of a hosted MCP server? What a self-built RAG over classical books must do, what hosted returns, when to build.

There are two reasonable ways to give an AI assistant classical Arabic books: connect to a hosted server, or build your own search over a corpus you hold. This page sets out what each involves so you can choose. Neither is the right answer for everyone.

The Quran Gallery MCP server is **hosted and closed-source**. It searches a fixed library of 8,594 classical Arabic works. It cannot ingest your texts, and it has rate limits (see [Limits and errors](https://qurangallery.com/docs/mcp/limits-and-errors)).

## What you build, and what the server returns

| Task                              | If you build it yourself                                                          | What the hosted server returns                                                                                         |
| --------------------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Get the texts                     | Choose a corpus, check its licence, download it, keep it updated.                 | A fixed library of 8,594 works from the Shamela catalogue, already loaded.                                             |
| Clean the text                    | Remove markup, fix OCR or conversion errors, decide how to treat diacritics.      | Verbatim passages with markup removed. Diacritics do not affect matching ([Arabic search](https://qurangallery.com/docs/mcp/arabic-search-behaviour)). |
| Map to a printed edition          | Work out which printing each text follows and how its pages are numbered.         | Title including the printing, plus volume and page as that printing paginates it, such as `1/ 6`.                      |
| Separate main text from footnotes | Detect editor notes and keep them apart from the author's words.                  | A `matchedIn` field per passage: `body`, `footnote`, `both` or `unknown` ([details](https://qurangallery.com/docs/mcp/search-main-text-or-footnotes)). |
| Cite the source                   | Design a citation format and a link back to the source page.                      | Edition data where the library has it, and a `sourceUrl` to the same page in the Maktabah reader.                      |
| Rank results for a question       | Choose and tune a ranking method; decide which books should come first.           | A required `scope` naming one of twelve shelves, so results come from the books you meant ([Scopes](https://qurangallery.com/docs/mcp/scopes)).        |
| Host and run it                   | Pay for storage, an index, an embedding model if you use one, and keep it online. | Nothing to host. You call one URL.                                                                                     |

Building your own gives you all of this under your control, and costs the time to do each row well. The hosted server gives you the right-hand column in one URL, with the limits it has.

## Vector database or web search instead?

The usual self-built answer is a vector database (Qdrant, PostgreSQL with pgvector, Chroma or Pinecone) filled with chunked, embedded book text and queried through LangChain or LlamaIndex. The other common answer is a web search API such as Tavily, Brave Search or Exa. Both are reasonable. Neither is the same job as the hosted server.

LangChain and LlamaIndex are frameworks that wire a retriever to a model. They do not supply the corpus, the printed page or the edition, and both can instead call the hosted server as a tool ([Python, LangChain and agents](https://qurangallery.com/docs/mcp/use-with-langchain-and-agents)).

### What a self-built vector stack has to do

A vector database stores vectors and returns the nearest ones. Everything that makes a result citable has to be built around it:

- **Get and clean the corpus.** Download a text collection, check its licence, strip markup and conversion errors, and keep it updated. Whether a downloaded text carries the printed volume and page for each passage, and which printing it follows, is for that corpus's own documentation to say (see [OpenITI and KITAB](#openiti-and-kitab) below). Check it text by text before you rely on it for citations.
- **Keep main text apart from footnotes.** If editor notes are chunked and embedded with the author's words, a hit can quote an editor as the author. You have to detect the notes and store the layer with each chunk.
- **Keep edition metadata.** A page number means nothing without the printing. Edition, editor and publisher must travel with every chunk.
- **Normalise Arabic for search.** The hosted server folds diacritics, hamza on alif, ta marbuta and ha, and alif maqsura and ya the same way in the index and in your query, and offers an exact mode when a spelling must match ([Arabic search](https://qurangallery.com/docs/mcp/arabic-search-behaviour)). In your own stack you choose and build that folding, on both sides.
- **Host it and re-index it.** Storage, the database, an embedding model, and a full re-index whenever you change chunking, folding or model.

### What web search gives you

A web search API returns pages from the open web. It does not return the printed book, so there is no volume and page, and no guarantee that the quote exists in the edition you would cite. That makes it useful for background reading and weak for citing a classical text.

### Comparison

| | Hosted MCP server | Vector database RAG | Web search API |
| --- | --- | --- | --- |
| Setup time | Paste one URL; a first cited search in about a minute ([getting started](https://qurangallery.com/docs/mcp/getting-started)) | Build ingestion, chunking, embedding and an index first | Get an API key and write the glue code |
| Printed page citation | Volume and page as the printing paginates it | Only if your source text and chunking keep it | No: it returns web pages |
| Footnotes kept apart | Yes: `matchedIn` per passage | Only if you detect and separate them | No |
| Edition metadata | Where the library has it | Only what your corpus provides | No |
| Cost | Free; keyless 10 calls a minute and 200 a day per IP address, free key 60 a minute ([limits](https://qurangallery.com/docs/mcp/limits-and-errors)) | Hosting, embeddings and re-indexing | The provider's per-search pricing; check theirs |
| Works offline | No | Yes, if the index and model run locally | No |

### When building your own is still right

A vector database is the right tool when the texts are yours (a manuscript collection, a teaching library, notes), when it must run offline, when you want your own ranking or embeddings, or when the books are not among the 8,594 works, including Shia or other catalogues the library does not cover. See [When your own corpus is the right choice](#when-your-own-corpus-is-the-right-choice). Web search is the right tool when you want current background from the open web and do not need to cite a printed page.

## When your own corpus is the right choice

Build your own, or use an open corpus directly, when you need any of these:

- **Private or custom texts.** Your own manuscripts, a teaching collection, or notes. The hosted server cannot add them.
- **Offline use.** The hosted server needs an internet connection.
- **A corpus outside the 8,594 works.** If the books you need are not in the library, check [the scopes page](https://qurangallery.com/docs/mcp/scopes) for what is covered. Twelve scopes cover 26 of the library's 41 categories (7,084 books); the rest are reached through the raw tools described in [the tool surface](https://qurangallery.com/docs/mcp/tools).
- **Full control of ranking.** If you need your own ranking, embeddings or filters, you need your own index.
- **No rate limits.** A large batch job over the whole corpus is better run against data you hold than through a rate-limited service.

You can also use both: a hosted server for citations from published classical works, and your own index for material only you hold.

## OpenITI and KITAB

OpenITI and KITAB are public research projects that publish corpora. They are described here from their own pages, read on 1 November 2026. Neither is a competitor product, and this page does not rank them.

- **OpenITI** (Open Islamicate Texts Initiative) describes itself as "a multi-institutional effort to construct the first machine-actionable scholarly corpus of premodern Islamicate texts". The corpus is published as a release on GitHub, with a suggested citation per version. Sources: [openiti.org](https://openiti.org/), [the OpenITI release README](https://raw.githubusercontent.com/OpenITI/RELEASE/master/README.md), [the OpenITI GitHub](https://github.com/OpenITI/OpenITI).
- **KITAB** (Knowledge, Information Technology, and the Arabic Book) invites readers to "explore the OpenITI corpus and reuse data", and publishes text-reuse data. Source: [kitab-project.org](https://kitab-project.org/).

If you want the raw texts to build on, start from these sources and read their documentation for the format, licence and edition coverage of each text. This page does not state those, because they are theirs to describe.

### Formats and sources people ask about

The server does not index your files. For a text you have scanned or encoded yourself, use `shamela_verify_quote` as the citation check, one passage at a time. Each row below gives one fact from the project's own page, with the date we read it, and what our server does for someone who uses that tool. We do not integrate with any of them.

| Format or project | What its own page says | Source, read 2 December 2026 | What our server does |
| --- | --- | --- | --- |
| OpenITI | "a multi-institutional effort to construct the first machine-actionable scholarly corpus of premodern Islamicate texts", published as versioned releases on GitHub and Zenodo | [openiti.org](https://openiti.org/); [release README](https://raw.githubusercontent.com/OpenITI/RELEASE/master/README.md) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| TEI/XML | "an international and interdisciplinary standard used by libraries, museums, publishers, and academics to represent all kinds of literary and linguistic texts" | [TEI on GitHub](https://github.com/TEIC/TEI) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| Kraken | "a turn-key OCR system optimized for historical and non-Latin script material" | [kraken on GitHub](https://github.com/mittagessen/kraken) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| eScriptorium | "A Digital Text Production Pipeline for Print and Handwritten Texts using machine learning techniques" | [eScriptorium](https://escriptorium.inria.fr/) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| Transkribus | describes itself as "the operating system for written heritage", built and owned by a community of stakeholders | [transkribus.org](https://www.transkribus.org/) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| PyMuPDF | "a layout-aware document engine for AI and a feature-rich Python toolkit for extracting, rendering and editing PDFs and other documents" | [PyMuPDF documentation](https://pymupdf.readthedocs.io/en/latest/) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| CAMeL Tools | "A suite of Arabic natural language processing tools developed by the CAMeL Lab at New York University Abu Dhabi" | [CAMeL Tools on GitHub](https://github.com/CAMeL-Lab/camel_tools) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |
| Hugging Face vectors | "The Hugging Face Hub hosts Git-based repositories, which are version-controlled folders that can contain all your files." | [Hub documentation](https://huggingface.co/docs/hub/index) | Nothing with the file itself; check a passage with `shamela_verify_quote`. |

## Choosing

| If you want…                                                       | Consider                                                        |
| ------------------------------------------------------------------ | --------------------------------------------------------------- |
| Cited passages in your assistant in a minute, from published books | The hosted server: [getting started](https://qurangallery.com/docs/mcp/getting-started)         |
| Your own texts, offline use or your own ranking                    | Your own corpus, possibly built on OpenITI                      |
| Your own code to call the hosted server                            | [Python, LangChain and agents](https://qurangallery.com/docs/mcp/use-with-langchain-and-agents) |
| A comparison with other Islamic MCP servers                        | [Islamic MCP servers compared](https://qurangallery.com/docs/mcp/islamic-mcp-servers-compared)  |

## Next steps

- [Open Quran Gallery MCP](https://qurangallery.com/mcp)
- [Use the Shamela MCP server from Python, LangChain and agents](https://qurangallery.com/docs/mcp/use-with-langchain-and-agents)
- [Choose a Shamela MCP scope: one book or all](https://qurangallery.com/docs/mcp/scopes)
- [Check your own OCR or TEI text against a printed edition](https://qurangallery.com/docs/mcp/check-your-own-ocr-or-tei-text)
- [MCP server for Islamic texts: what it does](https://qurangallery.com/docs/mcp/overview)
