# io.github.wei-ai-lab/clinical-trial-design (npm · clinical-trial-design)

Phase 2/3 clinical trial design via gsDesign / gsDesign2: sample size, GS boundaries, multiplicity

- Trust score: 63/100 (medium)
- Change this week: +23
- Registry status: active
- Liveness: live
- Owner verified: no
- Last scored: 2026-08-03

## Components

- npm · `clinical-trial-design`: 63/100 (this document), [markdown](https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design.md), [page](https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design)

## Channel facts

- Registry: `npm`
- Package: `clinical-trial-design`
- Version: `0.0.12`
- Transport: `stdio`

## Trust breakdown

How this component scores in each security and reliability category. Every signal is checked automatically from public evidence about the published package, including repeated runs of it in an isolated sandbox, and we only credit what we can confirm. Scores are 0–100 per category. Scoring method: https://verifymcp.io/docs/scoring (what has changed: https://verifymcp.io/docs/scoring/changelog)

Scored 2026-08-03.

- **Supply Chain Security**: 87/100
  - No malware found by supply-chain analysis.
  - Only part of the dependency tree could be resolved (95 of 99), so this covers what we could see, not the whole tree.
  - No install/post-install scripts declared.
  - Only part of the dependency tree could be resolved (95 of 99), so this covers what we could see, not the whole tree.
- **Provenance & Transparency**: 45/100
  - Source repository is publicly reachable at the declared URL.
  - Provenance check failed: no build-provenance attestation is published.
  - Clear OSI-approved license (Apache-2.0).
  - Actively maintained (last published 91 days ago).
  - Disclosure check failed: no security disclosure policy was found in the source repository.
- **Schema Quality & AI Usability**: 47/100
  - AI-judged instruction clarity (good).
  - Context-footprint check failed: tool/resource definitions use about 4977 tokens (~553/item across 9 items; 9 tools + 0 resources), over budget; trim descriptions and params.
  - Usage-examples check failed: none of the tools include examples.
- **Stability & Change Management**: 23/100
  - Stability observed for 7 of 30 days with no destabilising changes; credit accrues until the full window elapses.
- **Tool Coverage**: 96/100
  - 100% of tools have a non-trivial description (not blank, and not just the tool's name).
  - 89% of tool parameters carry a description.
- **Capabilities**: 100/100
  - Implements a supported MCP spec version (2025-11-25); the latest is 2026-07-28.

## Install

### Claude

```bash
claude mcp add wei-ai-lab-clinical-trial-design -- npx -y clinical-trial-design
```

### Codex

```bash
codex mcp add wei-ai-lab-clinical-trial-design -- npx -y clinical-trial-design
```

### opencode

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "wei-ai-lab-clinical-trial-design": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "clinical-trial-design"
      ],
      "enabled": true
    }
  }
}
```

### OpenClaw

```bash
openclaw mcp add wei-ai-lab-clinical-trial-design --command npx --arg -y --arg clinical-trial-design
```

### Hermes

```yaml
mcp_servers:
  wei-ai-lab-clinical-trial-design:
    command: "npx"
    args: ["-y", "clinical-trial-design"]
