mcp-retrieval-probe

mcp-retrieval-probe

An evaluation harness that probes MCP-based retrieval servers for calibration, relevance, coverage, citation integrity, and more, also exposing the probes as MCP tools for assistants and CI agents.

Category
访问服务器

README

mcp-retrieval-probe

An evaluation harness for MCP-based retrieval servers.

Retrieval servers that sit behind the Model Context Protocol are increasingly the grounding layer for AI assistants: the assistant asks a question, the server returns documents, and the assistant cites them. That makes one property more important than raw relevance. Does the server know when it does not know?

A retrieval server that returns its best guess with a confident-looking score, even when the corpus has nothing useful, will hand an assistant a citation it should never have made. The model did not hallucinate. The grounding layer manufactured the certainty and passed it up. This tool measures that, along with the corpus and data-integrity properties that tend to drift quietly.

It is target-agnostic. Everything server-specific lives in a recipe file, so the same probes run against any MCP retrieval server.

Install

git clone https://github.com/borisknight/mcp-retrieval-probe
cd mcp-retrieval-probe
pip install -r requirements.txt

Use

Write a recipe (start from examples/example.recipe.json), export your own API token, and run a probe:

export MCP_TOKEN="your-own-token"
python -m mcp_retrieval_probe --recipe examples/example.recipe.json calibration
python -m mcp_retrieval_probe --recipe examples/example.recipe.json all --json

The token is read from the environment variable named in the recipe and is never written to disk or logged. Use your own credentials against servers you are permitted to test.

The probes

Probe Question it answers
calibration Does the confidence signal mean anything, and does the server ever abstain?
anisotropy Do similarity scores have enough dynamic range to threshold on?
relevance Are results on topic, and does a paper retrieve itself by title?
coverage Does the corpus match its claims, and how much of it is embedded?
citations Is citation data present and correct, or is "unknown" reported as zero?
conservation Do two endpoints counting the same thing agree?
discovery Does the OAuth discovery metadata match the documented endpoint?

Each probe prints a one-line verdict and returns a structured result under --json.

Why these, specifically

calibration sends three buckets of queries: topics the corpus covers, real scholarship it almost certainly does not, and pure gibberish. A calibrated server looks visibly less certain on the last two. One that returns an identical confidence label for all three is not giving its callers a signal at all.

anisotropy explains why a confidence label often fails. In an anisotropic embedding space nearly every pair of vectors is highly cosine similar, so scores bunch into a narrow band and no fixed threshold can separate a strong match from a weak one. The fix is usually normalisation before thresholding, not a new label.

citations separates two things servers routinely conflate: a document with zero citations, and a document whose citation data failed to link. Reporting the second as the first makes landmark work look ignored.

discovery needs no credentials. It compares the canonical resource identifier a server advertises against the endpoint it documents, a mismatch that produces confusing auth failures for spec-compliant clients.

Recipes

A recipe has three sections:

  • transportbase_url, protocol_version, and token_env (the name of the environment variable holding the bearer token).
  • tools — maps each logical tool a probe needs to the concrete tool the server exposes. Each entry has a name, an args template using $QUERY, $LIMIT, $ID, $CATEGORY, $START, $END, $SOURCE placeholders, and a fields map of dotted response paths. A placeholder whose value is None is dropped from the call, so optional filters can be omitted. Logical tools the recipe leaves out simply cause the probes that need them to skip.
  • probes — per-probe configuration: query buckets, category anchors, seeds, the OpenAlex concept to audit, and so on.

Ground truth for the citation probe comes from the public OpenAlex API.

Running it as an MCP server

The probes are also exposed as MCP tools, so an assistant can run an evaluation in conversation and a CI agent can call them directly:

pip install 'mcp>=2.0'
{
  "mcpServers": {
    "retrieval-probe": {
      "command": "python",
      "args": ["-m", "mcp_retrieval_probe.server"],
      "env": {
        "MCP_PROBE_RECIPE": "/path/to/recipe.json",
        "MCP_TOKEN": "your-own-token"
      }
    }
  }
}

Each probe becomes a probe_<name> tool, plus probe_all.

Tests

pip install -r requirements-dev.txt
pytest

The default suite is offline. It needs no network and no credentials, and it covers three layers:

  • Transport — the MCP handshake, session id handling, SSE parsing, payload unwrapping, and the 401 and JSON-RPC error paths, against a stubbed HTTP call.
  • Probe logic — each probe is shown to fire on a server with the defect it looks for and stay quiet on one without it. A verdict is only worth reporting if you can demonstrate it discriminates.
  • CLI — the paths a first-time user actually hits: a missing token, a bad recipe path, --json output, and a probe that raises without aborting the run.

Functional checks against a real server are opt-in, so CI stays credential-free:

export MCP_PROBE_RECIPE=/path/to/recipe.json
export MCP_TOKEN=...          # whatever token_env your recipe names
pytest -m live

Those assert reachability and response shape rather than specific findings, since findings depend on the server under test.

License

MIT. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选