Opengate Mcp

io.github.nickjlamb由 GitHub 帳號 nickjlamb 發布v0.1.4更新於 Oct 25, 2026

Check whether an AI answer is grounded in its context — deterministic, no LLM judge.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理用 OpenGATE 的確定性、以金標準為錨的檢查,判斷 AI 回答是否真正有上下文依據。

可以做什麼
驗證依據:檢查回答是否受所提供的上下文支持,並針對金標準案例偵測編造與應拒答情況,不使用 LLM 評判。評估相關能力:對宣稱抽取、判定準確率、去識別化、簡化與檢索保真度分別對照人工標註的金標準資料評分。執行評測:無需 API 金鑰即可跑離線套件,或透過轉接器對線上系統執行線上評分器。回歸閘門:將每次執行與依轉接器保存的基準比較,出現下降即失敗,並輸出帶時間戳的評分卡或自包含 HTML 報告。
適用情境
適合在建置或維護 RAG 流程、文件問答工具,以及必須依據原始材料為答案提供依據的法律與科研助理時使用,希望在代理流程或 CI 閘門中獲得可重現的依據性評分,而不是由 LLM 打分。
執行需求
透過 npm 套件以本機 stdio 程序執行,需要 Node.js 與 npx。離線套件不需要 API 金鑰;線上評分器需要設定轉接器或 HTTP 端點設定,REST 後端系統可在該設定中插入環境變數。
安裝前請注意
線上評分器會向受測系統送出請求,因此 HTTP 設定中引用的端點資訊與憑證會被伺服器使用。執行會在本機結果目錄寫入結果檔與基準。評分取決於人工標註的金標準集,標註品質決定結果品質。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README


Evidence over plausibility. OpenGATE verifies AI systems that must justify every answer from source material — RAG pipelines, document-QA tools, legal and scientific assistants. It answers one question above all: can the system prove its answer from the evidence it was given?

The check is deterministic — no LLM-as-judge, no grader model, no six-point verdict scale. Required facts must be present, every number must trace back to the source, and when the context can't answer, the system must abstain rather than fabricate. Because it's pure logic, it's reproducible, free, and fast enough to run on every answer or gate on every commit.

As AI moves into high-stakes domains, evaluation is becoming as fundamental as automated testing is in traditional software. OpenGATE turns grounding failures into numbers you can track, and gates every prompt, model, or workflow change against a baseline — so reliability can't quietly regress.

Quick start (60 seconds)

No API key needed — the offline suite runs deterministic scorers against the bundled gold set:

bash
npx @pharmatools/opengate           # run the offline evaluation suitenpx @pharmatools/opengate init      # scaffold gold cases + HTTP config + a GitHub Action
OpenGATE — 39 case(s), online=false, adapter=refcheckr
  ✓ citation-detection   PASS      perClaim_exactSetRate      100.0%      perClaim_jaccardMean       100.0%      supportedStyle_accuracy    100.0%  ⊘ grounding            SKIPPED — online scorer (pass --online)

Point opengate.http.json at your endpoint and add --online --ci to gate your own system. Full walkthrough: Getting Started.

One check, many surfaces

The same deterministic grounding logic ships wherever your stack lives:

SurfaceInstallUse it for
CLI + frameworknpx @pharmatools/opengateFull eval suite, adapters, regression gate
GitHub Actionuses: nickjlamb/opengate@v0Drop-in CI gate in any repo
Python packagepip install opengate-groundingcheck_grounding(), pytest gate, DeepEval metric
MCP servernpx @pharmatools/opengate-mcpAgents that verify their own answers inline
Docker imagedocker run pharmatools/opengateCPU-only, containerised pipelines

Architecture

[OpenGATE architecture: systems under test connect through a one-file adapter to the deterministic core — gold datasets and system answers feed pure-logic scorers, which produce versioned scorecards; a regression gate compares each scorecard to the baseline on every commit — improved or held deploys, regressed fails the build.]

