LLM Evaluation Harness MCP Server
Evaluates RAG outputs on faithfulness, answer relevancy, and context precision using an LLM-as-a-Judge backend. Exposes tools for running evaluations, scoring individual samples, and checking thresholds, enabling CI gating and on-demand assessment via MCP.
README
LLM Evaluation Harness with MCP Tool Integration
An automated RAG evaluation harness scoring faithfulness, answer relevancy, and context precision — with a Gemini LLM-as-a-Judge backend (or optional RAGAS/DeepEval), exposed as a Model Context Protocol (MCP) server so any assistant can call it as tools, and wired into GitHub Actions for per-commit eval gating.
Why this exists
RAG pipelines silently regress. This harness turns evaluation into a gate: every commit is scored on the three metrics that matter for retrieval quality, and the build fails if any drops below threshold. The same eval logic is exposed over MCP so an agent can run evals as a tool — the part few portfolios show.
Metrics
| Metric | Question it answers |
|---|---|
| faithfulness | Is the answer supported by the retrieved context? |
| answer_relevancy | Does the answer actually address the question? |
| context_precision | How much of the retrieved context was relevant? |
Two backends: a self-contained Gemini LLM-as-a-Judge (default), or
RAGAS/DeepEval (set USE_RAGAS=true).
Quickstart
1. Install
git clone https://github.com/SaiArja/llm-eval-mcp.git
cd llm-eval-mcp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
2. Configure
cp .env.example .env
# set GEMINI_API_KEY=... (https://aistudio.google.com/app/apikey)
3. Run the eval gate
python -m scripts.run_eval
The bundled data/sample_eval.jsonl contains three rows — one is a deliberately
off-topic answer, so the aggregate drops the faithfulness/relevancy scores and
the gate fails (exit code 1). Remove that row, or raise answer quality, and
the gate passes. That pass/fail flip is exactly what runs in CI.
Get raw JSON:
python -m scripts.run_eval --json
Running as an MCP server
python -m app.mcp_server.server
This starts an MCP server over stdio exposing three tools:
| Tool | Description |
|---|---|
run_eval(dataset_path) |
Full eval report + pass/fail gate |
score_sample(question, answer, contexts, ground_truth) |
Score one output |
get_thresholds() |
Current CI gate thresholds |
Register it with any MCP client (e.g. Claude Desktop) by pointing the client at
python -m app.mcp_server.server. An assistant can then evaluate RAG outputs on
demand as a tool call.
CI gating (GitHub Actions)
.github/workflows/eval.yml runs unit tests and the eval gate on every push and
PR. Add your key as a repo secret named GEMINI_API_KEY
(Settings → Secrets and variables → Actions). A metric below threshold fails the
build — turning "did this change hurt retrieval quality?" into a red/green check.
Dataset format
JSONL, one object per line:
{"question": "...", "answer": "...", "contexts": ["...", "..."], "ground_truth": "..."}
Project layout
app/
eval/config.py thresholds + backend selection
eval/judge.py Gemini LLM-as-a-Judge client
eval/metrics.py metric scoring (judge + optional RAGAS)
eval/dataset.py JSONL loader
eval/runner.py load -> score -> aggregate -> gate
mcp_server/server.py MCP tools
scripts/run_eval.py CLI gate (exits non-zero on failure)
data/sample_eval.jsonl
.github/workflows/eval.yml
tests/ smoke tests (no key needed)
Tests
pip install pytest
pytest -q
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。