Prototype · Preview: every server in the official registry, synced every 30 minutes. Sign in with Google to write reviews.Prototype · updated every 30 min
PopNx MCPMCP servers for people who use AI · explained in plain words Sign in

rag-mcp

by MasihMoafiversion 0.3.0i★ 9iRuns on your computerRepository ↗
Registry nameio.github.MasihMoafi/rag-mcp

How to install

What it does

Scoped hybrid search (BM25, embeddings, reranking) and grounded answers over local files and folders

  • Connects Runs on your computer
  • Account or key Needs OPENROUTER_API_KEY
  • Category Search & AI memory

Use together with

Skills that teach the AI this kind of work; they work alongside this one

timesfm

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

by google-research★ 35,6381 skills

Skill · How-to guide

Shadowbroker

Open-source intelligence for the global theater. Track everything from the corporate/private jets of the wealthy, and spy satellites, to seismic events in one unified interface. Hook an AI agent up to have it parse through data and find previously unseen correlations. The knowledge is available to…

by BigBodyCobain★ 11,6051 skills

Skill · How-to guide

google-maps-scraper

scrape data from Google Maps. Extracts data such as the name, address, phone number, website URL, rating, reviews number, latitude and longitude, reviews,email and more for each place

by gosom★ 8,2361 skills

Skill · How-to guide

Why it ranks here

Lists are ordered by a usage score (out of 100) built from these parts

Popularity12/80GitHub stars or weekly downloads: the larger counts 60, the smaller 20
Freshness12/12Full marks for a release or code change within 30 days
Still answering0/8The cloud endpoint answered at the last check
Usage score24/100

Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)

Install

Pick the AI app you use, then copy the settings.

Let your AI install it with one sentence

Please install rag-mcp. Follow https://mcp.popnx.com/i/masihmoafi-rag-mcp.md, show me the commands and wait for my OK before running them.

Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads

Passed 3/3 checks · Runs on your computer · ✓ Commands checked Nov 13, 2026

First: which AI do you use?

Pick your app and the steps appear below.

Works with Claude, with some setup first

You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone

Let AI install it

Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server rag-mcp for Claude on this computer, in this order: 1) Check uv with uv --version. If it is missing, tell me to install it from https://docs.astral.sh/uv/getting-started/installation/; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "rag": { "command": "uvx", "args": [ "ragmcp-cli", "mcp" ], "env": { "OPENROUTER_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For OPENROUTER_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the rag-mcp tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install uv (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    uv --version
    • A version number such as uv … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: uv has no click-through installer. Copy the one-line command for your system (macOS or Windows) from uv’s official page into Terminal · no separate Python install needed; uv downloads it when required

    Open the uv download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: uv --version

    Install once; it works for everything that needs uv

  2. Sign up and create a rag-mcp key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the rag-mcp site ↗

  3. Open the Claude desktop app’s settings file

    SettingsDeveloperEdit Config

  4. Paste these settings and save the file

    {
      "mcpServers": {
        "rag": {
          "command": "uvx",
          "args": [
            "ragmcp-cli",
            "mcp"
          ],
          "env": {
            "OPENROUTER_API_KEY": "your-value"
          }
        }
      }
    }

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Quit Claude and open it again

  6. Try it

    Use rag-mcp and tell me what you can do for me, then show me one thing

    ✓ If Claude says it is using rag-mcp or shows a rag-mcp tool in the answer, you are connected

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

ChatGPT cannot connect rag-mcp yet

rag-mcp runs on your computer, but ChatGPT can only connect servers that run on the web

What you can do instead

A · Use an app that can connect rag-mcp

  • You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
  • You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)
  • You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)
  • You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)

B · Others in Search & AI memory that work with ChatGPT

Picked from the most used in the same category, only ones that connect by address with no key

Works with Claude Code, with some setup first

You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)

