Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

rag-mcp

Latest version: v0.3.1

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
MCP server Transport: stdio Publisher: MasihMoafi
9 Stars
0 Forks
3 Versions
Jupyter Notebook Repo language

Scan summary

rag-mcp was last scanned on 24 Nov 2026 at version 0.3.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 3 versions; the latest was published on 24 Nov 2026.
  • Findings: No rules fired in version 0.3.1.
  • MCP server: Runs over stdio.

Versions

3 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.3.1 LATEST 24 Nov 2026 No rules fired
0.3.0 12 Nov 2026 No rules fired
0.2.1 11 Nov 2026 No rules fired

No rules fired in 0.3.1

Findings

Findings for v0.3.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.3.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.


name: rag-mcp type: scoped hybrid-RAG CLI and MCP server for agents and document workflows

MCP Local index Hybrid search License

A coding agent should not have to choose between opening files one at a time and dumping an entire repository into context.

Beta · v0.3.1 · Linux (verified; Python 3.13)

Install • Evals • How it works • Deep-Dive Post

Quick start

Install with one line, or with the package manager you already use:

curl -LsSf https://raw.githubusercontent.com/MasihMoafi/rag-mcp/main/install.sh | sh   # adds uv if missing
uv tool install ragmcp-cli        # or: pipx install ragmcp-cli · npm install -g ragmcp-cli

Then give your coding agent the tool, or ask from the terminal:

rag connect claude                # or: codex, copilot, gemini, agy
rag query "What changed?" --path ./docs
rag                               # menu: ask, connect an agent, add meaning search or an answer key

It works with no account and no key: exact-word search (BM25) is on from the start, and without an answer model a question returns the best matching passages, which is what an agent reads anyway. Two optional steps add more, both from the rag menu:

  • Meaning search: rag setup picks an embedding model (Ollama, a local CPU model, OpenRouter, OpenAI, Gemini or any OpenAI-compatible server), so a search also finds passages in other words.
  • Written answers: if you are signed in to Codex (codex login, with a ChatGPT plan), rag writes answers with it at no extra cost; otherwise rag key set saves an OpenRouter key. RAG_MCP_ANSWER_PROVIDER picks auto (Codex first), codex, openrouter or off.

Tested on Linux. Studio is not included in this release.

What leaves your machine: answer synthesis sends the question and selected evidence to Codex (your ChatGPT sign-in) or to OpenRouter (rag key set or OPENROUTER_API_KEY). When an OpenRouter key is available, hosted reranking is enabled by default and sends the query and candidate passages to OpenRouter; use rag config reranker off to disable it. Hosted embedding and optional contextual retrieval also send text to their configured providers. Source files and indexes remain local. FastEmbed may download models unless HF_HUB_OFFLINE=1 or TRANSFORMERS_OFFLINE=1 is set.

rag                           # menu at a terminal; help when piped
rag setup --auto              # take the recommendation without questions
rag doctor
rag query "What changed?" --path /absolute/path/to/document-or-folder --top3
rag workspaces --json          # list local workspaces
rag search "What changed?" --path ./docs   # passages only, never an answer (or --workspace ID)
rag query "What changed?" --workspace personal --top 3
rag connect codex             # or: claude, copilot, gemini or agy (registers the MCP server)

Bare rag opens the menu at a terminal and prints help otherwise. rag setup offers an interactive provider picker. Use explicit command flags for automation. Run the installer again to update. RAGMCP_EXTRAS=office (or full, qdrant, anthropic) before sh adds extras; RAGMCP_REF installs a tag or branch.

From a checkout
git clone https://github.com/MasihMoafi/rag-mcp
cd rag-mcp
python scripts/bootstrap.py       # uv sync --all-extras --group dev, then the test suite
uv run rag doctor

Manual test equivalent:

uv sync --all-extras --group dev
.venv/bin/python -m pytest tests/ -v

Any MCP client can register rag mcp once rag is installed.

Claude Code
claude mcp add rag -s user -- rag mcp
Any MCP client

Clients that accept standard MCP JSON can use:

{
  "mcpServers": {
    "rag": {
      "type": "stdio",
      "command": "rag",
      "args": ["mcp"]
    }
  }
}

From a checkout, use /absolute/path/to/rag-mcp/.venv/bin/python /absolute/path/to/rag-mcp/server.py as the command instead.

Codex
rag connect codex

Expected result: the client discovers query_knowledge_base, and a query returns only a readable answer from the requested document scope.

Demo

A first run of 0.3.1 in a clean home folder, with no account and no key (recorded 12 Nov 2026). Bare rag opens the menu, and a question returns the matching passages with file and lines:

$ rag
rag · search your documents from this terminal or from your coding agent
Exact-word search: on · Meaning search: off · Written answers: off: questions return the matching passages
◆ What would you like to do?
 ❯ Ask about a file or folder
   Connect your coding agent (Claude Code, Codex, ...)
   Add or change the embedding model (meaning search)
   ...

$ rag query "What are the upload limits?" --path ./docs
Best matching passages (no answer model is set up; sign in to Codex with `codex login`, or add an OpenRouter key with `rag key set`, for written answers):

[1] limits.md (L1-L4)
# Limits

Uploads are limited to 10 MiB per file and 50 MiB per request.

Signed in to Codex, the same kind of question gets a written answer:

$ rag query "How long do we keep customer files after an account closes?" --path ./docs
Customer files are kept for 30 days after an account closes, then deleted.

