# nkapila6/mcp-local-rag [Health: Active]

**Category:** 🔎 Search & Data Extraction  
**Repository:** https://github.com/nkapila6/mcp-local-rag  
**GitHub Stars:** 151  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/nkapila6-mcp-local-rag

## Description
"primitive" RAG-like web search model context protocol (MCP) server that runs locally. No APIs needed.

## Tools
Capabilities this server exposes over MCP:

- **rag_search_ddgs** — Search the web and return the most relevant pages as text, for when whole pages are
wanted (search returns only the relevant passages). Results are re-ranked locally by
semantic similarity to the query before the top pages are fetched.
- **search** — Search the web and return only the passages that answer the query, not whole
pages: usually about a tenth of the text of rag_search_ddgs. Use this first.

Tiers, cheapest first:
1. Search, then keep the top_pages results whose title/snippet match best.
2. Fetch those pages, split them into ~600-char passages, keyword-match them (BM25)
   against the query plus `keywords`.
3. Only if that leaves too many candidates, or matches nothing (a paraphrase),
   the local embedder ranks them by meaning.
If nothing matched the keywords and the client can show questions, the user is
asked whether they want the full pages instead.
- **read_url** — Read one page whose URL you already have: a link the user pasted, or one from earlier
results. HTML or PDF. With a query, returns only the passages that answer it, the same
way search does; without one, the page's main text (cut to the shared budget).
- **deep_research** — Research a topic across several search terms and engines. Each term is searched on
each backend, results are re-ranked locally by relevance, duplicates are removed,
and the best pages are fetched as text.

Backends: auto, brave, duckduckgo, google, grokipedia, mojeek, startpage, wikipedia, yahoo.
- "auto" (default): ddgs metasearch over several engines, skipping blocked ones. Most reliable.
- "brave": fast and usually available.
- "wikipedia": exact article lookups, best with title-like terms.
- "google", "startpage", "yahoo", "mojeek": often blocked. Empty engines are reported
  as warnings, and if every chosen engine is empty the terms are retried with "auto".

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

```json
"mcpServers": {
  "mcp-local-rag": {
    "command": "uvx",
    "args": ["mcpsurfr"],
    "env": {
      "MCPSURFR_MAX_CHARS": "",
      "MCPSURFR_DEEP_RESEARCH_MODE": "",
      "MCPSURFR_CACHE_TTL": "",
      "MCPSURFR_LEGACY_TOOLS": ""
    }
  }
}
```

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

## Documentation

## What nkapila6/mcp-local-rag does

nkapila6/mcp-local-rag gives MCP clients access to local web search and research workflows. Searches can use DuckDuckGo, Google, Brave, Bing, Wikipedia, Yahoo, Grokipedia, Mojeek, Yandex, or other supported backends depending on the operation. The server does not require search API keys; requests are made through the `ddgs` package and results are processed locally.

Its newer workflow includes `search`, `deep_research`, and `read_url`. The listed legacy tools remain available when enabled: `rag_search_ddgs`, `rag_search_google`, `deep_research_ddgs`, and `deep_research_google`. The repository is also published under the `mcpsurfr` name, while `mcp-local-rag` is the earlier project name.

## How it works

Search results are initially collected from one or more engines, then ranked on the local machine. A small MobileBERT model running with plain NumPy helps compare the query with candidate text, while BM25 uses the query and optional keywords. `deep_research` accepts multiple search terms, combines their results, removes near-duplicates, and can return either full pages or selected passages.

Fetched pages are reduced to their main text. Menus, cookie notices, and footers are removed, while code blocks and tables retain their lines. The server can read text-layer content from the first 50 pages of a PDF and can use an `llms.txt` or markdown representation when a documentation site provides one. Supported sites such as Stack Exchange, Wikipedia, GitHub, Hacker News, PyPI, npm, and crates.io can use their free APIs for more structured results.

## Setup and configuration

The standard installation uses `uvx`:

```json
{
  "mcpServers": {
    "mcpsurfr": {
      "command": "uvx",
      "args": ["mcpsurfr"]
    }
  }
}
```

Use `mcpsurfr@latest` when the client should check for new releases at startup, or install it with `uv tool install mcpsurfr` and invoke `mcpsurfr` directly. Docker images are available for amd64 and arm64 through `ghcr.io/nkapila6/mcpsurfr:latest`.

Optional settings include `MCPSURFR_MAX_CHARS` for the shared full-page text budget, `MCPSURFR_DEEP_RESEARCH_MODE` for the default `pages` or `passages` response, and `MCPSURFR_CACHE_TTL` for the five-minute default cache duration. Set `MCPSURFR_LEGACY_TOOLS=1` to expose the older fixed-backend tool names. For Docker, pass these variables with `-e` before the image name.

## Tools and capabilities

- `search` returns passages selected for the query and can accept keywords, recency, region, domain filters, and a news mode.
- `rag_search_ddgs` returns ranked full-page text using a selected backend.
- `deep_research` merges results from multiple search terms, removes duplicates, and supports passage-only output.
- `read_url` retrieves a known URL and can restrict the response to passages answering a query.
- `deep_research_google` and `deep_research_ddgs` provide fixed Google-only and DuckDuckGo-only workflows when legacy tools are enabled.

Responses can include titles, publication dates, skipped-page reasons, snippets, truncation markers, fallback notices, and backend warnings. Repeated searches and page fetches use a short-lived cache, while news searches are not cached.

## Limitations and notes

JavaScript-only pages are not supported, and scanned PDFs do not receive OCR. Image search is outside the server's scope. Google may block requests, in which case the server can fall back to its automatic backend selection. Full-page output shares a per-call character budget across pages, while passage mode returns a smaller selection of relevant text.

The server includes an MCP skill and a `research` prompt to guide clients in using its search and research operations. LM Studio, Cursor, and VS Code are shown with direct installation links in the project materials.

_Full upstream README: https://allmcps.com/mcp/nkapila6-mcp-local-rag/readme_

