clinicaltrialsgov-mcp-server

v2.4.12

MCP server for the ClinicalTrials.gov v2 API. Search trials, retrieve study details and results, and match patients to eligible trials.

clinicaltrials.caseyjhand.com/mcp
claude mcp add --transport http clinicaltrialsgov-mcp-server https://clinicaltrials.caseyjhand.com/mcp
codex mcp add clinicaltrialsgov-mcp-server --url https://clinicaltrials.caseyjhand.com/mcp
{
  "mcpServers": {
    "clinicaltrialsgov-mcp-server": {
      "url": "https://clinicaltrials.caseyjhand.com/mcp"
    }
  }
}
gemini mcp add --transport http clinicaltrialsgov-mcp-server https://clinicaltrials.caseyjhand.com/mcp
{
  "mcpServers": {
    "clinicaltrialsgov-mcp-server": {
      "command": "bunx",
      "args": [
        "mcp-remote",
        "https://clinicaltrials.caseyjhand.com/mcp"
      ]
    }
  }
}
{
  "mcpServers": {
    "clinicaltrialsgov-mcp-server": {
      "type": "http",
      "url": "https://clinicaltrials.caseyjhand.com/mcp"
    }
  }
}
curl -X POST https://clinicaltrials.caseyjhand.com/mcp \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'

Tools

7

clinicaltrials_search_studies

open-world