Let AI install it

Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server rag-mcp for Claude Code on this computer, in this order: 1) Check uv with uv --version. If it is missing, tell me to install it from https://docs.astral.sh/uv/getting-started/installation/; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user rag --env OPENROUTER_API_KEY=your-value -- uvx ragmcp-cli mcp 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For OPENROUTER_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the rag-mcp tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install uv (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    uv --version
    • A version number such as uv … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: uv has no click-through installer. Copy the one-line command for your system (macOS or Windows) from uv’s official page into Terminal · no separate Python install needed; uv downloads it when required

    Open the uv download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: uv --version

    Install once; it works for everything that needs uv

  2. Sign up and create a rag-mcp key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the rag-mcp site ↗

  3. Open Terminal

    Mac: press Command+Space and type Terminal · Windows: open PowerShell

  4. Paste this command and press Enter

    claude mcp add --scope user rag --env OPENROUTER_API_KEY=your-value -- uvx ragmcp-cli mcp

    Replace “your-value” with your key before pressing Enter

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Type /mcp in Claude Code

    You should see rag-mcp listed as connected

  6. Try it

    Use rag-mcp and tell me what you can do for me, then show me one thing

    ✓ If Claude Code says it is using rag-mcp or shows a rag-mcp tool in the answer, you are connected

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with Cursor, with some setup first

You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)

Let AI install it

Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server rag-mcp for Cursor on this computer, in this order: 1) Check uv with uv --version. If it is missing, tell me to install it from https://docs.astral.sh/uv/getting-started/installation/; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "rag": { "command": "uvx", "args": [ "ragmcp-cli", "mcp" ], "env": { "OPENROUTER_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For OPENROUTER_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the rag-mcp tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install uv (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    uv --version
    • A version number such as uv … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: uv has no click-through installer. Copy the one-line command for your system (macOS or Windows) from uv’s official page into Terminal · no separate Python install needed; uv downloads it when required

    Open the uv download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: uv --version

    Install once; it works for everything that needs uv

  2. Sign up and create a rag-mcp key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the rag-mcp site ↗

  3. Click this button to open Cursor

    Open in Cursor

    Cursor asks you to confirm; click Install

  4. Fill in your key

    In the rag-mcp settings, OPENROUTER_API_KEY is empty; add your key and save

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Open the AI chat in Cursor in Agent mode

  6. Try it

    Use rag-mcp and tell me what you can do for me, then show me one thing

    ✓ If Cursor says it is using rag-mcp or shows a rag-mcp tool in the answer, you are connected

Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with VS Code, with some setup first

You need a rag-mcp key (create it on the maker’s site) · Install Python (uv) on your computer first (one time)

Let AI install it

Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server rag-mcp for VS Code on this computer, in this order: 1) Check uv with uv --version. If it is missing, tell me to install it from https://docs.astral.sh/uv/getting-started/installation/; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "rag": { "type": "stdio", "command": "uvx", "args": [ "ragmcp-cli", "mcp" ], "env": { "OPENROUTER_API_KEY": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For OPENROUTER_API_KEY, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the rag-mcp tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install uv (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    uv --version
    • A version number such as uv … = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: uv has no click-through installer. Copy the one-line command for your system (macOS or Windows) from uv’s official page into Terminal · no separate Python install needed; uv downloads it when required

    Open the uv download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: uv --version

    Install once; it works for everything that needs uv

  2. Sign up and create a rag-mcp key

    Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.

    Open the rag-mcp site ↗

  3. Click this button to open VS Code

    Open in VS Code

    VS Code asks you to confirm; click Install

  4. Fill in your key

    In the rag-mcp settings, OPENROUTER_API_KEY is empty; add your key and save

    Paste the key only into the app’s field, never into a chat or to anyone

  5. Open the AI chat in VS Code in Agent mode

  6. Try it

    Use rag-mcp and tell me what you can do for me, then show me one thing

    ✓ If VS Code says it is using rag-mcp or shows a rag-mcp tool in the answer, you are connected

Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.

See every app that uses MCP →

JSON settings are under “For developers” below

Stuck? Ask people who use rag-mcp💬 Discussion →
For developers: Terminal commands and JSON settings

Installed on your computer

Claude Code

claude mcp add --scope user rag --env OPENROUTER_API_KEY=your-value -- uvx ragmcp-cli mcp

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "rag": {
      "command": "uvx",
      "args": [
        "ragmcp-cli",
        "mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "your-value"
      }
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "rag": {
      "command": "uvx",
      "args": [
        "ragmcp-cli",
        "mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "your-value"
      }
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "rag": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "ragmcp-cli",
        "mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "your-value"
      }
    }
  }
}

Values you fill in

  • OPENROUTER_API_KEY secret required env
    OpenRouter key for answer synthesis and hosted reranking; exact-word search works without it

