Local RAG

by nkapila6

128 stars
702 downloads
Not rated
GitHub

About

"primitive" RAG-like web search model context protocol (MCP) server that runs locally. ✨ no APIs ✨

Details

Author
nkapila6
GitHub stars
128
Downloads
702
Categories
Search, Knowledge Base, Other

- Multi-engine deep research across 9+ search backends.
- Semantic similarity ranking using embeddings from Google's MediaPipe Text Embedder.
- No API keys required – all processing runs locally.
- Privacy-focused engines (DuckDuckGo, Brave) are supported.
- Customizable result limits and backend selection per query.
- Quick single searches via rag_search_ddgs and rag_search_google.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Local RAG
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install uv or Docker, then add the server configuration to your MCP client settings. For uvx, use the command uvx --python=3.10 --from git+https://github.com/nkapila6/mcp-local-rag mcp-local-rag. For Docker, run docker run --rm -i --init -e DOCKER_CONTAINER=true ghcr.io/nkapila6/mcp-local-rag:v1.0.2. The server exposes tools like deep_research, deep_research_google, deep_research_ddgs, rag_search_ddgs, and rag_search_google.

rag_search_ddgs

Search the web for a given query using DuckDuckGo. Returns context to the LLM with RAG-like similarity scoring to prioritize the most relevant results. This tool fetches web search results, scores them by semantic similarity to the query using text embeddings, and returns the top-ranked content as markdown text. Args: query (str): The search query. Use natural language questions or keywords. Example: "latest developments in quantum computing" num_results (int): Number of initial search results to fetch from DuckDuckGo. More results provide better coverage but increase processing time. Default: 10 top_k (int): Number of top-scored results to include in the final output. These are the most semantically relevant results after scoring. Default: 5 include_urls (bool): Whether to include source URLs in the results. If True, each result includes its URL for citation. Default: True Returns: Dict: A dictionary with a single key "content" containing the search results. The content is formatted as markdown text with the most relevant information from the top_k web pages. If include_urls is True, each section includes its source URL. Example: {"content": "# Result 1\n\nContent here...\n\nSource: https://example.com"}

rag_search_google

Search on Google for a given query using ddgs. Give back context to the LLM with a RAG-like similarity sort. Args: query (str): The query to search for. num_results (int): Number of results to return. top_k (int): Use top "k" results for content. include_urls (bool): Whether to include URLs in the results. If True, the results will be a list of dictionaries with the following keys: - type: "text" - text: The content of the result - url: The URL of the result Returns: Dict of strings containing best search based on input query. Formatted in markdown.

deep_research

Perform deep research across multiple search terms using specified search backends. This tool aggregates results from multiple searches across chosen engines, scores them by relevance, and returns the most relevant content with duplicates removed. Perfect for comprehensive research on a topic. Available backends: bing, brave, duckduckgo, google, grokipedia, mojeek, yandex, yahoo, wikipedia USAGE GUIDANCE FOR LLM: 1. Ask the user which backend(s) they prefer, OR 2. Choose appropriate backend(s) based on context: - ["duckduckgo"] - Privacy-focused, general search - ["google"] - Comprehensive results, best for technical queries - ["duckduckgo", "google"] - Maximum coverage (default) - ["wikipedia"] - Factual/encyclopedia content - ["bing", "google"] - Balanced commercial engines - Multiple backends for broader research coverage 3. For specific use cases, consider: - deep_research_google() - shortcut for Google-only - deep_research_ddgs() - shortcut for DuckDuckGo-only Args: search_terms (List[str]): List of search terms to research. Provide multiple related search queries for comprehensive coverage. Example: ["machine learning fundamentals", "neural networks", "deep learning best practices"] backends (List[str] | None): List of search backends to use. Defaults to ["duckduckgo", "google"]. Can include: bing, brave, duckduckgo, google, grokipedia, mojeek, yandex, yahoo, wikipedia. If None, uses default. num_results_per_term (int): Number of results to fetch per search term per backend. top_k_per_term (int): Number of top scored results to keep per search term per backend. include_urls (bool): Whether to include URLs in the results. Returns: Dict containing aggregated research results from all search terms and specified backends, with duplicates removed.

deep_research_google

Perform deep research across multiple search terms using ONLY Google. Aggregates results from multiple Google searches, scores them by relevance, and returns the most relevant content with duplicates removed. Args: search_terms (List[str]): List of search terms to research. The LLM should provide multiple related search queries for comprehensive coverage. num_results_per_term (int): Number of results to fetch per search term. top_k_per_term (int): Number of top scored results to keep per search term. include_urls (bool): Whether to include URLs in the results. Returns: Dict containing aggregated research results from all search terms (Google only), with duplicates removed.

deep_research_ddgs

Perform deep research across multiple search terms using ONLY DuckDuckGo. Aggregates results from multiple DuckDuckGo searches, scores them by relevance, and returns the most relevant content with duplicates removed. Args: search_terms (List[str]): List of search terms to research. The LLM should provide multiple related search queries for comprehensive coverage. num_results_per_term (int): Number of results to fetch per search term. top_k_per_term (int): Number of top scored results to keep per search term. include_urls (bool): Whether to include URLs in the results. Returns: Dict containing aggregated research results from all search terms (DuckDuckGo only), with duplicates removed.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "local rag": {
            "mcp-local-rag": {
                "command": "uvx",
                "args": [
                    "--python=3.10",
                    "--from",
                    "git+https://github.com/nkapila6/mcp-local-rag",
                    "mcp-local-rag"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-local-rag": {
        "command": "uvx",
        "args": [
            "--python=3.10",
            "--from",
            "git+https://github.com/nkapila6/mcp-local-rag",
            "mcp-local-rag"
        ]
    }
}

mcp-local-rag

"primitive" RAG-like web search model context protocol (MCP) server that runs locally. ✨ no APIs ✨

A RAG-based web search and deep research model context protocol (MCP) server that runs entirely locally. Features multi-engine research across 9+ search backends with semantic similarity ranking, and requires no API keys.

Open in GitHub Codespaces

Add MCP Server mcp-local-rag to LM Studio

Ask DeepWiki

- Features
- Multi-Engine Deep Research
- Installation
- Run Directly via uvx
- Using Docker (recommended)
- Agent Skills
- Security audits
- MCP Clients
- Examples on Claude Desktop
- Result
- Contributing
- License

%%{init: {'theme': 'base'}}%%
flowchart TD
    A[User] -->|1.Submits LLM Query| B[Language Model]
    B -->|2.Sends Query| C[mcp-local-rag Tool]
    
    subgraph mcp-local-rag Processing
    C -->|Search DuckDuckGo| D[Fetch 10 search results]
    D -->|Fetch Embeddings| E[Embeddings from Google's MediaPipe Text Embedder]
    E -->|Compute Similarity| F[Rank Entries Against Query]
    F -->|Select top k results| G[Context Extraction from URL]
    end
    
    G -->|Returns Markdown from HTML content| B
    B -->|3.Generated response with context| H[Final LLM Output]
    H -->|5.Present result to user| A

classDef default stroke:#333,stroke-width:2px;
classDef process stroke:#333,stroke-width:2px;
classDef input stroke:#333,stroke-width:2px;
classDef output stroke:#333,stroke-width:2px;

class A input;
class B,C process;
class G output;

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.