Search for clinical trial studies from ClinicalTrials.gov. Supports full-text and field-specific queries, status/phase/geographic filters, pagination, sorting, and field selection. Use the fields parameter to reduce payload size — full study records are ~70KB each.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_search_studies",
    "arguments": {}
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "description": "General free-text search across all fields. Plain words plus AND, OR, NOT only — reserved chars `[ ] ( ) ,` will fail. For field-scoped searches, use the dedicated *Query parameters (conditionQuery, interventionQuery, etc.) or advancedFilter with AREA[FieldName]value.",
      "type": "string"
    },
    "conditionQuery": {
      "description": "Condition/disease-specific search. E.g., \"Type 2 Diabetes\", \"non-small cell lung cancer\". Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "interventionQuery": {
      "description": "Intervention/treatment search. E.g., \"pembrolizumab\", \"cognitive behavioral therapy\". Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "locationQuery": {
      "description": "Location search — city, state, country, or facility name. Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "sponsorQuery": {
      "description": "Sponsor/collaborator name search. Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "titleQuery": {
      "description": "Search within study titles and acronyms only. Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "outcomeQuery": {
      "description": "Search within outcome measure fields. Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "statusFilter": {
      "description": "Filter by study status. Values: RECRUITING, COMPLETED, ACTIVE_NOT_RECRUITING, NOT_YET_RECRUITING, ENROLLING_BY_INVITATION, SUSPENDED, TERMINATED, WITHDRAWN, UNKNOWN, WITHHELD, NO_LONGER_AVAILABLE, AVAILABLE, APPROVED_FOR_MARKETING, TEMPORARILY_NOT_AVAILABLE.",
      "anyOf": [
        {
          "type": "string",
          "description": "A single status value."
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Multiple status values (OR)."
        }
      ]
    },
    "phaseFilter": {
      "description": "Filter by trial phase. Values: EARLY_PHASE1, PHASE1, PHASE2, PHASE3, PHASE4, NA.",
      "anyOf": [
        {
          "type": "string",
          "description": "A single phase value."
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Multiple phase values (OR)."
        }
      ]
    },
    "advancedFilter": {
      "description": "Advanced filter using AREA[FieldName]value syntax. Examples: \"AREA[StudyType]INTERVENTIONAL\", \"AREA[EnrollmentCount]RANGE[100, 1000]\", \"AREA[Phase]PHASE2 AND AREA[StudyType]INTERVENTIONAL\", \"(AREA[Phase]PHASE3 OR AREA[Phase]PHASE4) AND AREA[StudyType]INTERVENTIONAL\". AND/OR/NOT join complete AREA[FieldName]value expressions; parentheses group them. Call clinicaltrials_get_field_definitions to find AREA[]-compatible field names.",
      "type": "string"
    },
    "geoFilter": {
      "description": "Geographic proximity filter. Format: distance(lat,lon,radius). E.g., \"distance(47.6062,-122.3321,50mi)\" for studies within 50 miles of Seattle.",
      "type": "string"
    },
    "nctIds": {
      "description": "Filter to specific NCT IDs for batch lookups.",
      "anyOf": [
        {
          "type": "string",
          "pattern": "^NCT\\d{8}$",
          "description": "A single NCT ID."
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^NCT\\d{8}$"
          },
          "description": "Multiple NCT IDs (OR)."
        }
      ]
    },
    "fields": {
      "description": "PascalCase leaf names to return; strongly recommended since full records are ~70KB. Common leaves: NCTId, BriefTitle, BriefSummary, OverallStatus, Phase, LeadSponsorName, Condition. Call clinicaltrials_get_field_definitions with a concept query (e.g., \"adverse events\", \"eligibility\") to find the exact leaf for any concept.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "sort": {
      "description": "Sort order. Format: FieldName:asc or FieldName:desc. E.g., \"LastUpdatePostDate:desc\", \"EnrollmentCount:desc\". Max 2 fields comma-separated. Use clinicaltrials_get_field_definitions to find sortable field names.",
      "type": "string"
    },
    "pageSize": {
      "default": 10,
      "description": "Results per page, 1–200.",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    },
    "pageToken": {
      "description": "Pagination cursor from a previous response.",
      "type": "string"
    },
    "countTotal": {
      "default": true,
      "description": "Include total study count in response. Only computed on the first page.",
      "type": "boolean"
    },
    "includeUnknownEnrollment": {
      "default": false,
      "description": "Include studies whose EnrollmentCount is the upstream \"unknown\" sentinel (99999999). Excluded by default — the sentinel pollutes RANGE[N, MAX] queries and EnrollmentCount:desc sorts. Set true for data-quality audits or when targeting unknown-enrollment studies specifically.",
      "type": "boolean"
    }
  },
  "required": [
    "pageSize",
    "countTotal",
    "includeUnknownEnrollment"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_get_study_record

open-world

Fetch a single clinical trial study by NCT ID from ClinicalTrials.gov. Returns the full study record including protocol details, eligibility criteria, outcomes, arms, interventions, contacts, and locations. Optional locationLimit / outcomeLimit / nearLocation parameters trim locations and outcomes — when present, the same trimmed view is reflected in both structuredContent and the formatted text.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_get_study_record",
    "arguments": {
      "nctId": "<nctId>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "nctId": {
      "type": "string",
      "pattern": "^NCT\\d{8}$",
      "description": "NCT identifier — format `NCT` followed by 8 digits (e.g., `NCT03722472`)."
    },
    "locationLimit": {
      "description": "Optional cap on the number of locations returned. Omit for no cap (full upstream list). Pairs naturally with nearLocation for narrowing a large multi-site trial. Original total preserved in filtersApplied.totalLocations whenever a cap is applied.",
      "type": "integer",
      "minimum": 1,
      "maximum": 500
    },
    "outcomeLimit": {
      "description": "Optional cap on the number of secondary and other outcomes returned. Omit for no cap (full upstream lists). Primary outcomes are never capped. Original totals preserved in filtersApplied.totalSecondaryOutcomes / totalOtherOutcomes whenever a cap is applied.",
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "nearLocation": {
      "description": "Filter returned locations to those within radius of (lat, lon) and sort by distance. Adds distanceMi to each location. Locations without published coordinates are dropped — most US sites carry them; international sites less reliably so. For broader geographic filtering across studies, use clinicaltrials_search_studies with geoFilter.",
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90,
          "description": "Latitude in decimal degrees."
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180,
          "description": "Longitude in decimal degrees."
        },
        "radiusMi": {
          "default": 50,
          "description": "Radius in miles. Default 50.",
          "type": "number",
          "minimum": 1,
          "maximum": 500
        }
      },
      "required": [
        "lat",
        "lon",
        "radiusMi"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "nctId"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_get_study_count

open-world

Get total clinical trial study count from ClinicalTrials.gov matching a query, without fetching study data. Fast and lightweight. Use for quick statistics or to build breakdowns by calling multiple times with different filters (e.g., count by phase, count by status, count recruiting vs completed for a condition).

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_get_study_count",
    "arguments": {}
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "description": "General free-text search across all fields. Plain words plus AND, OR, NOT only — reserved chars `[ ] ( ) ,` will fail. For field-scoped searches, use the dedicated *Query parameters (conditionQuery, interventionQuery, etc.) or advancedFilter with AREA[FieldName]value.",
      "type": "string"
    },
    "conditionQuery": {
      "description": "Condition/disease-specific search. E.g., \"Type 2 Diabetes\", \"non-small cell lung cancer\". Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "interventionQuery": {
      "description": "Intervention/treatment search. E.g., \"pembrolizumab\", \"cognitive behavioral therapy\". Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "sponsorQuery": {
      "description": "Sponsor/collaborator name search. Plain words plus AND/OR/NOT only — reserved chars: [ ] ( ) ,",
      "type": "string"
    },
    "statusFilter": {
      "description": "Filter by study status. Values: RECRUITING, COMPLETED, ACTIVE_NOT_RECRUITING, NOT_YET_RECRUITING, ENROLLING_BY_INVITATION, SUSPENDED, TERMINATED, WITHDRAWN, UNKNOWN, WITHHELD, NO_LONGER_AVAILABLE, AVAILABLE, APPROVED_FOR_MARKETING, TEMPORARILY_NOT_AVAILABLE.",
      "anyOf": [
        {
          "type": "string",
          "description": "A single status value."
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Multiple status values (OR)."
        }
      ]
    },
    "phaseFilter": {
      "description": "Filter by trial phase. Values: EARLY_PHASE1, PHASE1, PHASE2, PHASE3, PHASE4, NA.",
      "anyOf": [
        {
          "type": "string",
          "description": "A single phase value."
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Multiple phase values (OR)."
        }
      ]
    },
    "advancedFilter": {
      "description": "Advanced filter using AREA[FieldName]value syntax. Examples: \"AREA[StudyType]INTERVENTIONAL\", \"AREA[EnrollmentCount]RANGE[100, 1000]\", \"AREA[Phase]PHASE2 AND AREA[StudyType]INTERVENTIONAL\", \"(AREA[Phase]PHASE3 OR AREA[Phase]PHASE4) AND AREA[StudyType]INTERVENTIONAL\". AND/OR/NOT join complete AREA[FieldName]value expressions; parentheses group them. Call clinicaltrials_get_field_definitions to find AREA[]-compatible field names.",
      "type": "string"
    },
    "includeUnknownEnrollment": {
      "default": false,
      "description": "Include studies whose EnrollmentCount is the upstream \"unknown\" sentinel (99999999). Excluded by default — the sentinel pollutes RANGE[N, MAX] queries. Set true for data-quality audits.",
      "type": "boolean"
    }
  },
  "required": [
    "includeUnknownEnrollment"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_get_field_values

open-world

Discover valid values for ClinicalTrials.gov fields with study counts per value. Use to explore available filter options before building a search — e.g., valid OverallStatus, Phase, InterventionType, StudyType, or LeadSponsorClass values.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_get_field_values",
    "arguments": {
      "fields": "<fields>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fields": {
      "anyOf": [
        {
          "type": "string",
          "description": "A single PascalCase field name."
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Multiple PascalCase field names."
        }
      ],
      "description": "PascalCase field name(s) to get value statistics for. Examples: OverallStatus, Phase, StudyType, Sex, LeadSponsorClass. Use clinicaltrials_get_field_definitions with a query to find more field names."
    }
  },
  "required": [
    "fields"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_get_field_definitions

open-world

Resolve valid field names from the ClinicalTrials.gov data model. Returns canonical PascalCase identifiers (OverallStatus, EnrollmentCount, LeadSponsorName) — the exact names accepted by the `fields`, `advancedFilter`, and `sort` parameters of other tools and as input to clinicaltrials_get_field_values. Three usage modes: pass `query` for keyword search by concept (e.g., "enrollment", "sponsor", "adverse events") returning a ranked list of matches; pass `path` for drill-down into a section by dot-notation (e.g., "protocolSection.designModule") returning its individual fields; omit both for a top-level overview of all sections.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_get_field_definitions",
    "arguments": {}
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "description": "Keyword to search field names by — e.g., \"enrollment\", \"sponsor\", \"adverse events\". Returns matching field names ranked by relevance with their full paths and data types. Cannot be combined with `path`.",
      "type": "string"
    },
    "path": {
      "description": "Dot-notation path to drill into a section. E.g., \"protocolSection.designModule\", \"protocolSection.eligibilityModule\", \"resultsSection\". Returns the section's individual fields. Cannot be combined with `query`. Omit both `path` and `query` for a top-level overview.",
      "type": "string"
    },
    "limit": {
      "default": 20,
      "description": "Maximum results to return when using `query`. Default: 20.",
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "includeIndexedOnly": {
      "description": "Only return indexed (searchable) fields. Default: false. Has no visible effect at the top level — use with `path` to filter.",
      "type": "boolean"
    }
  },
  "required": [
    "limit"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_get_study_results

open-world

Fetch clinical trial results data from ClinicalTrials.gov for completed studies — outcome measures with statistics, adverse events, participant flow, and baseline characteristics. Only available for studies where hasResults is true. Use clinicaltrials_search_studies first to find studies with results.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_get_study_results",
    "arguments": {
      "nctIds": "<nctIds>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "nctIds": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^NCT\\d{8}$",
          "description": "A single NCT ID."
        },
        {
          "minItems": 1,
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^NCT\\d{8}$"
          },
          "description": "Multiple NCT IDs (max 20)."
        }
      ],
      "description": "One or more NCT IDs (max 20). E.g., \"NCT12345678\" or [\"NCT12345678\", \"NCT87654321\"]. Use summary=true for large batches to avoid large payloads."
    },
    "sections": {
      "description": "Filter which sections to return. Values: outcomes, adverseEvents, participantFlow, baseline. Omit for all sections.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "outcomes",
            "adverseEvents",
            "participantFlow",
            "baseline"
          ],
          "description": "A single section name."
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "outcomes",
              "adverseEvents",
              "participantFlow",
              "baseline"
            ]
          },
          "description": "Multiple section names."
        }
      ]
    },
    "summary": {
      "default": false,
      "description": "Return condensed summaries instead of full data. Reduces payload from ~200KB to ~5KB per study. Summaries include outcome titles, types, timeframes, group counts, and top-level stats — omitting individual measurements, analyses, and per-group data.",
      "type": "boolean"
    }
  },
  "required": [
    "nctIds",
    "summary"
  ],
  "additionalProperties": false
}
view source ↗

