caelum0x 9b91a4a968 feat: connect PaperTrail to Claude Science (MCP connectors, skills) + Google auth
Make PaperTrail plug into Anthropic's Claude Science workbench four ways:
- Remote URL connector: hosted Streamable-HTTP MCP at /api/mcp (45 public tools)
- Local command connector: standalone stdio MCP package under mcp/ (47 tools,
  incl. 2 API-key tools) — @modelcontextprotocol/sdk, calls the live API
- Skills: 8 Claude Science Agent Skills under skills/ (import from GitHub / upload)
- Network: docs to allow-list the API domain for the curl path
- Public /connect page showcasing all four methods (judges can see it, no login)

Also:
- Google OAuth sign-in ("Continue with Google") on login + register, wired to
  GOOGLE_CLIENT_ID/SECRET; users.password_hash now nullable + auth_provider/
  google_sub (migration 0061); password login guards Google-only accounts
- Landing design: center + enlarge the claim input; bigger textarea

tsc clean; app build compiles 362 pages; local MCP smoke-tested end-to-end.
2026-07-10 17:06:04 +03:00

2.8 KiB
Raw Permalink Blame History

name, description
name description
papertrail-trial-matcher Match a de-identified patient case to eligible clinical trials on ClinicalTrials.gov with per-criterion eligibility reasoning. Use when a scientist or clinician pastes de-identified patient notes and asks which trials the patient might qualify for. Requires a PaperTrail org API key.

PaperTrail: Trial Matcher

Turn de-identified patient notes into a grounded patient profile, search ClinicalTrials.gov, and assess eligibility trial-by-trial with per-criterion verdicts. This is an org-scoped tool and requires authentication.

Governance (critical — state and honor)

  • De-identified input only. Never paste PHI. Raw notes are never persisted and never logged — only a de-identified profile, note character count, and the match verdicts are stored.
  • Deterministic recompute — the eligibility assessment is reproducible for the same notes and trial set.
  • Exact-span grounding — each eligibility verdict cites the specific inclusion/exclusion criterion text it was judged against; no eligibility claim is made without the criterion it maps to.
  • Honest non-match — trials that don't clearly fit are reported as such, not stretched into a match.

Step 1 — Call the tool (auth required)

Preferred: the match_patient_to_trials MCP tool.

Inputs:

  • notes (string, required) — de-identified patient notes, 10–20000 chars.

Auth: the org-scoped tools require PAPERTRAIL_API_KEY set in the MCP server environment; it is sent as Authorization: Bearer <key>.

Step 2 — Read the result

Report:

  • the de-identified patient summary the engine derived,
  • the candidate trials (NCT id, title, phase, status), and
  • for each, the eligibility verdict with the specific criteria met / not met / unknown, each tied to the trial's criterion text.

Flag any criterion the notes don't cover as "unknown" rather than guessing.

curl fallback (no MCP connector installed)

Base URL: https://papertrail-topaz-phi.vercel.app. Requires a Bearer token (PAPERTRAIL_API_KEY). Hits the v1 org route.

curl -sS -X POST https://papertrail-topaz-phi.vercel.app/api/v1/trial-matcher \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $PAPERTRAIL_API_KEY" \
  -d '{
    "notes": "62-year-old with type 2 diabetes, HbA1c 8.4%, eGFR 55, on metformin, no prior MI, non-smoker."
  }'

Returns the standard { success, data, error } envelope with the profile, candidate trials, and per-criterion eligibility.

Notes

  • If you get a 401/403, the API key is missing or lacks Editor+ scope for this org — tell the user to configure PAPERTRAIL_API_KEY.
  • Keep everything de-identified. If the notes contain identifiers, ask the user to remove them before matching.