retriEVAL

io.github.hcarrillo001由 GitHub 帳號 hcarrillo001 發布v1.0.0更新於 Oct 24, 2026

LLM evals as MCP tools: score outputs for faithfulness, relevancy, and hallucination.

已驗證STDIO僅桌面資料與分析AI 與機器學習

概覽

AI 產生的概覽

自架式 MCP 伺服器,用評審模型為 LLM 輸出評分,評估忠實度、相關性與幻覺,並保留執行歷史與圖表。

可以做什麼
  • 列出內建與自訂指標,並用自然語言定義評分標準
  • 從檔案、網址、內嵌 JSON、JSONL、CSV 或 TSV 載入黃金集,並查看已載入的集合
  • 對資料集或單一案例執行評估,並翻頁查看得分最低的案例
  • 檢查輸出與某個網頁內容的一致性,並列出已儲存的執行紀錄
  • 以圖表呈現指標趨勢、單次執行,並比較多次執行
  • 查看與重設評審呼叫的花費上限
適用情境
適合想確認 RAG 或對話系統的回答是否真正有來源依據、而不只是切題,又不想另外建置評測框架的情境。也適合在 MCP 用戶端內比較不同模型輸出、追蹤多次執行分數的開發者。
執行需求
以本機 Python 程序(stdio)從程式碼倉庫執行,或使用容器映像;也可部署為帶 Bearer 權杖的 HTTP 端點。需要評審後端:預設使用 ANTHROPIC_API_KEY,或將 RETRIEVAL_JUDGE_BACKEND 設為 openai 或 ollama 以使用本機評審。選用:RETRIEVAL_JUDGE_MODEL、RETRIEVAL_BUDGET_USD,以及用於共用執行歷史的 Supabase 變數。
安裝前請注意
評審呼叫會產生費用,請設定 RETRIEVAL_BUDGET_USD 作為上限,未設定即不設限。ANTHROPIC_API_KEY 密鑰會交給伺服器,使用託管評審時評估資料會傳送給該服務商;可用 ollama 後端保持本機處理。黃金集與自訂指標在重新啟動後遺失。分數僅供參考而非事實標準,實驗性 Jev 後端需要 TYPESAFE_API_KEY。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 retriEVAL,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

retriEVAL

LLM evaluation as an MCP server. Score your AI's outputs for faithfulness, relevancy, and hallucination from inside any MCP client — no pipeline, no test harness. Every result comes back with a link to a dashboard that keeps the history.

Try it live (no signup) · Watch the 2-minute demo · Dashboard


Why

Five customer-support answers, scored on two metrics:

metricscorepassing
answer_relevancy0.985/5
faithfulness0.703/5

Every answer was on-topic and well-written. Two of them contradicted the policy they were supposedly grounded in — one promised free return shipping the policy doesn't offer, another invented a free overnight replacement. Reviewing by eye, you'd sign off on all five.

That gap is the point. Relevancy asks did it answer the question. Faithfulness asks is it actually in the source. You need both, and the second one catches the expensive failures.

Connect

Self-hosted. Clone it, point it at a judge, run it — your data never leaves your machine and there's no service to sign up for.

bash
git clone https://github.com/hcarrillo001/retrieval-mcpcd retrieval-mcppip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...        # or a local judge, belowpython server.py                            # stdio, for Claude Desktop / Cursor

Then just ask:

Score these cases with faithfulness: [{"input": "...", "actual_output": "...", "retrieval_context": ["..."]}]

Pass your cases inline and nothing is stored — one call, no setup step. See Run locally (stdio) for client config, and Deploy as HTTP if you want your own always-on instance with a dashboard.

Want to try it before installing anything? There's a live sandbox at retrieval-mcp.com — no signup, runs on a free judge, nothing saved.

Keeping everything local: set RETRIEVAL_JUDGE_BACKEND=ollama and the judge runs on your machine too, so no data leaves your network at any point. Useful if you're evaluating anything you can't send to a third party.

What you get

  • 9 built-in metrics plus custom metrics you author in plain English
  • Swappable judges — Anthropic, Groq, Gemini, OpenRouter, or a local Ollama model, so nothing has to leave your network
  • Golden sets from files, URLs, inline JSON, JSONL, CSV, or TSV
  • Run history in Supabase with shareable permalinks and run comparison
  • A spend cap, because a judge-based tool can otherwise run up a bill