clinicaltrials_find_eligible

open-world

Match patient demographics and conditions to eligible recruiting clinical trials. Provide age, sex, conditions, and location to find studies with matching eligibility criteria, contact information, and recruiting locations.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "clinicaltrials_find_eligible",
    "arguments": {
      "age": "<age>",
      "sex": "<sex>",
      "conditions": "<conditions>",
      "location": "<location>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "age": {
      "type": "integer",
      "minimum": 0,
      "maximum": 120,
      "description": "Patient age in years."
    },
    "sex": {
      "type": "string",
      "enum": [
        "FEMALE",
        "MALE",
        "ALL"
      ],
      "description": "Patient's biological sex. Use 'ALL' to include studies regardless of sex restrictions."
    },
    "conditions": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Medical conditions or diagnoses. E.g., [\"Type 2 Diabetes\", \"Hypertension\"]. Plain words only — reserved chars `[ ] ( ) ,` inside an entry will fail."
    },
    "location": {
      "type": "object",
      "properties": {
        "country": {
          "type": "string",
          "description": "Country name. E.g., \"United States\"."
        },
        "state": {
          "description": "State or province.",
          "type": "string"
        },
        "city": {
          "description": "City name.",
          "type": "string"
        }
      },
      "required": [
        "country"
      ],
      "additionalProperties": false,
      "description": "Patient location as `{ country (required), state?, city? }`. Country is required; state/city narrow the match. For radius-based geographic search, use clinicaltrials_search_studies with geoFilter."
    },
    "healthyVolunteer": {
      "default": false,
      "description": "Whether the patient is a healthy volunteer. When true, only studies accepting healthy volunteers are queried.",
      "type": "boolean"
    },
    "recruitingOnly": {
      "default": true,
      "description": "Only include actively recruiting studies.",
      "type": "boolean"
    },
    "maxResults": {
      "default": 10,
      "description": "Maximum results to return.",
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    }
  },
  "required": [
    "age",
    "sex",
    "conditions",
    "location",
    "healthyVolunteer",
    "recruitingOnly",
    "maxResults"
  ],
  "additionalProperties": false
}
view source ↗

Resources

1

Prompts

1

Guides analysis of a clinical trial landscape using the ClinicalTrials.gov MCP tools. Adaptable workflow for breakdowns by status, phase, sponsor, geography, etc.

  • topicrequired — Disease, condition, or research area to analyze.
  • focusAreas — Comma-separated aspects to focus on, e.g.: "status, phases, sponsors, geography, timeline, interventions".