What it is

rag-mcp is an answer-producing hybrid RAG CLI and MCP server. Point it at an explicit supported file or narrow directory, ask a question in plain language, and receive a grounded answer without retrieval internals in the public result.

The source documents and vector index remain local. The configured Qwen embedding, Cohere reranking, and DeepSeek synthesis calls use OpenRouter. The answer tool keeps retrieved chunks and scores out of its response; a shared conversation also returns run and conversation IDs. rag search can return passage text and scores; MCP workspace search returns them when include_content: true is set.

Why it exists

Coding agents commonly retrieve context by either opening files one by one or loading a large portion of the repository. The first can miss relevant files; the second consumes context with material the current task may not need.

rag-mcp moves retrieval and answer synthesis behind one scoped tool call so the agent does not receive the source tree or intermediate chunks in its context.

Core features

  • Scoped retrieval. Search an explicit file, narrow folder, or saved workspace; scope tests cover the boundary.
  • Hybrid search. Combine BM25 and embeddings, fuse ranks, and rerank; the retrieval evaluation records results on 153 questions.
  • Document readers. Read PDF, HTML, notebooks, and optional office formats; see the format allowlist.
  • CLI and MCP. Ask through rag or an MCP client; MCP host tests exercise the server.
  • Shared workspaces. CLI and MCP share sources and revisions; see the workspace store.
  • Answer boundary. The answer-only decoder rejects malformed results and unexpected fields; see its implementation.

How it works

Answer pipeline

The approved hosted profile uses BM25 plus OpenRouter qwen/qwen3-embedding-4b, fuses the best 50 candidates with RRF, asks cohere/rerank-4-fast for the best five, then asks deepseek/deepseek-v4.1-flash for a concise grounded answer. The CLI prints that answer. The MCP answer tool returns the answer without private paths, scores, or internal retrieval data. When requested, the answer can include short quotes and available source references. PDF page references use file positions. Missing printed page numbers remain unavailable. A query must name an explicit supported file, a narrow directory, or a saved workspace. Directory queries accept an optional file-type filter. With no OpenRouter key and no explicit reranker choice, a fresh local profile keeps reranking off so retrieval-only BM25 search works without provider setup. Adding a key enables the hosted reranker default; an explicit reranker choice always takes precedence.

On 22 September 2026, OpenRouter served no endpoint for Qwen3 Reranker 4B or 0.6B. The configured Cohere fallback was verified live at $0.002 per search; the pipeline still fails clearly rather than silently skipping reranking.

The complete hosted profile was exercised live on 2026-09-22 with 60 synthetic Markdown chunks: Qwen embedded the corpus and query, RRF supplied 50 candidates, Cohere returned all 50 scores, five passages reached DeepSeek, and the public result contained only the correct answer. OpenRouter reported a total cost of $0.00214904. This is a wiring check, not a retrieval-quality benchmark.

The public answer pipeline operates across three stages:

  1. Scoped ingestion: The caller supplies one supported file or an explicit narrow directory. An optional extension filter can limit a directory—for example, to .md while excluding HTML. Chunks are indexed for BM25 and Qwen3 Embedding 4B dense retrieval.
  2. Precision funnel: BM25 and dense results are fused with Reciprocal Rank Fusion (RRF, k=60). At most 50 fused candidates reach Cohere Rerank 4 Fast; it keeps five.
  3. Answer boundary: DeepSeek V4.1 Flash answers from those five passages. The answer tool returns readable answer text; shared-conversation responses also carry run and conversation IDs.

The answer-only decoder accepts a nonempty result string, optionally with a string reason, or a nonempty error string. Legacy passage arrays, unexpected metadata fields, malformed JSON, and empty output fail closed instead of being serialized to the caller.

Use rag.core.RAGPipeline and rag.fetch.query_documents for new Python callers. RAGPipelineV2, fetchExternalKnowledge, and the original core chunk/BM25 imports remain compatibility entry points. Parser functions can also be imported directly, for example rag.parsers.pdf.extract_pdf_text; importing one reader does not load unrelated formats. Existing pipeline extraction overrides are retained.

Repository structure:

rag-mcp/
├── server.py       # stdio JSON-RPC MCP host
├── rag/            # chunking, BM25, vector search, reranking
└── utils/proxy.py  # local proxy-environment handling

Approved hosted-profile boundaries:

  • answer tool query_knowledge_base and retrieval-only search_workspace for a saved workspace;
  • embeddings: OpenRouter qwen/qwen3-embedding-4b plus always-on BM25;
  • reranking: OpenRouter cohere/rerank-4-fast, with no silent fallback;
  • synthesis: OpenRouter deepseek/deepseek-v4.1-flash;
  • local embedded/on-disk LanceDB by default, with Qdrant as an optional backend;
  • each call names a supported file or narrow directory with doc_path, or a saved workspace with workspace_id;
  • per-path indexes are persisted under the user data directory (~/.local/share/rag/index, or RAG_MCP_DATA_DIR);
  • common large/build directories such as .git, node_modules, .venv, dist, build, and target are rejected;
  • configurable depth/token limits fail explicitly instead of scanning an unbounded tree.
Configuration

Pipeline settings can be changed without editing source. The table shows source defaults; saved settings and RAG_MCP_* environment variables override them. The approved hosted profile uses Qwen3 Embedding 4B even though a clean installation starts with no embedding model until setup is completed.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • MCP Registry io.github.MasihMoafi/rag-mcp

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229