← Back to blog # How to Use the Apify MCP with a Local Model (Ollama) to Search CENDOJ Rulings
Learn how to search Spanish CENDOJ rulings in natural language with a language model that runs on your own computer: Ollama, AnythingLLM and the Apify MCP, without sending your conversations or documents to Claude or ChatGPT.
Using Claude or ChatGPT to search case law is convenient, but it has a cost that matters in a law firm: everything you type or attach in the chat is sent to the model. If you paste a contract or a claim to ask for related rulings, that text leaves your computer. In this guide you will set up the same thing with a **language model that runs on your own machine**: **Ollama** as the model, **AnythingLLM** as the chat window and the **Apify MCP** to search **CENDOJ**, the Spanish judicial documentation database.
> ⚠️ **It's experimental.** It works, but a small local model uses tools **worse** than Claude or ChatGPT: sometimes it picks the wrong tool, fills in the wrong parameters or makes up part of the answer. **Always verify the rulings** in the original source before using them.
## 🔒 Why a local model?
- **Privacy:** your conversations and the documents you share in the chat stay on your computer. They are not sent to OpenAI or Anthropic.
- **Cost:** no subscription and no Claude or ChatGPT tokens to pay for.
- **Independence:** the model doesn't depend on any company or on an internet connection, only on your machine.
So what leaves your computer? Only the **search terms** the agent sends to Apify and CENDOJ. The results are public court rulings. Just don't put personal or confidential data in the search itself.
## 🧩 What we are building
```
You ──► AnythingLLM (chat and agent) ──► Ollama + gemma4:e4b (local)
│
└──► Apify MCP (cloud) ──► legaltech/cendoj ──► CENDOJ
```
- **Ollama** runs the language model on your machine. We'll use `gemma4:e4b`.
- **AnythingLLM** puts a chat window on top of it, so day to day you use it just like ChatGPT or Claude.
- **The Apify MCP** is the connector that gives access to the [`legaltech/cendoj`](https://apify.com/legaltech/cendoj?fpr=legaltech) actor, which searches rulings, orders and agreements in CENDOJ and lets you filter them by jurisdiction, court, type of decision and dates.
## 💻 What you need
- **RAM:** 16 GB minimum; 32 GB recommended.
- **Processor / GPU:** Apple Silicon (M1 or later) or an NVIDIA GPU with at least 8 GB of VRAM.
- **Free disk space:** about 15 GB. The model alone is about 9.6 GB.
- **System:** macOS 13+, Windows 10/11 or Linux.
- **An Apify account.** If you don't have one yet, [create it here](https://console.apify.com/sign-up?fpr=legaltech).
Without a GPU it works, but very slowly: it can take minutes per answer.
## 1️⃣ Step 1: Install Ollama and the model
This is the only step where you need the **terminal**: a window where you type commands instead of clicking buttons. It can feel daunting if you've never opened it, but you just copy and paste one command.
1. Download and install Ollama from [ollama.com/download](https://ollama.com/download).
2. Open the terminal:
- **Mac:** press `Cmd` + `Space`, type *Terminal* and press `Enter`.
- **Windows:** press the `Windows` key, type *Terminal* (or *PowerShell*) and press `Enter`.
3. Copy this command, paste it into the terminal and press `Enter`. It downloads the model, so it may take a while:
```bash
ollama pull gemma4:e4b
```
🎉 **Congratulations!** You now have a language model running on your own computer.
## 2️⃣ Step 2: Install and configure AnythingLLM
1. Download **AnythingLLM Desktop** from [anythingllm.com/download](https://anythingllm.com/download) and install it.
2. Go to **Settings → AI Providers → LLM** and choose:
- **Provider:** `Ollama`
- **Base URL:** `http://127.0.0.1:11434` (usually detected automatically)
- **Model:** `gemma4:e4b`
3. Create a **workspace** (for example, `legaltech`). In its settings, under **Agent Configuration**, also select Ollama and `gemma4:e4b` as the agent model.
## 3️⃣ Step 3: Copy your Apify token
Go to [Apify Console → Settings → API & Integrations](https://console.apify.com/settings/integrations) and copy your **Personal API token** (it starts with `apify_api_...`).
🔐 **Treat it like a password:** don't share it and, if it leaks, revoke it and create a new one from the same screen.
## 4️⃣ Step 4: Connect Apify to AnythingLLM
1. In AnythingLLM, go to **Settings → Agent Skills → MCP Servers** and click the **book icon**. A text file with the configuration opens.
2. Delete whatever it contains and paste this. Replace `YOUR_APIFY_TOKEN` with your token from step 3, keeping the word `Bearer` and a space in front. Save the file.
```json
{
"mcpServers": {
"apify": {
"type": "streamable",
"url": "https://mcp.apify.com/?tools=actors,docs,runs,storage,tasks,legaltech/cendoj,legaltech/hacienda,legaltech/tribunal-constitucional,legaltech/tjue,legaltech/fiscalia,legaltech/catastro,legaltech/ine,legaltech/aepd",
"headers": {
"Authorization": "Bearer YOUR_APIFY_TOKEN"
}
}
}
}
```
3. Go back to **Settings → Agent Skills → MCP Servers** and click **Refresh**. "Apify" should show as **On**, with its list of tools.
## 5️⃣ Step 5: Enable only the tools you will use
The Apify connector comes with about **30 tools**, and each one's description is sent to the model with every message. With all of them enabled, a small model has no room left to think: it hangs or makes up tools.
In **Settings → Agent Skills → MCP Servers → Apify**, leave **only** these three enabled:
- ✅ `legaltech--cendoj`: search rulings and extract their text.
- ✅ `get-actor-run`: check whether a long search has finished.
- ✅ `get-dataset-items`: collect the results of that search.
Disable all the others. If you later want another source (Catastro, Constitutional Court, CJEU, INE…), enable only its `legaltech--…` tool and disable the CENDOJ one: one at a time works best.
## 6️⃣ Step 6: Search for rulings
Open a new chat in your workspace and start your message with `@agent`, which is what turns on tool use. Try one of these examples (CENDOJ is a Spanish database, so the legal terms stay in Spanish):
```
@agent find 5 rulings on cláusula suelo
```
```
@agent find 5 rulings on gastos hipotecarios
```
```
@agent find 5 rulings on IRPH
```
```
@agent find 5 rulings from the social (labour) jurisdiction on despido improcedente
```
When the agent uses the connector you'll see a notice like *"MCP server: apify:legaltech--cendoj completed successfully"*. Click the `>` arrow to see which parameters the model sent to CENDOJ.
## ✅ Best practices
- **Open a new chat every few searches.** Results take up a lot of space and the model gets lost.
- **Ask for few results** (5–10).
- **Always verify.** Look up the ROJ on [poderjudicial.es](https://www.poderjudicial.es/search/) or open the PDF. The model can summarise badly or mix up data.
- **If the model falls short,** try a bigger one with the same setup (for example, `qwen3.6:35b-a3b` if you have 32 GB of RAM or more). It's slower, but more accurate.
## 🧭 Local, or Claude and ChatGPT?
A local model doesn't replace Claude or ChatGPT: it is less accurate with tools and needs a powerful computer. But when confidentiality is what matters, it lets you work with client documents without them leaving the firm, and search case law from the same window.
You'll find this same setup, step by step and with copy buttons, in the [connector installation guide](/en/instalar/?assistant=local). And if you get stuck or have any question, write to us at [legaltechnologybootcamp@gmail.com](mailto:legaltechnologybootcamp@gmail.com).
Published on by Miguel Gonzalez Herrera
Using Claude or ChatGPT to search case law is convenient, but it has a cost that matters in a law firm: everything you type or attach in the chat is sent to the model. If you paste a contract or a claim to ask for related rulings, that text leaves your computer. In this guide you will set up the same thing with a language model that runs on your own machine: Ollama as the model, AnythingLLM as the chat window and the Apify MCP to search CENDOJ, the Spanish judicial documentation database.
⚠️ It’s experimental. It works, but a small local model uses tools worse than Claude or ChatGPT: sometimes it picks the wrong tool, fills in the wrong parameters or makes up part of the answer. Always verify the rulings in the original source before using them.
🔒 Why a local model?
Privacy: your conversations and the documents you share in the chat stay on your computer. They are not sent to OpenAI or Anthropic.
Cost: no subscription and no Claude or ChatGPT tokens to pay for.
Independence: the model doesn’t depend on any company or on an internet connection, only on your machine.
So what leaves your computer? Only the search terms the agent sends to Apify and CENDOJ. The results are public court rulings. Just don’t put personal or confidential data in the search itself.
🧩 What we are building
You ──► AnythingLLM (chat and agent) ──► Ollama + gemma4:e4b (local) │ └──► Apify MCP (cloud) ──► legaltech/cendoj ──► CENDOJ
Ollama runs the language model on your machine. We’ll use gemma4:e4b.
AnythingLLM puts a chat window on top of it, so day to day you use it just like ChatGPT or Claude.
The Apify MCP is the connector that gives access to the legaltech/cendoj actor, which searches rulings, orders and agreements in CENDOJ and lets you filter them by jurisdiction, court, type of decision and dates.
💻 What you need
RAM: 16 GB minimum; 32 GB recommended.
Processor / GPU: Apple Silicon (M1 or later) or an NVIDIA GPU with at least 8 GB of VRAM.
Free disk space: about 15 GB. The model alone is about 9.6 GB.
System: macOS 13+, Windows 10/11 or Linux.
An Apify account. If you don’t have one yet, create it here.
Without a GPU it works, but very slowly: it can take minutes per answer.
1️⃣ Step 1: Install Ollama and the model
This is the only step where you need the terminal: a window where you type commands instead of clicking buttons. It can feel daunting if you’ve never opened it, but you just copy and paste one command.
🔐 Treat it like a password: don’t share it and, if it leaks, revoke it and create a new one from the same screen.
4️⃣ Step 4: Connect Apify to AnythingLLM
In AnythingLLM, go to Settings → Agent Skills → MCP Servers and click the book icon. A text file with the configuration opens.
Delete whatever it contains and paste this. Replace YOUR_APIFY_TOKEN with your token from step 3, keeping the word Bearer and a space in front. Save the file.
Go back to Settings → Agent Skills → MCP Servers and click Refresh. “Apify” should show as On, with its list of tools.
5️⃣ Step 5: Enable only the tools you will use
The Apify connector comes with about 30 tools, and each one’s description is sent to the model with every message. With all of them enabled, a small model has no room left to think: it hangs or makes up tools.
In Settings → Agent Skills → MCP Servers → Apify, leave only these three enabled:
✅ legaltech--cendoj: search rulings and extract their text.
✅ get-actor-run: check whether a long search has finished.
✅ get-dataset-items: collect the results of that search.
Disable all the others. If you later want another source (Catastro, Constitutional Court, CJEU, INE…), enable only its legaltech--… tool and disable the CENDOJ one: one at a time works best.
6️⃣ Step 6: Search for rulings
Open a new chat in your workspace and start your message with @agent, which is what turns on tool use. Try one of these examples (CENDOJ is a Spanish database, so the legal terms stay in Spanish):
@agent find 5 rulings on cláusula suelo
@agent find 5 rulings on gastos hipotecarios
@agent find 5 rulings on IRPH
@agent find 5 rulings from the social (labour) jurisdiction on despido improcedente
When the agent uses the connector you’ll see a notice like “MCP server: apify:legaltech—cendoj completed successfully”. Click the > arrow to see which parameters the model sent to CENDOJ.
✅ Best practices
Open a new chat every few searches. Results take up a lot of space and the model gets lost.
Ask for few results (5–10).
Always verify. Look up the ROJ on poderjudicial.es or open the PDF. The model can summarise badly or mix up data.
If the model falls short, try a bigger one with the same setup (for example, qwen3.6:35b-a3b if you have 32 GB of RAM or more). It’s slower, but more accurate.
🧭 Local, or Claude and ChatGPT?
A local model doesn’t replace Claude or ChatGPT: it is less accurate with tools and needs a powerful computer. But when confidentiality is what matters, it lets you work with client documents without them leaving the firm, and search case law from the same window.
💙 Found this guide useful? You can help me keep creating this kind of content by signing up for Starlink through my link: you get €45 in cash or service credit when you sign up. Fast, reliable internet at home and on the road.
How to search ECHR case law (HUDOC) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/tedh connector to Claude or ChatGPT and search judgments and decisions of the European Court of Human Rights in HUDOC: by respondent State, Convention article and violation found, with official headnote, operative part and passages.
How to Search French Administrative Case Law (Conseil d’État, CAA and TA) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/conseil-etat connector to Claude or ChatGPT and search decisions of the Conseil d’État, the administrative courts of appeal and the administrative tribunals: panel, ECLI, Lebon publication status and relevant passages.
How to Search German Federal Court Case Law (BGH, BVerfG, BAG…) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/rechtsinformationen-bund connector to Claude or ChatGPT and search decisions of the BVerfG, BGH, BVerwG, BFH, BAG, BSG and BPatG: headnote, operative part, cited statutes, lower-court decisions and passages with margin numbers.
How to Search Swiss Federal Supreme Court Case Law (BGer / BGE) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/bger connector to Claude or ChatGPT and search judgments of the Swiss Federal Supreme Court (Bundesgericht / Tribunal fédéral) since 2000 and BGE/ATF leading cases since 1954: official Regeste, considerations, operative part and relevant passages.
How to Search Italian Constitutional Court Case Law with Claude, ChatGPT and the Apify MCP
Connect the legaltech/corte-costituzionale connector to Claude or ChatGPT and search over 20,000 judgments and orders of the Corte costituzionale since 1956: official massime, operative part, reporting judge and constitutional articles invoked.
How to Search Portuguese Case Law (DGSI: STJ, Courts of Appeal and STA) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/dgsi connector to Claude or ChatGPT and search rulings of the Supreme Court of Justice, the Supreme Administrative Court, the courts of appeal and the TCAs in the DGSI databases: headnote, descriptors, reporting judge and outcome.
How to Search Danish Case Law (Domsdatabasen) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/domsdatabasen connector to Claude or ChatGPT and search judgments of Højesteret, the high courts and Danish district courts in Domsdatabasen: ECLI, status (final or appealed), amount claimed and the case's path through the instances.
How to Search Swedish Case Law (Högsta domstolen and Rättspraxis) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/domstol-se connector to Claude or ChatGPT and search precedents of Högsta domstolen, the Supreme Administrative Court, the courts of appeal and Swedish specialist courts: NJA reports, keywords, applied statutes by SFS number and relevant passages.
How to Search Finnish Case Law (Finlex: KKO and KHO) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/finlex connector to Claude or ChatGPT and search precedents of the Finnish Supreme Court (KKO), the Supreme Administrative Court (KHO) and Finnish courts on Finlex: ECLI, official keywords, summary and applied provisions.
How to Search Italian Administrative Case Law (Consiglio di Stato and TAR) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/giustizia-amministrativa connector to Claude or ChatGPT and search judgments of the Consiglio di Stato, the Sicilian CGA and the 29 regional TARs: outcome, chamber, reporting judge, operative part (P.Q.M.) and relevant passages.
How to Search Dutch Case Law (Rechtspraak) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/rechtspraak connector to Claude or ChatGPT and search decisions of the Hoge Raad, the Council of State and Dutch courts from Rechtspraak Open Data: ECLI, summary, links between instances and annotations.
How to Search Austrian Case Law (RIS) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/ris-austria connector to Claude or ChatGPT and search decisions of the OGH, VfGH, VwGH, BVwG and Austrian courts in the RIS: legal principles (Rechtssätze), operative part, cited statutes, ECLI and official PDF.
How to Search Portuguese Constitutional Court Case Law with Claude, ChatGPT and the Apify MCP
Connect the legaltech/tribunal-constitucional-pt connector to Claude or ChatGPT and search rulings (acórdãos) of Portugal's Constitutional Court since 1983 by text, chamber, proceeding type, reporting judge and date, with the operative part and full text.
How to Search UK Case Law (Find Case Law) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/find-case-law-uk connector to Claude or ChatGPT and search judgments of the Supreme Court, Court of Appeal, High Court and UK tribunals on The National Archives’ Find Case Law: neutral citation, judges, parties and PDF.
How to Search Brandenburg and Berlin-Brandenburg Case Law with Claude, ChatGPT and the Apify MCP
Connect the legaltech/gerichtsentscheidungen-brandenburg connector to Claude or ChatGPT and search decisions from 31 Brandenburg courts and the joint Berlin-Brandenburg courts: ECLI, operative part, statutes and procedural history.
How to Search Bavarian Case Law (gesetze-bayern.de) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/gesetze-bayern connector to Claude or ChatGPT and search Bavarian court decisions on the official gesetze-bayern.de portal, including by applied statute (e.g. BGB § 536): headnotes, keywords and operative part.
How to Search Belgian Case Law (Juportal) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/juportal connector to Claude or ChatGPT and search decisions of the Court of Cassation, the Constitutional Court, the Council of State and Belgian courts on Juportal: ECLI, case notes, thesaurus and legal bases.
How to Search North Rhine-Westphalia Case Law (NRWE) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/nrwe connector to Claude or ChatGPT and search decisions from every North Rhine-Westphalia court in the official NRWE database: headnotes, operative part, ECLI and lower-court decision, just by asking in plain language.
How to Search Lower Saxony Case Law (NI-VORIS) with Claude, ChatGPT and the Apify MCP
Connect the legaltech/rechtsprechung-niedersachsen connector to Claude or ChatGPT and search some 32,000 Lower Saxony court decisions in NI-VORIS: ECLI, applied statutes, headnote and operative part, just by asking in plain language.
How to Use the Apify MCP with a Local Model (Ollama) to Search CENDOJ Rulings
Learn how to search Spanish CENDOJ rulings in natural language with a language model that runs on your own computer: Ollama, AnythingLLM and the Apify MCP, without sending your conversations or documents to Claude or ChatGPT.
How to Use the Apify MCP in Claude to Find Which Cadastral Parcel You Are In and Look Up Its Data
Learn how to connect the Apify MCP to Claude and use the legaltech/catastro actor to get a parcel's cadastral reference from your coordinates or an address, and look up its official data without going through the Spanish Cadastre website.
How to Use the Apify MCP in Claude to Cross-Reference Spanish Mortgage and Foreclosure Data from the INE
Learn how to connect the Apify MCP to Claude and use the legaltech/ine actor to cross-reference Spain’s Mortgage Statistics and Mortgage Foreclosure Statistics from the INE, and reach the provincial figure no article publishes.
How to Use the Apify MCP in ChatGPT to Access LegalTech Legal Connectors
Learn how to use LegalTech legal connectors from a free ChatGPT account: enable Developer Mode, add the Apify MCP (@Apify), and query Fiscalía, CENDOJ, Hacienda, Property Registry, and more directly from the chat.
How to Use the Apify MCP in Claude to Query Doctrine from the Spanish State Prosecutor Office
Learn how to connect the Apify MCP to Claude and use the legaltech/fiscalia actor to search Circulares, Instrucciones and Consultas from the Spanish State Prosecutor Office directly from the chat, simply by asking in natural language.
How to Use the Apify MCP in Claude to Query Spanish Tax Authority Administrative Doctrine
Learn how to connect the Apify MCP to Claude and use the legaltech/hacienda actor to query TEAC tax administrative doctrine, DGT binding rulings, and historical resolutions directly from the chat.
We use Google Analytics cookies to analyze traffic and improve your experience. You can accept them, reject them, or read our Privacy & Cookies policy. Privacy & Cookies.