# minirag-mcp [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/sfrangulov/minirag-mcp  
**GitHub Stars:** 59  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/minirag-mcp

## Description
Local-first RAG MCP server: hybrid search over a folder of your own documents

## Tools
Capabilities this server exposes over MCP:

- **sync_start** — Reconcile the index with the document roots (or one path inside them).

Returns a jobId immediately; poll sync_status until state is
'succeeded' or 'failed'. New and changed files are ingested,
byte-identical files skipped, vanished files removed from the index. A
file moved to another folder under the same name and with the same bytes
keeps its chunks under the new path instead of being read again.
Only the latest sync job is retained — starting a new one, or a
server restart, discards the previous job's record.

Only one sync runs against an index at a time. If one is already in
progress — in this server or in another process, such as a
`minirag-mcp sync` in a terminal — this call fails immediately with a
message identifying it, and no job is started. Single-file ingests and
queries are never blocked by a running sync.
- **sync_status** — Poll a sync job started by sync_start.

Returns state ('pending' | 'running' | 'succeeded' | 'failed'),
counts (scanned/ingested/skipped/moved/deleted/relabelled/unreadable/
failed), and any per-file errors. Only the latest job is retained — an
old jobId, or any jobId from before a server restart, raises an error.

relabelled counts documents whose labels were rewritten from their
stored text, with nothing re-embedded: classify.toml changed, a move
put a file under other path rules, or the model answered after a model
problem had left a facet unanswered. It stays 0 without a classify.toml.
A labelling problem appears in errors with its message prefixed
"labels:"; it is not a failure.

unreadable counts indexed sources this installation cannot read
because an optional extra is absent (images need [ocr]); each one
appears in errors saying it was kept rather than deleted, but it is
not a failure and does not make the job fail.

A folder the scan could not see into (a missing root, one without read
permission, an empty folder where a root was mounted) also appears in
errors, and nothing indexed under it is deleted. It counts as failed
when it is a root, when indexed files are under it, or when the sync
was started for it or for a path inside it.
- **ingest_file** — Ingest or re-ingest one file, replacing any content already indexed for it.

filePath must be an absolute path inside a configured document root.
Re-ingesting an already-indexed file discards its old chunks and
replaces them with freshly parsed ones.
- **ingest_data** — Ingest text/markdown/html content the client holds, under a source id you choose.

format is one of "text", "markdown", or "html" (default "text").
source is a stable identifier you pick, not a filesystem path —
re-using it replaces the previously ingested content for that id,
so reuse the same source to update an item.
- **ingest_url** — Fetch an http(s) URL, convert it to Markdown, and index it.

Only http and https schemes are accepted, and the host must not be a
private or local address (loopback, link-local, private, reserved) —
set ALLOW_PRIVATE_URLS=1 to lift that. This is the one tool that
reaches the network — every other tool works purely against local
files and the local index. source defaults to the URL itself; pass
one to control the index key or to update a previously ingested URL.
- **query_documents** — Hybrid search: semantic similarity plus a keyword boost for exact terms.

Returns `results` — ranked chunks with text, source, title,
chunkIndex, score and parentId — `sources`, the distinct
sources in rank order each with a hits count and a
`displayPath` to show the user (`source` stays absolute and is
what the other tools take), and `parents`, a map from parentId
to section text. Use `sources` to answer "which documents
cover this topic" without inspecting individual chunks.

`text` is the passage that matched and that `score` describes.
`parentId` names the section it sits in — a transcript time
window, a heading section, a slide, a table. Look it up in
`parents` to read the whole section when the match alone is too
small to act on. A chunk indexed before parent sections existed
has parentId null and no entry; re-sync to fill it in.

topK must be at least 1 and is capped at 100; a larger value is
silently clamped to the cap rather than rejected.

When nothing matches because nothing could — an empty index, or a
scope no indexed document is under — `notice` says which.

Cite what you take, so the user can verify it, in whatever
language you answer: end with a Sources list, one line per
document you actually used, each line just that document's
`displayPath` copied verbatim — no [n] markers, nothing else
on the line. Plain text, never a markdown link or file://.

`labels` ({facet: value or [values]}) and `dateFrom`/`dateTo`
(YYYY-MM-DD, inclusive) narrow the search to labelled documents when
the corpus has a classify.toml; `status` lists its facets and values
under `labels` — map an approximate name to a value from there.
`filterCounts` then says how many documents in scope were left out
only for having no label or no date; each `sources` row carries its
`labels` and `date`.
- **read_chunk_neighbors** — Read the chunks immediately before and after a search result, for context.

Provide exactly one of filePath (absolute path inside a document
root) or source (the id of a data/url item). before/after control
how many chunks to include on each side of chunkIndex (both
default to 1).
- **read_file** — Read a source's entire indexed content as Markdown.

The document is reconstructed from its chunks, not concatenated
from them: the context each chunk repeats so its own vector
carries it — a heading breadcrumb, a time-window label, a table's
header row — is emitted once, where the document had it.

Provide exactly one of filePath (absolute path inside a document
root) or source (the id of a data/url item). The response holds
the full document text, so large documents produce large
responses — prefer read_chunk_neighbors when only the context
around one chunk is needed.
- **list_files** — List files found on disk under the document roots, plus indexed data/url sources.