Descriptions are as written by the maker.

These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.

At a glance

Downloads per weeki
116/wk
Connection
Runs on your computer
Latest versioni
0.3.0
Published to registryi
Nov 12, 2026
Code last changedi
Nov 18, 2026
Maker
MasihMoafi
Packages
pypi: ragmcp-cli
Website
github.com
Registry status
Active

Which apps can use it

Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.

Run on your computer in

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

All apps, with pros and cons →

Related guides

What it can do

Runs on your computer; the tool list appears in your AI app after you install it.

Basic checksi

We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 20, 2026

  • ✓ Pass

    Maker matches the repo

    The registry name was verified with the GitHub account MasihMoafi, which owns the repo

  • ✓ Pass

    Still maintained

    Code last changed 2 days ago

  • ✓ Pass

    Has a licence

    Uses MIT

  • – Not applicable

    Endpoint responds

    This one runs on your computer; there is no internet endpoint

  • – Not applicable

    Sign-in with OAuth

    Runs on your computer and uses local settings instead

  • … Not checked yet

    No hidden instructions in tool descriptions

    Runs on your computer; we can only read tool lists from internet endpoints

Published vulnerabilities (OSV.dev)

No entries on OSV.dev for ragmcp-cli@0.3.0

Checks only this package version, not every dependency · checked Nov 15, 2026

What we check → · JSON

Makers: ask for a re-check or report wrong info
For makers: add a badge to your README

If you made this, paste this code into your README. The badge links back to this page.

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/masihmoafi-rag-mcp.svg)](https://mcp.popnx.com/en/servers/masihmoafi-rag-mcp)

Discussion

Ask, share a tip or report that it does not work. Sorted by what people marked helpful.

No posts yet. Be the first to ask or share.

Posts here are written by users, not the PopNx team.

Sign in to post

User reviews

No reviews yet

Sign in to write a review

Compared with others in Search & AI memoryi

  • More stars than 92% of the other 6470 servers in this category
  • Published to the registry more recently than 84% of the other 6470 servers in this category
  • Basic checks equal to or better than 99% of the other 6470 servers in this category

Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.

Common questions

Is rag-mcp safe?

It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.

What keys or codes does it need?

You need to fill in: OPENROUTER_API_KEY

Does it run on my computer or in the cloud?

It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).

Is it still maintained?

The GitHub repo last changed 2 days ago, and the latest version (0.3.0) reached the registry 8 days ago.

Which apps can use it?

Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Python (uv) on your computer.

What can I use instead?

In the same category: OpenSEO, Exa, Microsoft Learn MCP, Docs, COTAL actions (cotal.ai)

Similar alternatives

Same category, other makers, commands already checked. Official ones first, then by stars.

Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi

OpenSEO

Keyword research, site audits, rank tracking and AI visibility for your AI agent.

by every-appWidely used★ 28.3KUpdated 6 days ago

Runs in the cloud✓ everyapp.com

Exa

Official Exa MCP for web search, content fetching, and multi-step research.

by exa-labsWidely used★ 5.2KUpdated today

Runs in the cloud✓ service owner · exa.aiTried by the PopNx team

Microsoft Learn MCP

Official Microsoft Learn MCP Server – real-time, trusted docs & code samples for AI and LLMs.

by MicrosoftDocsWidely used★ 2KUpdated 12 months ago

Runs in the cloud✓ service owner · microsoft.comTried by the PopNx team

Docs

Search and read Empryo's documentation. Read-only, no auth, no local access.

by proxysoulGrowing★ 1.6KUpdated 2 months ago

Runs in the cloud✓ empryo.com
Compared with similar ones
This one
rag-mcp
OpenSEOExaMicrosoft Learn MCPDocsCOTAL actions (cotal.ai)
Runs whereInstalls on your computerRuns in the cloud, nothing to installRuns in the cloud, nothing to installRuns in the cloud, nothing to installRuns in the cloud, nothing to installRuns in the cloud, nothing to install
Needs a keyYesNoNoNoNoNo
Add with + in ClaudeNoYesYesYesNoNo
Basic checks3/35/52/44/44/44/4
LicenseMITMITMITCC-BY-4.0NOASSERTIONApache-2.0
PriceNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registry

README from the maker

Open the README

Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.


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


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.

More commands and client setup

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

Only the beginning is shown; read the rest in the repo