uae-aml-rag
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
UAE AML/CFT Regulations RAG
A local retrieval tool over UAE anti-money laundering and counter-terrorist financing
(AML/CFT) regulations, exposed as an MCP server. Claude
Desktop uses it to search the actual texts, so Claude can answer compliance questions
with citations to document, article and page, such as [CR134-2025 – Article 16 – p. 22].
Why: compliance answers have to rest on the current texts. The UAE replaced its AML law in 2025 (Federal Decree-Law No. 10 of 2025 repealed Decree-Law No. 20 of 2018), so a model's general knowledge can cite repealed provisions or the wrong article. This tool lets Claude look the rules up instead and show where each point comes from.
Local retrieval. Extraction, embeddings, the vector store and search all run on your machine, on CPU. No API key, no paid services and no network calls at query time.
Citations. Every passage carries its source, article or section, and pages.
Legal-structure chunking. Chunks follow articles, sections and FATF Recommendations, and are sized to the embedding model's token limit.
Measured. A small retrieval eval compares the two supported embedding models.
How it works
flowchart LR
subgraph ING["Ingest: python -m uae_aml_rag.ingest"]
pdfs["PDFs in docs/<br/>listed in sources.yaml"] --> extract["Text extraction<br/>pypdf, pdfplumber fallback"]
extract --> chunk["Chunking by legal structure<br/>Article, Section, Recommendation"]
chunk --> embed["Embeddings on CPU<br/>MiniLM or bge-small"]
end
embed --> db[("ChromaDB in ./db<br/>one collection per model")]
subgraph SRV["Query time: no network"]
server["MCP server<br/>python -m uae_aml_rag.server"]
end
server -->|"embed query, cosine top-k"| db
claude["Claude Desktop"] -->|"MCP over stdio"| serverExtraction.
pypdf reads each page, with pdfplumber as a fallback for pages that come out garbled.
Repeated headers and footers, table-of-contents lines and stray glyphs are removed, and hyphenated line breaks are joined.
Chunking.
Headings split the text into units:
Article (16)andDivision Five;numbered sections such as
6.4.1;chapters in capitals such as
7 CUSTOMER DUE DILIGENCE;Annex 2. Red Flag Indicators;FATF's
10. Customer due diligence.
Chapters in capitals, annexes and FATF's numbered headings count only while their numbers run 1, 2, 3, …, which skips leftover table-of-contents lines and repeated lists.
Long units are split at sentence boundaries, with abbreviations and numbered lists handled, into chunks measured with the model's own tokenizer:
MiniLM: ~220 tokens, ~40 overlap.
bge-small: ~450 tokens, ~60 overlap.
Each chunk is embedded with a short context header naming the document and the article.
Storage.
ChromaDB with cosine distance, one collection per embedding model.
The collection records which model built it, and searching with another model is refused.
Chunk ids are deterministic, so re-running ingest only embeds what changed and deletes stale chunks.
Serving.
Claude Desktop starts the server with stdio transport and calls its three tools.
The model loads lazily from the local cache, with
HF_HUB_OFFLINE=1.Chroma keeps each vector index in memory and does not see writes from another process, so the server reopens the store whenever ingest has left a new stamp in
db/.Nothing but the protocol is ever written to stdout, and logs go to stderr.
Tool | What it does |
| Top-k passages (k is limited to 1–20) with citation headers and similarity scores. The results can be limited to one issuer or one document. |
| One full article or section, rebuilt from its chunks with the overlap removed. Accepts |
| The indexed documents, their versions and official URLs, and the embedding model. |
Built with the official MCP Python SDK, ChromaDB, sentence-transformers, pypdf and pdfplumber. It doesn't use LangChain or LlamaIndex.
Related MCP server: claude-kb
Indexed documents
Download the PDFs from the official sources and save them in docs/ under the file names
below. They are public documents, but this repository does not redistribute them:
docs/*.pdf is git-ignored. docs/sources.yaml maps each file to its
metadata.
File in | Source id | Document | Version |
| DL10-2025 | 2025 | |
| CR134-2025 | 2025 | |
| CBUAE-AMLG | 2023 | |
| CBUAE-TFS | 2021 | |
| CBUAE-STR | 2021 | |
| FATF-REC | June 2026 | |
| DFSA-AML | VER30/04-26 | |
| FSRA-AML | VER11.210526 |
The URLs were checked on 2026-11-09. The FATF site blocks scripted downloads, so use a browser. The two free-zone rulebooks (DFSA, FSRA) are optional, and missing files are reported and skipped.
Only index public regulatory documents: the passages Claude retrieves become part of your conversation with Claude.
Setup (Windows, PowerShell)
You need Python 3.10 or newer. It was tested with Python 3.12 and 3.13 on Windows 11, CPU only. Clone the repository, then:
cd UAE_Regulations_RAG
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"If PowerShell blocks Activate.ps1, skip it and type .\.venv\Scripts\python.exe
wherever these instructions say python.
Put the PDFs in docs/ (see above), then build the index:
python -m uae_aml_rag.ingestThe first run downloads the embedding model from Hugging Face (all-MiniLM-L6-v2, about
90 MB, into ~/.cache/huggingface). After that, ingest, search and the tests all run offline.
Ingest prints a summary table per document and lists any pages without a text layer.
Check it from a terminal before connecting Claude Desktop:
python -m uae_aml_rag.server --selftest "record retention period"
python -m pytestmacOS / Linux:
Create and activate the venv with
python3 -m venv .venvandsource .venv/bin/activate; the other commands are the same.On Linux, PyPI's default torch wheel includes CUDA. For a CPU-only install, first run
pip install torch --index-url https://download.pytorch.org/whl/cpu.Claude Desktop is available for Windows and macOS.
Connect Claude Desktop
Open the config file from Claude Desktop: Settings → Developer → Edit Config.
Platform | Usual location |
Windows |
|
macOS |
|
The Microsoft Store build may keep the file somewhere else; Edit Config always opens the right one.
Print the venv's Python path, already escaped for JSON:
.\.venv\Scripts\python.exe -c "import json, sys; print(json.dumps(sys.executable))"Add the server under mcpServers, keeping any servers already there:
{
"mcpServers": {
"uae-aml-rag": {
"command": "C:\\path\\to\\UAE_Regulations_RAG\\.venv\\Scripts\\python.exe",
"args": ["-m", "uae_aml_rag.server"]
}
}
}macOS: the command is
/path/to/UAE_Regulations_RAG/.venv/bin/python.No
envblock needed. The server switches itself to offline mode and finds./dbfrom its own location, not from the working directory.To use bge-small instead of MiniLM, add
"env": {"UAE_AML_RAG_MODEL": "bge"}and build that index first (see Configuration).
Then restart Claude Desktop properly:
Quit it from the system tray, or with Cmd+Q on macOS. Closing the window isn't enough.
Reopen it. Settings → Developer should show
uae-aml-ragas running, and the connectors menu under the chat box should list its three tools.Ask a question. Approve the tool when asked.
The first search can take up to 20 seconds while the model loads; later ones are fast.
The server uses about 600 MB of RAM once loaded.
You can re-run ingest while Claude Desktop is open. Every ingest leaves a stamp in db/,
and the server reopens the index on its next request. A search made while an ingest is
still running may come back asking Claude to search again.
Troubleshooting. The server's log is mcp-server-uae-aml-rag.log. It sits in
%APPDATA%\Claude\logs\, or %LOCALAPPDATA%\Claude\Logs\ for the Microsoft Store build,
and in ~/Library/Logs/Claude/ on macOS. Near the top it should show
Starting MCP server: db=… model=….
Symptom | Fix |
Server missing or "failed", | The |
Tool says the embedding model is not downloaded | Run |
Tool says the index is empty | Run ingest, with |
Tool says the index was built with another model | Rebuild it with |
JSON parse errors in the logs | Something wrote to stdout. The server never does, so check any wrapper script. |
Example
The question:
What do we have to do before taking on a foreign politically exposed person as a customer?
Claude first calls search_regulations. Each result starts with a citation header:
--- Result 1 ---
[CR134-2025 – Article 16 – p. 22] similarity 0.59
Cabinet Resolution No. (134) of 2025 Regarding the Executive Regulations of Federal Decree by Law No. (10) of 2025 … (UAE Federal, 2025)
Article (16)
1. In addition to applying Customer Due Diligence measures, Financial Institutions, …The next results are FATF Recommendation 12 and the DFSA's guidance on PEPs. Claude then
calls get_article("CR134-2025", "Art. 16") for the full article and answers (abridged):
In addition to normal customer due diligence, the Executive Regulations require four measures for a foreign PEP [CR134-2025 – Article 16 – p. 22]:
risk management systems to determine whether the customer or the beneficial owner is a PEP;
senior management approval before establishing the relationship, or before continuing it with an existing customer;
reasonable measures to identify the source of funds and the source of wealth;
enhanced ongoing monitoring of the relationship.
For domestic PEPs and people with a prominent function in an international organisation, you must take adequate measures to identify them, and measures 2–4 apply when the relationship is high-risk [CR134-2025 – Article 16 – p. 22]. Life insurers must also check whether a beneficiary is a PEP before paying out [CR134-2025 – Article 16 – p. 22]. These rules mirror FATF Recommendation 12 [FATF-REC – Recommendation 12 – p. 17]. In the DIFC, the DFSA's guidance adds that the risk extends to PEPs' family members and close associates [DFSA-AML – Section 7.3 – p. 38].
Adding documents
Save the PDF in
docs/.Add an entry to
docs/sources.yamlwith these fields:source: a short id used in citations;title;issuer: one ofUAE Federal,CBUAE,FATF,DFSA,FSRA;year;url.
Add
numbered_headings: Recommendation(or another label) for documents whose headings are plain numbered lines such as10. Customer due diligence.Run
python -m uae_aml_rag.ingest. Only new or changed chunks are embedded.
Useful flags:
--only DL10-2025ingests one document.--rebuildstarts the collection from scratch.--model bgebuilds the bge-small index.
Ingest warns about PDFs that aren't listed in sources.yaml and about listed files that are missing.
Configuration
Environment variable | Default | Meaning |
|
| Embedding model: |
|
| Chroma directory. A relative path is resolved against the project root. |
Evaluation
scripts/eval.py runs the 10 questions in eval_questions.yaml
through the same retrieval the server uses. The topics are CDD, EDD for PEPs, STRs,
record retention, targeted financial sanctions, DNFBPs, beneficial ownership, wire
transfers, the risk-based approach and tipping off. Each question names the provision
that answers it, chosen by reading the documents. The script prints the top 3 passages per
question and hit@3: how many questions have their expected article among the top 3.
python -m uae_aml_rag.ingest --model bge # build the bge-small index once
python scripts/eval.py --model minilm bge # all documents
python scripts/eval.py --model minilm bge --issuer "UAE Federal"The results below were measured on 2026-11-10 with the eight documents above. The MiniLM index has 1,935 chunks and the bge-small index 942. A number is the rank of the expected article, and "–" means it was not in the top 3.
Question | MiniLM | bge-small |
CDD | 1 | 1 |
EDD / PEPs | 1 | 2 |
STR | – | – |
Record retention | 2 | 2 |
Targeted financial sanctions | – | – |
DNFBPs | – | 1 |
Beneficial ownership | 2 | – |
Wire transfers | – | 2 |
Risk-based approach | – | – |
Tipping off | 3 | – |
hit@3, all documents | 5/10 | 5/10 |
hit@3, federal questions searched in UAE Federal documents only | 8/9 | 9/9 |
How to read this:
The metric is strict. Only one provision counts per question. For example, Decree-Law Article 18 states the same reporting duty as the Executive Regulations' Article 18 but does not count for the STR question.
Most misses still return the right topic. The FATF Recommendations, the DFSA rulebook or CBUAE guidance outrank the UAE article, such as FATF Recommendation 1 for the risk-based approach. Limited to UAE federal documents, almost every expected article reaches the top 3. That is why the tools take
issuerandsourcefilters, and why their descriptions tell Claude to search again with a filter.Wording matters. The sanctions question misses for both models, even though CBUAE-TFS Section 3.7 answers it (freeze the funds within 24 hours). The question's terms, such as "name screening" and "UN Consolidated List", are repeated in the screening sections, which rank higher. Keyword-aware (hybrid) search or a reranker would address this; this project uses plain embedding search.
MiniLM stays the default. On all documents the two models tie, MiniLM is smaller, and a one-question gap on ten questions is noise.
Limitations
Not legal advice. Check every point against the official text before relying on it.
Laws change. The index is a snapshot of the versions in
sources.yaml.The CBUAE guidance (2021, 2023) still refers to the repealed Decree-Law No. 20 of 2018 and Cabinet Decision No. 10 of 2019.
Re-download and re-ingest documents when they are amended.
Translations. The UAE federal texts are English versions; the official text is the Arabic one published in the Official Gazette.
PDF quality.
Text extraction leaves artifacts such as
risk -basedort he.FATF's group titles, such as "D. PREVENTIVE MEASURES", are not detected as headings, so each one ends up at the end of the previous Recommendation.
Repeated labels, such as Recommendations restated in the FATF annex, make
get_articlereturn the first occurrence and say so.
No OCR. Pages without a text layer (scanned documents) are skipped and listed by ingest.
Retrieval can miss. Semantic search ranks similar passages, not legal authority, and a passage that answers in different words can rank below passages that repeat the question's terms (see the evaluation). Asking about UAE federal law specifically helps Claude filter.
Project layout
docs/sources.yaml document list; the PDFs go here but are not committed
src/uae_aml_rag/
config.py paths, model settings, environment variables
pdf_extract.py PDF text extraction and cleanup
chunking.py legal-structure chunking (pure functions)
store.py ChromaDB and embedding helpers
ingest.py ingest CLI
server.py MCP server and --selftest
scripts/eval.py retrieval eval
eval_questions.yaml eval questions with their expected provisions
tests/ pytest suite: chunking, extraction, ingest, tools, stdio session, evalThe tests build a tiny PDF and a temporary index, so they never touch ./db. They run
offline once MiniLM is cached.
License
The code is under the MIT License. The regulatory documents belong to their issuers and are not included in this repository.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and cite UAE law (federal, Dubai, Abu Dhabi, DIFC, ADGM) with verifiable citations.
Grounded MENA legal search, reasoning, citation resolution, and citation-graph traversal.
Search and read the Claude Platform documentation and API reference.
Resolve, search and verify legal citations against the official sources, with provenance.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to search and query personal document collections (PDF, Word, Markdown, text) using semantic search and conversational AI with full context preservation across exchanges.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to search locally indexed exported chat history and project docs, retrieving full messages and conversation IDs via full-text search.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to query a locally imported collection of PDF, TXT, and MD files via SQLite FTS5 full-text search (including Chinese), and to browse notebooks, source files, and individual passages. Every search result carries traceable citations such as filename, page number, line number, or timestamp.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to search and read the user's local document collection (PDF, Word, Excel, Markdown, plain text) during a conversation by subject, by file name/path, or by exact word, and to retrieve file contents page by page. It also supports finding folders relevant to a topic and checking indexing status, with everything running locally on the user's machine.MIT