```

### Other

```json
{
  "mcpServers": {
    "wei-ai-lab-clinical-trial-design": {
      "command": "npx",
      "args": [
        "-y",
        "clinical-trial-design"
      ]
    }
  }
}
```

## Changelog

Every change recorded for this component, newest first. Days that predate change tracking, or that we cannot explain, say so: "we were watching and nothing happened" and "we were not watching" are different claims.

### 2026-08-03 (score 63, +1)

No change was recorded against any check on this day. Stability & Change Management went from 20 to 23. That category is still filling its 30-day observation window: 6 days of observed history at the previous scan, 7 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-08-02 (score 62, +57)

- [security regression] Provenance: unverified → fail
- [security improvement] Known CVEs: unverified → partial
- [security improvement] Install scripts: unverified → pass
- [security improvement] Malware scan: unverified → pass
- [functional regression] Security disclosure: unverified → fail
- [functional improvement] Dependency health: unverified → partial
- [functional improvement] Stability: unverified → 0.20
- [functional improvement] Maintenance: unverified → pass
- [functional improvement] MCP protocol: unverified → pass
- [functional improvement] Schema quality: unverified → good
- [functional improvement] License: unverified → pass
- [functional improvement] Tool coverage: unverified → 100
- [functional] Licence: Apache-2.0

### 2026-08-01 (score 5, 0)

- [functional regression] Security disclosure: fail → unverified

### 2026-07-31 (score 5, −35)

- [functional] We updated how we score, so this day's move reflects our rubric, not a change to the server

### 2026-07-27 (score 40)

First indexed and scored.

## MCP tools (9)

### `design_binary` (~868 tokens)

Use when the user wants two-arm Phase 2/3 sample size with a BINARY primary endpoint — responder rate, fixed-time mortality, ORR, ACR20, remission/cure, anything that resolves to event-or-no-event per subject. Set comparison='superiority' (default), 'non-inferiority' (then provide ni_margin), or 'equivalence' (then provide equiv_margin; fixed-sample only). Set design_class='group-sequential' for interim analyses with alpha-spending. Supply an optional `operational` block (any 0–4 of accrual_rate, accrual_duration, follow_up_duration, total_trial_duration) and the kernel fills in the rest. For two or more co-primary binary endpoints with multiplicity control, use design_co_primary instead.

Input parameters:

- `allocation_ratio` (number): Treatment / control allocation ratio. 1 = balanced 1:1.
- `alpha` (number): Type I error rate. For a standard two-sided 0.05 test use 0.025 with sided = 2.
- `comparison` (string): Hypothesis type. 'superiority' (default) tests for a difference; 'non-inferiority' requires ni_margin; 'equivalence' requires equiv_margin.
- `design_class` (string): Design class. 'fixed' = single final analysis; 'group-sequential' = interim looks with alpha-spending. Group-sequential params (k, timing, sfu/sfl, test_type) are ignored when design_class = 'fixed'.
- `equiv_margin` (number): Two-sided equivalence margin (TOST). Required when comparison='equivalence'. Fixed-sample only.
- `k` (integer): Number of planned analyses including the final one. Integer in [2, 10].
- `ni_margin` (number): Non-inferiority margin on the risk-difference scale. Required when comparison='non-inferiority'.
- `operational` (object): Optional operational kernel inputs. Supply any 0-4 of {accrual_rate, accrual_duration, follow_up_duration, total_trial_duration}; the solver fills in the missing values from rate*duration = N and A +…
- `p_control` (number, required): Event rate in the control arm (0,1).
- `p_treatment` (number, required): Event rate in the treatment arm (0,1).
- `power` (number): 1 - beta. Targeted power of the test (default 0.9).
- `sfl`: Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sflpar` (number): Numeric parameter for HSD / Power lower sf.
- `sfu` (string): Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sfupar` (number): Numeric parameter for HSD / Power upper sf.
- `sided` (number): 1 = one-sided test (default), 2 = two-sided. Many modern designs use sided = 1 with alpha = 0.025 to match the two-sided 0.05 convention.
- `test_type` (integer): gsDesign test.type. 1 = efficacy-only, 2 = symmetric efficacy+futility, 3 = non-binding futility, 4 = binding futility, 5/6 = same with lower beta-spending.
- `timing` (array): Information fractions at each analysis, length k, strictly increasing in (0,1], last = 1. Defaults to equal spacing 1/k, 2/k, ..., 1.

### `design_continuous` (~821 tokens)

Use when the user wants two-arm Phase 2/3 sample size with a CONTINUOUS primary endpoint — change from baseline in a measured score (HAM-D-17, PANSS, HbA1c reduction, eGFR slope, BP), QoL scale, biomarker level. Provide mean_diff (assumed treatment - control mean) and the common within-arm sd. Set comparison='superiority' (default), 'non-inferiority' (provide ni_margin), or 'equivalence' (provide equiv_margin; fixed-sample only). Set design_class='group-sequential' for interim analyses with alpha-spending. Supports the same `operational` block as design_binary and design_survival. For multi-endpoint designs, use design_co_primary.

Input parameters:

- `allocation_ratio` (number): Treatment / control allocation ratio. 1 = balanced 1:1.
- `alpha` (number): Type I error rate. For a standard two-sided 0.05 test use 0.025 with sided = 2.
- `comparison` (string): Hypothesis type. 'superiority' (default) tests for a difference; 'non-inferiority' requires ni_margin; 'equivalence' requires equiv_margin.
- `design_class` (string): Design class. 'fixed' = single final analysis; 'group-sequential' = interim looks with alpha-spending. Group-sequential params (k, timing, sfu/sfl, test_type) are ignored when design_class = 'fixed'.
- `equiv_margin` (number): Two-sided equivalence margin (TOST). Fixed-sample only.
- `k` (integer): Number of planned analyses including the final one. Integer in [2, 10].
- `mean_diff` (number, required): Assumed mean difference (treatment - control).
- `ni_margin` (number): Non-inferiority margin on the mean-difference scale.
- `operational` (object): Optional operational kernel inputs. Supply any 0-4 of {accrual_rate, accrual_duration, follow_up_duration, total_trial_duration}; the solver fills in the missing values from rate*duration = N and A +…
- `power` (number): 1 - beta. Targeted power of the test (default 0.9).
- `sd` (number, required): Common within-arm SD.
- `sfl`: Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sflpar` (number)
- `sfu` (string): Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sfupar` (number)
- `sided` (number): 1 = one-sided test (default), 2 = two-sided. Many modern designs use sided = 1 with alpha = 0.025 to match the two-sided 0.05 convention.
- `test_type` (integer): gsDesign test.type. 1 = efficacy-only, 2 = symmetric efficacy+futility, 3 = non-binding futility, 4 = binding futility, 5/6 = same with lower beta-spending.
- `timing` (array): Information fractions at each analysis, length k, strictly increasing in (0,1], last = 1. Defaults to equal spacing 1/k, 2/k, ..., 1.

### `design_survival` (~1277 tokens)

Use when the user wants Phase 2/3 sample size with a TIME-TO-EVENT primary endpoint — overall survival, PFS, time to first hospitalization, time to progression, time to a CV composite, etc. Choose the test statistic via `model`: 'ph' (default — log-rank under proportional hazards, gsDesign::nSurv / gsSurv), 'maxcombo' (delayed effect / non-proportional hazards via Fleming-Harrington combo), 'rmst' (restricted mean survival to landmark tau), 'milestone' (survival probability at landmark t*), 'wlr' / 'ahr' (weighted log-rank / average HR for GS NPH). Set design_class='group-sequential' for interim analyses with alpha-spending. Always provide control_median + the relevant effect parameter (hazard_ratio for PH; delay_months + post_delay_hr for NPH models). The `operational` block can solve any 0–4 of {accrual_rate, accrual_duration, followup_duration, total_trial_duration} via the events-tied uniroot. For two co-primary TTE endpoints (PFS+OS) use design_co_primary; for nested PD-L1 strata or biomarker subgroup + ITT use design_multi_population.

Input parameters:

- `accrual_duration` (number): Accrual period (months).
- `accrual_rate` (number): Enrollment rate (subjects/month).
- `allocation_ratio` (number): Treatment / control allocation ratio. 1 = balanced 1:1.
- `alpha` (number): Type I error rate. For a standard two-sided 0.05 test use 0.025 with sided = 2.
- `analysis_times` (array): Calendar times of k planned analyses (NPH GS); last = study duration.
- `binding` (boolean): Whether the futility boundary is binding (NPH GS).
- `comparison` (string): Hypothesis type. 'superiority' (default) tests for a difference; 'non-inferiority' requires ni_margin; 'equivalence' requires equiv_margin.
- `control_median` (number, required): Control-arm median survival (months).
- `delay_months` (number): Duration of HR=1 period preceding the effect (NPH models).
- `design_class` (string): Design class. 'fixed' = single final analysis; 'group-sequential' = interim looks with alpha-spending. Group-sequential params (k, timing, sfu/sfl, test_type) are ignored when design_class = 'fixed'.
- `dropout_rate` (number): Per-month dropout hazard.
- `followup_duration` (number): Minimum follow-up after last enrollment (months).
- `gamma` (array): Fleming-Harrington gamma weights (MaxCombo / WLR).
- `hazard_ratio` (number): Target HR (PH only). < 1 favors treatment. For NI with hr_null > 1, the assumed true HR is often 1.
- `hr_null` (number): Null-hypothesis HR for non-inferiority (typically > 1, e.g. 1.3).
- `k` (integer): Number of planned analyses including the final one. Integer in [2, 10].
- `model` (string): Survival statistical model. 'ph' = log-rank under proportional hazards (gsDesign::nSurv / gsSurv). 'maxcombo' / 'rmst' / 'milestone' are NPH fixed-sample (gsDesign2::fixed_design_*). 'wlr' / 'ahr' ar…
- `ni_hr` (number): Alias for hr_null.
- `operational` (object): Optional operational kernel inputs. Supply any 0-4 of {accrual_rate, accrual_duration, follow_up_duration, total_trial_duration}; the solver fills in the missing values from rate*duration = N and A +…
- `post_delay_hr` (number): HR after delay_months (NPH models).
- `power` (number): 1 - beta. Targeted power of the test (default 0.9).
- `reasoning_chain` (array): Optional structured citation trail. Each entry: {decision, value, justification, source_type, source_ref?}. design_report() renders this inline; sponsor_confidential entries trigger a redaction promp…
- `rho` (array): Fleming-Harrington rho weights (MaxCombo / WLR).
- `sfl`: Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sflpar` (number)
- `sfu` (string): Alpha-spending function. OF = O'Brien-Fleming, Pocock = Pocock, HSD = Hwang-Shih-DeCani (needs sfupar), Power = power family (needs sfupar), LDOF / LDPocock = Lan-DeMets approximations (the standard)…
- `sfupar` (number)
- `sided` (number): TTE designs are one-sided.
- `tau` (number): Landmark time for RMST / milestone (months). Defaults to total study duration.
- `tau_fh`: Fleming-Harrington tau (MaxCombo / WLR).
- `test_type` (integer): gsDesign test.type. 1 = efficacy-only, 2 = symmetric efficacy+futility, 3 = non-binding futility, 4 = binding futility, 5/6 = same with lower beta-spending.
- `timing` (array): Information fractions at each analysis, length k, strictly increasing in (0,1], last = 1. Defaults to equal spacing 1/k, 2/k, ..., 1.