Each disk file is reported with a state: "ingested" (index matches
disk), "stale" (changed on disk since it was indexed),
"stale_scheme" (unchanged on disk, but indexed under an older
chunking scheme, so its vectors are not comparable with current
ones), "not_ingested" (never indexed), or "unreadable" (indexed and
still on disk, but of a type this installation cannot read because
an optional extra is absent — images need [ocr]). Everything but
"ingested" and "unreadable" needs a sync_start; an "unreadable"
source is kept as indexed and no sync can refresh it here.
"stale_scheme" is the per-source view of what status reports as
staleChunkCount. Data and url sources have no disk state to compare
against, so they are "ingested" or "stale_scheme".

unlistedFolders names each folder the scan could not see into (no read
permission, a missing or unmounted drive), with what to do about it.
Indexed files under one are listed as "unlisted": still indexed and
searchable, not checked against the disk.

`labels`, `dateFrom` and `dateTo` filter as in query_documents;
sort="date" lists newest first, documents without a date last. Rows
carry `labels` and `date` when present.
- **delete_file** — Delete an indexed file, data item, or url item from the index.

Provide exactly one of filePath (absolute path inside a document
root) or source (the id of a data/url item). This only removes the
index entry — a file left in place under a document root is
re-ingested by a later sync_start.
- **status** — Report configuration and index status. Works even when configuration is invalid.

Always includes version. When configuration is valid, also includes
roots, dbPath, model, hybridWeight, and chunkCount/sourceCount (both
present on every call, 0 before anything is indexed) — or, if opening
the index itself fails, indexError instead of the counts. When
configuration is invalid, includes configError instead, and every
other tool raises an error referencing it until the configuration is
fixed.

chunkScheme is the chunking scheme the index is being written with.
staleChunkCount counts chunks still stored under an older scheme —
when it is above zero, schemeWarning explains that those chunks need
a re-sync to be rebuilt.

ocr names the OCR engine this install can use, or is "unavailable"
when the optional extra is missing — scanned PDFs and images cannot
be indexed then, and ocrHint says what to install.

labels, present only when the corpus has a classify.toml: its facets,
value descriptions and document counts, unlabelled and uncertain
counts, and the model state — or the file's error.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "minirag-mcp": {
    "command": "uvx",
    "args": ["minirag-mcp"],
    "env": {
      "BASE_DIR": "",
      "ALLOW_PRIVATE_URLS": ""
    }
  }
}
```

**Requires environment variables:** `BASE_DIR`, `ALLOW_PRIVATE_URLS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What minirag-mcp does

minirag-mcp turns a folder of documents into a searchable local RAG index for MCP clients. It combines vector similarity with keyword ranking, helping exact identifiers and error codes surface alongside semantically related passages. The index can also contain text, Markdown, or HTML supplied directly by a client, as well as content fetched from an HTTP or HTTPS URL.

Supported document ingestion includes common office, web, data, notebook, ebook, PDF, Markdown, and plain-text formats through its document conversion layer. OCR support is optional for scanned PDFs and images. An optional classification setup adds document labels and dates that can be used as search filters.

## How it works

Use `sync_start` to reconcile configured document roots. The operation returns a job ID immediately; `sync_status` reports progress, per-file errors, and counts for ingested, skipped, moved, deleted, relabelled, unreadable, and failed items. Identical files are skipped, removed files are deleted from the index, and moved files can retain their existing chunks when their contents and names match.

`query_documents` searches indexed content and returns ranked chunks, source records, scores, titles, and parent sections. Parent sections provide more context around a matching chunk, while `read_chunk_neighbors` retrieves nearby chunks and `read_file` reconstructs an entire indexed document as Markdown. Search can be narrowed by labels and inclusive date ranges when classification data is available.

The index is local. Model downloads occur when needed, and `ingest_url` is the only MCP tool that fetches network content. URL hosts are restricted away from private and local addresses unless `ALLOW_PRIVATE_URLS=1` is set.

## Setup and configuration

Run the package with `uvx minirag-mcp` and configure an absolute document directory through `BASE_DIR`, for example when adding it to an MCP client. The server uses the same indexes through its MCP interface and command-line operation. A status call reports roots, database path, model, hybrid weight, source and chunk counts, chunking-scheme state, OCR availability, and classification state when configuration is valid.

The Claude Code setup uses `claude mcp add` with `BASE_DIR` and the `uvx` command. A Claude Desktop extension can also be built from a clone and installed as an `.mcpb` package; that extension supports Apple Silicon Macs running macOS 14 or later and 64-bit Intel/AMD Windows.

## Tools and capabilities

- `sync_start` and `sync_status` manage asynchronous index reconciliation.
- `ingest_file`, `ingest_data`, and `ingest_url` add or replace indexed content.
- `query_documents` performs hybrid search with optional label and date filters.
- `read_chunk_neighbors` and `read_file` provide focused or complete document context.
- `list_files` reports disk and indexed sources, including stale, missing, unreadable, and unlisted states.
- `delete_file` removes a file, data item, or URL item from the index.
- `status` reports configuration, index, model, chunking, OCR, and label state.

## Limitations and notes

Only one synchronization job can run against an index at a time, although individual ingestion and queries can continue. Sync job records are limited to the latest job and are discarded on restart. A failed or inaccessible folder is retained rather than treated as an instruction to delete its indexed files.

`read_file` returns the full reconstructed document and can create large responses; neighboring chunks are preferable for focused context. Search results include `displayPath` values intended for citations, and answers should finish with a plain-text Sources list containing the paths actually used.

Scanned PDFs and images require the optional OCR extra. Classification and label-based filtering require the optional classification setup. Changing the embedding model or chunking scheme can leave older chunks marked stale until a new synchronization rebuilds them.

_Full upstream README: https://allmcps.com/mcp/minirag-mcp/readme_