Scorers never talk to a system directly — they reach it through a small adapter, so the methodology travels and only the gold set changes. In the development loop it sits where CI sits: change a prompt, model, or pipeline; the regression gate diffs the new scorecard against the baseline — improved or held deploys, regressed fails the build.

Why not DeepEval?

Use both — evals measure, OpenGATE verifies. General-purpose frameworks like DeepEval and OpenAI Evals evaluate AI systems broadly, usually with an LLM judging the output. OpenGATE verifies the narrower, harder promise: that every answer is grounded in evidence:

  • Provenance is first-class — does the cited passage actually exist, verbatim, in the source?
  • No LLM judge — scores are deterministic checks against hand-labelled gold, so they're reproducible and free to run in CI; your judgment lives in the gold set, not a grader model's.
  • Regression detection is first-class — every run is diffed against a per-adapter baseline; a drop fails the build.

Pair a general framework for broad quality metrics with OpenGATE to gate the grounding.

Core concepts

Gold cases — hand-labelled benchmark cases (datasets/cases/): source text, the claims that should be extracted, the sentences that should not be, and reference snippets with known-correct verdicts. Copy _template.json to add one; format in datasets/SCHEMA.md, labelling rules in datasets/LABELING-GUIDE.md.

Scorers — one module per metric family (src/scorers/):

ScorerModeMeasures
citation-detectionofflineper-claim citation set exact-match & Jaccard; supported-style accuracy
claim-extractiononlineprecision / recall / F1 vs gold; non-claim leakage; fidelity (claim is verbatim from source)
verdict-accuracyonlineexact & adjacency accuracy on a six-point scale; passage hallucination rate; consistency; latency & token cost
redactiononlinerecall on gold identifiers with leaks as named failures; over-redaction; known-gap tracking
simplificationonlinefaithfulness of rewrites: anchor recall (critical facts survive), fabricated numbers, length gates
retrievalonlinefidelity of retrieved records vs the authority: anchor fields + structural invariants
groundingonlinegeneric RAG: answer-anchor recall, fabrication vs context, and abstention. The turnkey path

Offline scorers run with no API key — fast enough for every commit. Online scorers exercise a live system through an adapter.

Scorecards — every run writes results/<timestamp>.json stamped with the git SHA, so any result is reproducible and auditable. Per-model runs carry a run_model label, turning the results directory into a measured comparison (accuracy × hallucination × latency × cost).

Regression gate — --baseline saves a reference; later runs print per-metric deltas (▲/▼ in percentage points) and --ci fails the build on any drop. Baselines are per-adapter, so one system's scorecard can't clobber another's.

HTML report — add --report (or opengate report) for a self-contained dashboard: pass/fail per scorer, deltas vs baseline, every named failure. One file, no server, no dependencies.

Evaluating your own system

An adapter is one file: two base exports — onlineAvailable(), onlineConfigHint() — plus at least one complete capability (e.g. grounding → answer()). Scorers check adapter.capabilities and skip cleanly across the boundary; adapters are validated at load with messages naming every missing export.

bash
OPENGATE_ADAPTER=./adapters/my-system.mjs npm run eval:online

For REST-backed systems there's a no-code path: the bundled generic HTTP adapter reads endpoint paths and headers from opengate.http.json (${ENV} interpolation, built-in latency/token capture). Full contract and a minimal skeleton: ADAPTERS.md.

Examples

  • Evaluating a NIM-powered RAG agent — builds a RAG agent on an NVIDIA NIM model and gates its answers' grounding with OpenGATE, deterministically and with no LLM judge. Includes a runnable Python notebook (opengate-grounding) and a Node adapter for the CI gate.

Proven in production