Honest limitations

  • Judge agreement hasn't been validated against human labels yet, so treat scores as a signal rather than ground truth.
  • Golden sets currently hold their own outputs, so re-running one against new model outputs means loading a second set. Splitting them is the next change.
  • Golden sets and authored metrics live in the server process and are lost on restart. Runs persist; those don't.

Metrics (DeepEval-aligned)

faithfulness · answer_relevancy · contextual_precision · contextual_recall · contextual_relevancy · hallucination · bias · toxicity · summarization — plus authored G-Eval metrics you define in plain language. All are normalized so higher = better (bias/toxicity report the clean fraction), and each reasons before scoring.

Versatile golden sets

load_golden_set accepts a file path (including uploaded files), an http(s) URL, an inline JSON array, or JSONL text, in JSON / JSONL / CSV / TSV. Field names are auto-normalized (question→input, answer→actual_output, ground_truth→expected_output, contexts→context, passages→retrieval_context, …), so most public benchmarks load as-is.

Short replies by default

run_eval scores every case but returns only the 3 lowest-scoring by default (tune with limit), with total_cases/shown and a pointer to show_run_cases(run_id, offset, limit, metric) to page through the rest.

Spend cap (so it can't run up a bill)

Judge spend is metered from real token usage and persisted. Set a hard cap:

bash
export RETRIEVAL_BUDGET_USD=20     # 0/unset = unlimited

Once cumulative spend hits the cap, further Anthropic calls stop and tools return a clear budget_exceeded message. Check/clear with get_budget / reset_budget. (Prices are approximate — override RETRIEVAL_PRICE_IN/OUT $/1M tokens to match current pricing for your model.)

Hybrid setup (local + always-on dashboard)

Run history uses a pluggable store, chosen by env:

  • FileStore (default) — JSONL in ~/.retrieval. Zero setup, local only.
  • SupabaseStore — when SUPABASE_URL + SUPABASE_SERVICE_KEY are set. Run history lives in Postgres, shared by the local CLI, the deployed MCP, and the website dashboard.

Recommended hybrid flow:

  1. Run supabase_schema.sql in Supabase (creates the runs table).
  2. Set SUPABASE_URL + SUPABASE_SERVICE_KEY on the MCP (local and/or Railway) so every run is written centrally. Each run records its generator_model and judge_model for cross-model comparison.
  3. Deploy web/ to Vercel (set the same Supabase env vars) and map it to retrieval-mcp.com. The dashboard reads history via /api/runs (service key stays server-side) and renders trend-by-model, a model leaderboard, and run history. It shows sample data until Supabase is wired.

Local stays your free sandbox (Ollama judge, file history); the website is the always-on window into the shared history.

Run locally (stdio) — Claude Desktop

bash
pip install -r requirements.txtexport ANTHROPIC_API_KEY=sk-ant-...
json
{  "mcpServers": {    "retrieval": {      "command": "python",      "args": ["/ABSOLUTE/PATH/server.py"],      "env": { "ANTHROPIC_API_KEY": "sk-ant-...", "RETRIEVAL_BUDGET_USD": "10" }    }  }}

Then: "Load examples/rag_golden.jsonl as 'space', run faithfulness, label it v1."

Deploy as HTTP (reach it from anywhere)

bash
export RETRIEVAL_TOKEN=$(openssl rand -hex 24)   # required for a public endpointexport ANTHROPIC_API_KEY=sk-ant-...export RETRIEVAL_BUDGET_USD=20python app.py        # serves $PORT (default 8000); MCP at /mcp, health at /healthz

Deploy to Railway (or any host): the included Dockerfile / Procfile work as-is. Set ANTHROPIC_API_KEY, RETRIEVAL_TOKEN, RETRIEVAL_BUDGET_USD in the host env. Clients connect to https://<host>/mcp with header Authorization: Bearer <token> — add it as a custom connector in claude.ai / Claude Desktop, or point Agent Builder / CI at it. State (golden sets, run history, spend) lives server-side, so it persists across machines.

See it on a real RAG pipeline (demo)

demo/rag_demo.py builds a tiny end-to-end RAG over a small labeled dataset (demo/labeled.json + demo/corpus.json): it retrieves with BM25, computes recall@k against the gold passages (deterministic — the retriever's score), generates an answer, then scores faithfulness (the generator's score). One answer is deliberately hallucinated so you watch the two failure modes separate.

bash
python demo/rag_demo.py            # offline, no key neededpython demo/rag_demo.py --real     # real generation + RetriEval judge (needs ANTHROPIC_API_KEY)

It also writes demo/generated_goldenset.jsonl — load that into the MCP (load_golden_set → run_eval) for the judge-scored version. This is the bridge: your pipeline emits predictions, the dataset supplies the labels, and RetriEval scores retriever and generator independently.

Connecting to a RAG pipeline

  • Offline (default): export your pipeline's retrieved context + answer into a golden set and score it — RetriEval never touches your pipeline.
  • Live: add a query_rag(question) tool that calls your RAG endpoint or your vector store (Chroma / Supabase pgvector), captures context + answer, and scores in one shot.

Judge backend

bash
export RETRIEVAL_JUDGE_BACKEND=anthropic          # defaultexport RETRIEVAL_JUDGE_MODEL=claude-sonnet-4-6# or local, free:export RETRIEVAL_JUDGE_BACKEND=ollamaexport RETRIEVAL_JUDGE_MODEL=deepseek-r1:70b

Jev (experimental)

Jev is a decision model: it returns probabilities, not text. With RETRIEVAL_JUDGE_BACKEND=jev, faithfulness becomes a hybrid: an LLM splits the answer into standalone claims, Jev checks every claim against the context in parallel, and the score is supported claims / total claims (the same definition as the LLM rubric). The reason lists the unsupported claims with their probabilities, and details.claims has every claim's p_supported. hallucination uses the same claims with one Jev Choice per claim (supports / contradicts / says nothing): score = 1 - contradicted / total, and claims the context is silent on are reported as "not in context" rather than penalised. answer_relevancy is a Jev Score on a 5-level rubric and needs no LLM call. Each claim also carries the exact passage of the answer it came from (quote), which the sandbox highlights. Every other metric still runs on the LLM set by RETRIEVAL_DECOMPOSER_BACKEND.

bash
export RETRIEVAL_JUDGE_BACKEND=jevexport TYPESAFE_API_KEY=...                       # console.typesafe.ai/keysexport RETRIEVAL_DECOMPOSER_BACKEND=anthropic     # or ollama / openai# optional: JEV_MODEL (jev-latest), JEV_MAX_WORKERS (8), JEV_PRICE_IN (0.042)

Or leave the server default alone and pick Jev per call: run_eval and evaluate_case take judge="jev" (or judge="llm" to force the LLM judge). Once TYPESAFE_API_KEY is set on the server, the sandbox picker also lists "Jev · TypeSafe", with claims split by the Groq preset.

Jev spend counts toward RETRIEVAL_BUDGET_USD. Jev is weak on numbers, dates and adversarial text, and its agreement with human labels has not been measured here yet, so treat Jev scores as experimental.

Reports: why a run passed or failed

Every run_eval result carries aggregate[metric].verdict: a headline ("Fails: faithfulness averaged 0.33, below the 0.70 threshold") and the drivers behind it (the failing cases, or the unsupported claims). It is saved with the run.

  • In Claude, summary_md includes the verdict, and clients that support MCP Apps render a compact card inline: the headline score, the other metrics, and a checklist of what failed and why.
  • The full report is report_url (/report?run=<id> on your dashboard host): score, verdict, every claim, and the answer with its problem passages highlighted. It is the same view the sandbox shows after a run, drawn by one shared renderer (web/report.js, web/report.css).

Tools

ToolPurpose
list_metricsbuilt-in + authored metrics
load_golden_set(name, source, fmt)name a set for reuse (self-host only — shared and lost on restart)
list_golden_setswhat's loaded
author_metric(name, criteria, examples)plain language → a scorer
run_eval(metrics, cases, golden_set, threshold, outputs, label, limit)score a set; pass cases inline (JSON/JSONL/CSV/TSV/path/URL) — nothing stored
show_run_cases(run_id, offset, limit, metric)page the rest
evaluate_case(...)one-off score
ground_against_url(url, output, question)check an output's consistency with a web page (no labels — consistency, not correctness)
list_runs(golden_set, last_n)saved runs
plot_metric_trend / plot_run / compare_runsinline charts
get_budget / reset_budgetspend cap status / reset

License

Apache License 2.0. Built by Hanns Carrillo.

來源:README.md,提交 6c55d67

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分