Retrieval Lens logo

Retrieval Lens

by Vbj1808

Logs, replays, compares, and aggregates RAG retrieval runs through MCP with local SQLite storage.

Install Retrieval Lens

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "vbj1808-retrieval-lens": {
      "command": "npx",
      "args": [
        "-y",
        "retrieval-lens"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio vbj1808-retrieval-lens -- npx -y retrieval-lens

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y retrieval-lens

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

Vbj1808/retrieval-lens MCP server records the chunks, scores, sources, and rankings produced during RAG retrieval. It stores runs in local SQLite, then exposes MCP tools for replaying prior context, comparing runs, and analyzing retrieval statistics. Use it when an agent gives an incorrect answer and you need to separate retrieval problems from generation problems. The server runs through npx and can be added to Claude Code or another MCP client.

Use cases

  • Audit the chunks returned before an incorrect RAG answer
  • Replay the retrieval context used for a previous response
  • Compare retrieval results before and after an embedding refresh
  • Track score distributions and frequently retrieved sources
  • Instrument LangChain or LlamaIndex retrieval examples

Key features

  • Records queries, chunks, scores, sources, and rankings
  • Replays prior retrieval context
  • Diffs two retrieval runs
  • Aggregates retrieval statistics
  • Stores data in local SQLite
  • Provides LangChain and LlamaIndex adapter examples

Tools4

What Retrieval Lens lets your agent do. Expand a tool for its parameters.

Self-reported~73 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/14 checks healthy over the last 117d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 14d ago via OSV.dev · retrieval-lens (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars2Stargazers on the source repository.
npm downloads31Package downloads in the last 30 days.
Last commit6mo agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed4Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Retrieval Lens works

What Vbj1808/retrieval-lens MCP server does

Vbj1808/retrieval-lens MCP server records the inputs and results of retrieval steps inside a RAG pipeline. Each observed run can include the user query, retrieved chunk content, relevance scores, source identifiers, and result rankings. The recorded data provides a reference for investigating what an agent actually received before generating an answer.

The server focuses on retrieval rather than full application or model observability. It is suited to debugging cases where the answer is wrong but the cause is unclear: the retriever may have returned irrelevant material, scores may have shifted, or ranking may have changed after a pipeline update.

How it works

A RAG application calls retrieval_observe after a retrieval step and supplies a run ID, query, chunks, scores, sources, and ranks. An optional pipeline tag can identify the application or retrieval pipeline.

After data has been recorded, retrieval_query can replay the material associated with an earlier answer or retrieval event. retrieval_diff compares two runs and reports changes such as different results or score drift. retrieval_stats summarizes retrieval behavior across runs, including score distributions, frequently appearing sources, and activity over time.

The repository also includes adapter examples for LangChain and LlamaIndex.

Setup and configuration

Run Vbj1808/retrieval-lens MCP server directly with npx:

Terminal
npx retrieval-lens

For Claude Code, the documented command is:

Terminal
claude mcp add retrieval-lens npx retrieval-lens

Once configured, the RAG application must call retrieval_observe after each retrieval step. A run should include a unique run_id, the retrieval query, and a chunks list. Each chunk may contain its content, score, source, and rank. The example also uses pipeline_tag to label the pipeline.

Storage is described as local SQLite, and the project states that data does not leave the local machine.

Tools and capabilities

  • retrieval_observe records a retrieval run and its query, chunks, scores, sources, and rankings.
  • retrieval_query replays what the model saw before a particular answer.
  • retrieval_diff compares two retrieval runs to identify changed results and score movement.
  • retrieval_stats aggregates score distributions, top sources, and runs over time.

The project is marked as being in active development. Its completed feature list covers the four tools above, but future behavior may change. The server is designed for retrieval inspection and does not claim to provide general LLM call tracing or a complete observability platform.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Retrieval Lens

Vbj1808/retrieval-lens is an MCP server that connects RAG retrieval pipelines to a local SQLite flight recorder. Its main tools are retrieval_observe for logging runs, retrieval_query for replaying context, retrieval_diff for comparisons, and retrieval_stats for aggregate retrieval analysis.

Run `npx retrieval-lens` to start it, or add it to Claude Code with `claude mcp add retrieval-lens npx retrieval-lens`. After setup, your RAG pipeline must call `retrieval_observe` after each retrieval step.

Yes, it is described as MCP-native and compatible with any MCP client. The README specifically documents Claude Code, while Cursor can use the server if configured with its standard MCP support.

Call `retrieval_diff` with the IDs of the two runs, such as `run_id_a` and `run_id_b`. The tool reports what changed between the runs and which scores moved; the example also uses `match_by: "source"`.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewRetrieval Lens AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/vbj1808-retrieval-lens?style=directory)](https://allmcps.com/mcp/vbj1808-retrieval-lens)
HTML Embed
<a href="https://allmcps.com/mcp/vbj1808-retrieval-lens"><img src="https://allmcps.com/api/badge/vbj1808-retrieval-lens?style=directory" alt="Retrieval Lens on AllMCPs" /></a>