Skip to main content
Glama
TOXTRUST-MCP

TOXTRUST-MCP

Official
by phi-grib

TOXTRUST-MCP

Model Context Protocol server exposing TOXTRUST (Kopańska & Pastor, PharmacoInformatics Lab, Universitat Pompeu Fabra), a Dempster–Shafer theory (DST) tool that turns toxicological evidence pieces (QSAR predictions, structural alerts, in vitro / in vivo results, read-across, expert judgement) into belief masses and combines them for one binary hazard question (for example: "Is the substance mutagenic in the Ames test?").

  • Upstream pinned: TOXTRUST commit 185b6e8 (package toxtrust==0.2).

  • Stateless: no endpoint repository or configuration file is written.

  • Transports: stdio (default) or streamable HTTP.

  • License: GPL-3.0-only (it imports GPL-3.0 TOXTRUST).

Tools

Tool

Purpose

toxtrust_info

Semantics, relevance scale, rules, decision thresholds, deviations from upstream, caveats

toxtrust_assess_evidence

One piece → masses {negative, uncertain, positive}, belief, plausibility, decision

toxtrust_combine_evidence

≥2 independent pieces for one question → rule (auto/Dempster/Yager/Inagaki), conflict K, fused masses, decision, exact-arithmetic shadow values, upstream cross-check, warnings

toxtrust_rule_sensitivity

All rules + Inagaki scale 0–1 + leave-one-out + one piece per independence group → robust flag

toxtrust_compare_substances

One endpoint question, a target and candidate substitutes → per-substance integration and interval comparison of the hazard (positive) class

Every response carries inputs_sha256, a UTC timestamp, the server and upstream versions, and methodological caveats, so results can be archived in an audit trail.

Evidence piece

{"id": "qsar-ames", "source": "in silico", "outcome": "positive",
 "probability_positive": 0.82, "reliability_positive": 0.78, "relevance": "probable",
 "independence_group": "ames-public-training-set", "provenance": {"model": "...", "applicability_domain": "inside"}}

m(pos) = p_pos · rel_pos · relevance, m(neg) = p_neg · rel_neg · relevance, m(Θ) = 1 − m(pos) − m(neg) (2-decimal rounding as upstream). Relevance: certain 1, probable 0.9, plausible 0.75, equivocal 0.5, doubted 0.25, improbable 0.1, impossible 0. Reliabilities and probabilities must be in [0, 1].

Comparison relations (toxtrust_compare_substances)

  • lower_hazard_supported: Pl(pos | candidate) < Bel(pos | target) and the candidate decision is negative

  • lower_hazard_indicated_weak: interval separation, but the candidate evidence is not decisive → a data gap, not an advantage

  • higher_hazard_supported: Bel(pos | candidate) > Pl(pos | target)

  • not_distinguishable, unknown (no evidence ≠ negative)

Related MCP server: PADC Evidence Lab

Engine design

The server computes with engine.py, a port of the upstream evidence.py / combination.py / Endpoint.makeDecision formulas with input validation, and by default re-runs the unmodified upstream package in a forkserver subprocess (hard timeout, stdout captured), reporting upstream_check.agreement. The test suite asserts identical negative/positive masses against upstream on random inputs.

Deliberate deviations from upstream

  1. The upstream renormalisation step can fail to terminate when rounded masses do not sum to 1 ± 0.01; here the rounding residual is assigned to the uncertainty mass in one step.

  2. Inputs are validated strictly: reliabilities/probabilities outside [0, 1] are rejected (no silent percentage handling), and outcome both requires both class probabilities and both reliabilities.

  3. Reliabilities are given per class (reliability_positive, reliability_negative) rather than by list position.

  4. Upstream reports Pl(c) = 0 whenever Bel(c) = 0; the textbook DST plausibility Pl(c) = Bel(c) + m(Θ) is returned alongside as plausibility_dst and is the one to use as the hazard upper bound.

  5. Source labels: the upstream vocabulary (in silico, in vitro, expert, alert, read-across) plus in vivo, human data, regulatory, literature, supplier. Labels do not change the arithmetic; extended labels are mapped to expert for the upstream cross-check.

Methodological caveats

  • DST combination assumes independent sources. Tag pieces of shared origin (same study, a study and the classification based on it, QSAR models trained on overlapping data) with the same independence_group.

  • Weight of evidence (woe=true) replicates a piece weight times and self-combines it, which inflates certainty; prefer reliability/relevance.

  • Results are integrated weight-of-evidence statements for one binary question, not measurements, potencies or classifications. uncertain never means negative.

  • Reliability values (PPV/NPV, sensitivity/specificity, expert confidence) are design choices that drive the result; record their origin in provenance.

Installation

Requires Python ≥ 3.10.

git clone https://github.com/phi-grib/TOXTRUST-MCP.git
cd TOXTRUST-MCP
uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -e ".[test]"   # pulls TOXTRUST at the pinned commit

(python -m venv .venv && .venv/bin/pip install -e ".[test]" works as well.)

Running

.venv/bin/toxtrust-mcp                                         # stdio
.venv/bin/toxtrust-mcp --transport streamable-http --port 8005 # HTTP on 127.0.0.1:8005/mcp

Example MCP client configuration (stdio):