Four PharmaTools products run on OpenGATE in CI — four different capability shapes, one evaluation standard. Run against RefCheckr's gold set, OpenGATE:

  • surfaced a silent parse-failure mode affecting ~50% of multi-claim verdicts, eliminated with enforced structured output (→ 0);
  • halved passage hallucination (5.8% → 2.4%) by driving a measured production model change — a decision made on numbers, not reputation;
  • holds claim extraction at 0.91 F1 with 0.93 recall on the committed baseline (run-to-run spread 0.86–0.94 — the splitter is an LLM), and is currently failing its own gate: 2 known non-claims leak into extraction on most runs, an open splitter issue the gate reports rather than rounds away.
Redacta — redaction capability (proof the methodology isn't QA-shaped)

Redacta wraps the @pharmatools/redacta engine, scored against synthetic UK clinical notes with gold-labelled identifiers. On its first run the eval found two real engine bugs (relation phrases swallowing nested names; apostrophe surnames dropped) — both fixed and confirmed (knownGap_closed: 2), then promoted to gold. Current scorecard: 100% recall on 25 gold identifiers, 0 leaks, no open gaps.

bash
npm install --no-save @pharmatools/redactanode src/runner.mjs --online --adapter ./src/adapters/redacta.mjs
Patiently AI — simplify capability (faithfulness of paraphrase)

Patiently AI exercises faithfulness scoring for text that is paraphrase by design. The eval caught the simplifier dropping safety-critical specifics — an antibiotic dose vanished from a discharge summary (anchor recall 86%). A preservation rule took the next run to 100% anchor recall, 0 dropped facts, 0 fabricated numbers — a per-run measurement, not a guarantee: one frozen exp-2 capture made six days after the fix still contains a correct-but-unsourced reference range, flagged by design (RESULTS.md §6). That tail is why the eval now gates Patiently's backend in CI and re-scores the live service weekly, with fabrications failing on first occurrence.

bash
node src/runner.mjs --online --adapter ./src/adapters/patiently.mjs
PubCrawl — retrieval capability (the layer everything else grounds on)

PubCrawl has no model — it exercises retrieval fidelity against hand-verified anchors and structural invariants, catching parser regressions (collapsed author arrays, [object Object] leakage) that would poison every downstream citation. That OpenGATE scores a non-AI system at all is the point: evidence-grounded AI is only as trustworthy as the retrieval beneath it.

bash
node src/runner.mjs --online --adapter ./src/adapters/pubcrawl.mjs

Full methodology and model comparison: how RefCheckr is evaluated.

Project layout

opengate/├── src/│   ├── lib/          metrics + shared grounding core (single source of truth)│   ├── scorers/      one file per metric family (7 scorers)│   ├── adapters/     system-under-test boundary (refcheckr.mjs is the reference)│   └── runner.mjs    CLI: discover cases → score → report → snapshot → gate├── datasets/         gold-labelled cases (39) + fixtures + schema├── examples/         worked examples (NVIDIA NIM RAG)├── mcp/              MCP server (@pharmatools/opengate-mcp)├── python/           opengate-grounding (PyPI) + DeepEval metric├── Dockerfile        CPU-only image (pharmatools/opengate)└── action.yml        GitHub Action

Documentation

DocWhat's in it
Getting StartedZero to a CI gate for a generic RAG system
ADAPTERS.mdThe adapter contract + a minimal skeleton
datasets/SCHEMA.mdGold-case format
RoadmapWhat's next, and the road to 1.0
ContributingDev setup, adding cases/adapters/scorers, PR flow
ChangelogRelease history

Contributing

Contributions are welcome — especially gold cases (new domains, citation styles), adapters (connect your system), and scorers (new metric families). See CONTRIBUTING.md — including its support & governance expectations and AI-assisted development disclosure; open an issue to discuss large changes. Interfaces may still shift pre-1.0, and semver will signal breaking changes.

Citing OpenGATE

If you use OpenGATE in research, please cite it — citation metadata is in CITATION.cff (GitHub's "Cite this repository" button uses it).

License

MIT — because evaluation frameworks shouldn't be black boxes. If an evaluation influences deployment decisions, engineers should be able to inspect every scorer, metric, and benchmark.

來源:README.md,提交 1e38453

工具

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

版本歷史

1
  1. v0.1.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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