### `design_co_primary` (~455 tokens)

Multi-endpoint co-primary trial design with multiplicity control. Use when a confirmatory trial requires positive results on two or more primary endpoints (oncology PFS+OS, CV death+HHF, etc.). Strategies: fixed-sequence (hierarchical, full alpha per test, the canonical approach for ordered co-primary), alpha-split (partition alpha by weights), bonferroni (equal alpha-split). Each endpoint is sized at its effective alpha via the matching design_<type> wrapper; total N is the max across endpoints. For graphical multiplicity (Maurer-Bretz with alpha recycling), use `design_graphical_multiplicity` instead.

Input parameters:

- `allocation_ratio` (number): Treatment-to-control allocation ratio, shared across endpoints.
- `alpha` (number): Family-wise type I error (default 0.025, one-sided).
- `alpha_weights` (object): For strategy='alpha-split' only. Named numeric vector summing to 1. Default (when omitted with alpha-split): equal weights 1/k.
- `endpoints` (object, required): Named map of co-primary endpoints. Each entry has `type` plus the parameters the matching design_<type> wrapper accepts (e.g., for survival: model, design_class, control_median, hazard_ratio, accrual…
- `ordering` (array): For strategy='fixed-sequence' only. Endpoint names in test order. Default: order in which `endpoints` was supplied.
- `power` (number): Per-endpoint power (default 0.80).
- `reasoning_chain` (array): Optional structured citation trail. Each entry: {decision, value, justification, source_type, source_ref?}. design_report() renders this inline; sponsor_confidential entries trigger a redaction promp…
- `sided` (number): Sidedness.
- `strategy` (string): Multiplicity-control strategy. `fixed-sequence` (hierarchical) tests each endpoint at the full family alpha conditional on prior rejection — preserves alpha by closed testing, no per-test discount. `…

### `design_multi_population` (~477 tokens)

Multi-population (subgroup) trial design with multiplicity control. Use when a confirmatory trial tests the same endpoint in multiple populations — biomarker-positive subgroup + ITT, nested PD-L1 strata, etc. Pick relation='nested' (the canonical case: TPS≥50 ⊂ TPS≥20 ⊂ ITT, all patients enroll into the broadest, total N driven by largest implied-enrolled across strata) or 'disjoint' (strata enrolled separately, total N = sum). Strategies: fixed-sequence (hierarchical), alpha-split, bonferroni. For graphical multiplicity (Maurer-Bretz with alpha recycling between populations), use design_graphical_multiplicity.

Input parameters:

- `allocation_ratio` (number)
- `alpha` (number)
- `alpha_weights` (object): For strategy='alpha-split' only. Names match `populations`; sum to 1.
- `endpoint_args` (object, required): Shared endpoint design parameters (e.g., for survival: model, design_class, control_median, accrual_duration, followup_duration, dropout_rate). The effect parameter (hazard_ratio / p_treatment / delt…
- `endpoint_type` (string, required): Endpoint family — selects which design_<type> wrapper handles each population.
- `ordering` (array): For strategy='fixed-sequence' only. Population names in test order.
- `populations` (object, required): Named map of populations. Each entry has `effect` (and `prevalence` for nested mode).
- `power` (number)
- `reasoning_chain` (array): Optional structured citation trail. Each entry: {decision, value, justification, source_type, source_ref?}. design_report() renders this inline; sponsor_confidential entries trigger a redaction promp…
- `relation` (string): How populations relate. `nested` (default): subgroups overlap, all patients enroll into the broadest, total N = max of implied-enrolled-N. `disjoint`: separate strata enrolled, total N = sum of per-p…
- `sided` (number)
- `strategy` (string): Multiplicity-control strategy across populations. `fixed-sequence` is the canonical biomarker pattern (test strongest-effect subgroup first, gate broader strata on rejection).

### `design_graphical_multiplicity` (~478 tokens)

Graphical multiplicity (Maurer-Bretz) trial design with alpha recycling. Use when a confirmatory trial has 2+ hypotheses (mixed primary + secondary, dose-response, parent + derived endpoints) where a graph-based procedure preserves family-wise alpha better than Bonferroni. Validates the transition matrix (Rule-3 + row sums) and constructs a graphicalMCP graph object. Sizes each hypothesis at its worst-case alpha; total N is the max across hypotheses. For simpler co-primary or multi-population designs use design_co_primary or design_multi_population instead.

Input parameters:

- `allocation_ratio` (number)
- `alpha` (number)
- `gate_prereqs` (object): Optional per-hypothesis prerequisite map. Each entry is the list of hypothesis names that must be rejected before this one can be tested. Used by the Rule-3 validator: every prerequisite must have a…
- `hypotheses` (object, required): Named map of hypotheses. Each entry has `type` plus the parameters the matching design_<type> wrapper accepts. Continuous uses `mean_diff`, binary uses `p_treatment`, survival uses `hazard_ratio`.
- `initial_weights` (object, required): Per-hypothesis initial alpha weights. Names match `hypotheses`; sum to <= 1. Hypotheses with weight 0 start un-testable and become testable only after alpha is recycled to them through the transition…
- `power` (number)
- `reasoning_chain` (array): Optional structured citation trail. Each entry: {decision, value, justification, source_type, source_ref?}. design_report() renders this inline; sponsor_confidential entries trigger a redaction promp…
- `sided` (number)
- `transition_matrix` (array, required): Square (k x k) transition matrix. Row i column j = weight of alpha re-allocated from hypothesis i to hypothesis j upon rejection of i. Each row sums to <= 1; diagonal must be 0 (no self-loops). Order…
- `worst_case_weights` (object): Optional override of the per-hypothesis worst-case weight used for sample-size sizing. Default: max(initial_weight_i, fallback) where fallback = smallest non-zero initial weight.

### `validate_against_benchmark` (~124 tokens)

Load a benchmark corpus case, re-run the matching design wrapper with its inputs, and diff computed sample_size_total / events_total against expected within the case's tolerance.

Input parameters:

- `family` (string, required): Benchmark family directory name under benchmarks/ (e.g. 'fixed-superiority', 'group-sequential', 'tte-nph').
- `id` (string, required): Case ID = YAML filename without extension, e.g. '1997_CAPTURE_abciximab'.
- `tool` (string): Override the design tool to dispatch. If omitted, inferred from case metadata.

### `verify_design` (~216 tokens)

Monte Carlo simulation cross-check for a designr result. Closed-form simulation (rbinom / rnorm / rexp) drives empirical power and Type I error estimates against the design's target alpha and power. Supports fixed and group-sequential families on binary, continuous, and PH survival endpoints. NPH families (MaxCombo, RMST, milestone) and equivalence designs are not yet supported and return a clean error.

Input parameters:

- `n_sim` (integer): Monte Carlo replicate count. Default 5000.
- `result` (object, required): A designr result object as returned by any design_* tool (the JSON payload, including $method, $inputs, and (for GS) $boundaries / $timing).
- `seed` (integer): RNG seed for reproducibility. Default 1.
- `tolerance_power_pp` (number): Allowed deviation from target power, in percentage points. Default 2.
- `tolerance_type_I_pp` (number): Allowed deviation from target alpha, in percentage points. Default 0.5.

### `design_report` (~261 tokens)

Render a clinician-readable design summary in markdown, Word, or PDF. Reasoning chain (when populated on the result) appears as a table; sponsor_confidential entries trigger a redaction warning at the top. Sections: title, design overview, key inputs, headline output, GS analysis plan, reasoning chain, method + version. Default output is markdown text; format='docx' returns a native Word file path (officer); format='pdf' renders via rmarkdown + Pandoc.

Input parameters:

- `format` (string): Output format. 'markdown' (default) returns the report as text. 'docx' writes a native Word document via the officer R package; 'pdf' renders via rmarkdown + Pandoc (requires Pandoc + a TeX engine on…
- `path` (string): For format='docx' or 'pdf': output file path. If omitted, a tempfile is created and its path returned in the result.
- `result` (object, required): A designr result object as returned by any design_* tool (the JSON payload, including $method, $inputs, and (for GS) $boundaries / $timing).

## Diagnostics

Captured diagnostic sections: Provenance, Dependencies. The full working is on the page: https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design#diagnostics

## Score history

- 2026-08-03: 63
- 2026-08-02: 62
- 2026-08-01: 5
- 2026-07-31: 5
- 2026-07-30: 40
- 2026-07-28: 40
- 2026-07-27: 40

## Links

- npm package: https://www.npmjs.com/package/clinical-trial-design
- Socket report: https://socket.dev/npm/package/clinical-trial-design
- Repository: https://github.com/wei-ai-lab/clinical-trial-design
- Changelog RSS feed: https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design/changelog.xml
- Changelog JSON feed: https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design/changelog.json
- HTML version of this page: https://verifymcp.io/servers/wei-ai-lab-clinical-trial-design/clinical-trial-design