{"mcpServers": {"toxtrust": {"command": "/path/to/TOXTRUST-MCP/.venv/bin/toxtrust-mcp"}}}

Environment: TOXTRUST_UPSTREAM_TIMEOUT (seconds, default 8). Pass upstream_check=false to skip the cross-check. Scripts that import toxtrust_mcp.server and run the cross-check need an if __name__ == "__main__": guard (the runner uses a multiprocessing forkserver).

Tests

.venv/bin/python -m pytest -q                                   # ~80 s (runs upstream subprocesses)
.venv/bin/python tests/smoke_stdio.py "$PWD/.venv/bin/toxtrust-mcp"
.venv/bin/python scripts/worked_example.py worked_example.json  # synthetic substitution example

Acknowledgements

TOXTRUST was developed at the PharmacoInformatics Lab (http://phi.upf.edu) within eTRANSAFE (IMI2 JU Grant Agreement No. 777365) and RISK-HUNT3R (EU H2020 Grant Agreement No. 964537, ASPIS cluster).

License

GNU General Public License v3.0 only — see LICENSE.

Available Tools

5 tools
toxtrust_assess_evidenceB

Convert ONE evidence piece into DST masses, belief, plausibility and a thresholded decision (upstream Evidence class). Optionally cross-checks with the unmodified upstream package.

Inputs: evidence (required), min_belief, upstream_check, max_uncertainty. Returns: object

toxtrust_combine_evidenceB

Combine >=2 independent evidence pieces answering the SAME binary question (one substance, one endpoint). Returns per-piece masses, the combination (rule, conflict K, masses, belief, plausibility, decision), exact-arithmetic shadow values, an upstream cross-check and warnings.

Inputs: evidence (required), woe, rule, question, +4 more. Returns: object

toxtrust_compare_substancesB

Substitution helper for ONE endpoint: integrate evidence per substance (target + candidates) and compare each candidate with the target by belief/plausibility interval separation on the POSITIVE (hazard) class. 'lower_hazard_supported' requires Pl_dst(pos|candidate) < Bel(pos|target) AND a 'negative' candidate decision (separation without a decisive candidate is 'lower_hazard_indicated_weak'); 'higher_hazard_supported' requires Bel(pos|candidate) > Pl_dst(pos|target); otherwise 'not_distinguishable'. Never aggregates across endpoints.

Inputs: endpoint (required), question (required), substances (required), rule, +4 more. Returns: object

toxtrust_infoA

Describe TOXTRUST semantics, input fields, rules, decision thresholds, known upstream defects and caveats. Call this once before building evidence pieces.

Inputs: no named parameters. Returns: object

toxtrust_rule_sensitivityB

Robustness check: re-run the combination under Dempster, Yager, Inagaki (scale 0-1), leave-one-out and one-piece-per-independence-group. A decision is 'robust' only if every variant agrees.

Inputs: evidence (required), min_belief, max_uncertainty. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool occupies a distinct stage of the workflow: orientation (toxtrust_info), single-piece conversion (toxtrust_assess_evidence), multi-piece fusion (toxtrust_combine_evidence), robustness testing (toxtrust_rule_sensitivity), and cross-substance comparison (toxtrust_compare_substances). The descriptions explicitly constrain scope (ONE evidence piece vs. >=2 pieces vs. ONE endpoint), so an agent can route unambiguously.

    Naming Consistency4/5

    All names are snake_case with a uniform toxtrust_ prefix and mostly verb_noun structure (assess_evidence, combine_evidence, compare_substances, rule_sensitivity). The only deviation is toxtrust_info, a bare noun with no verb, but the shared prefix keeps the set predictable.

    Tool Count5/5

    Five tools map cleanly onto a narrow, specialized pipeline (info -> assess -> combine -> sensitivity -> compare), and each has a clear, non-redundant role. No filler or near-duplicate tools are present.

    Completeness4/5

    The surface covers the full Dempster-Shafer workflow: orientation, per-piece mass conversion, combination with conflict handling, robustness variants, and substitution comparison, with explicit upstream cross-checks. Minor gaps remain—no tool to aggregate or summarize results across multiple endpoints (explicitly forbidden by design) or to validate/prepare raw evidence inputs before assessment—but these are workable given the stated scope.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      A server for food-mediated oral exposure screening, governed contaminant and pesticide review, and version-pinned dietary evidence handoffs, converting commodity residues and consumption profiles into auditable intake summaries and PBPK-ready exports.
      49
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables agents to search and reference trusted, out-of-band ingested source state, run claim-bound document reviews, validate evidence-status proposals against admissibility guards, and build evidence matrices. It keeps proposal, evidence, admissibility, and adjudication separate so agents can propose epistemic statuses without creating the source facts, page locators, provenance, or missingness records that support them.
      5
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables evaluation of synthetic tender requirements against supplier evidence by loading tenders, building compliance matrices, flagging unresolved risks, and preparing draft evidence packs with preserved provenance. Finalization stays blocked behind a mandatory human approval gate, so no award decision is made autonomously.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables relation-guided assessment and reassessment of scientific claims using a five-level rubric and audits of twelve evidence relations across initial, audit, and verification rounds. Computes diagnostics such as graph zigzag H1 persistence to select a relation for focused repair, and supports batch runs, record verification, and evaluation against gold labels.
      9
      MIT