Clinical Trials MCP Server
MCP server for the ClinicalTrials.gov v2 API. Search trials, retrieve study details and results, and match patients to eligible recruiting studies.
The Clinical Trials MCP server (cyanheads/clinicaltrialsgov-mcp-server) is a community-maintained, open-source bridge between AI assistants and the official ClinicalTrials.gov v2 REST API. It exposes seven tools that let agents run full-text and faceted searches across the registry, pull complete study records by NCT ID, fetch outcome and adverse event data from completed studies, and match patient demographics or conditions against currently recruiting trials.
The server is written in TypeScript on top of the @cyanheads/mcp-ts-core framework and supports both stdio and streamable HTTP transports. Because ClinicalTrials.gov is a free public API, no API keys or accounts are required: the server works out of the box with sensible defaults. A public hosted instance is available at https://clinicaltrials.caseyjhand.com/mcp for users who do not want to self-host, and a Docker image plus npm package (clinicaltrialsgov-mcp-server) are provided for local deployment.
Notable features include field discovery tools (get_field_values and get_field_definitions) that let an agent introspect the API schema before constructing queries, count-only queries to estimate result sizes cheaply, and a dedicated eligibility-matching tool aimed at patient recruitment workflows. The project is Apache-2.0 licensed.
Tools
| Tool | Description |
|---|---|
clinicaltrials_search_studies |
Perform full-text queries with filters, pagination, and sorting across ClinicalTrials.gov study records. |
clinicaltrials_get_study_record |
Retrieve a comprehensive study record by NCT ID. |
clinicaltrials_get_study_count |
Get the total number of studies matching a query without fetching the full records. |
clinicaltrials_get_field_values |
Discover valid values for a given API field along with occurrence counts. |
clinicaltrials_get_field_definitions |
Browse the ClinicalTrials.gov study data model, including the field hierarchy and metadata. |
clinicaltrials_get_study_results |
Extract outcomes, adverse events, and baseline characteristics data from completed studies. |
clinicaltrials_find_eligible |
Match patient demographics and conditions against currently recruiting trials. |
Prerequisites
- Bun v1.3.0+ or Node.js 24.0.0+
- No API key or ClinicalTrials.gov account is required.
Option 1: Use the public hosted instance
Point your MCP client at the maintainer's public instance, no install needed:
{
"mcpServers": {
"clinicaltrialsgov-mcp-server": {
"type": "streamable-http",
"url": "https://clinicaltrials.caseyjhand.com/mcp"
}
}
}
Option 2: Run locally via npx/bunx (stdio)
{
"mcpServers": {
"clinicaltrialsgov-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["clinicaltrialsgov-mcp-server@latest"]
}
}
}
Option 3: Clone and build from source
git clone https://github.com/cyanheads/clinicaltrialsgov-mcp-server.git
cd clinicaltrialsgov-mcp-server
bun install
bun run build
bun run start:stdio # or: bun run start:http
Optional environment variables
| Variable | Purpose | Default |
|---|---|---|
CT_API_BASE_URL |
ClinicalTrials.gov API base URL | https://clinicaltrials.gov/api/v2 |
CT_REQUEST_TIMEOUT_MS |
Request timeout in ms | 30000 |
CT_MAX_PAGE_SIZE |
Maximum page size for results | 200 |
MCP_TRANSPORT_TYPE |
Transport protocol (stdio or http) |
stdio |
MCP_HTTP_PORT |
HTTP server port | 3010 |
MCP_LOG_LEVEL |
Logging level | info |
- Run literature-style searches across all registered trials for a given condition, intervention, or sponsor and summarize the recruiting landscape.
- Pull the full record for a specific NCT ID to review eligibility criteria, study arms, and primary endpoints inside a chat session.
- Extract outcome measures and adverse event tables from completed studies to support meta-analysis or competitive intelligence work.
- Match a patient profile (age, sex, diagnosis, location) against currently recruiting trials and return shortlist candidates.
- Use the field-discovery tools to programmatically introspect the v2 API schema before building agentic research workflows.
- "Find all Phase 3 trials for non-small cell lung cancer that are currently recruiting in the United States."
- "Pull the full study record for NCT04368728 and summarize the eligibility criteria."
- "How many interventional studies sponsored by Pfizer have completed since 2023?"
- "Show me the primary outcome results and serious adverse events for NCT03761108."
- "I have a 62-year-old male with stage II pancreatic cancer in Boston. Which recruiting trials might he be eligible for?"
- Covers the full ClinicalTrials.gov v2 API surface with seven well-scoped tools, including count-only and field-introspection helpers.
- No API key or account required; works against a free public registry.
- Offers a public hosted endpoint, an npm package, and Docker support, so users can pick zero-setup or self-hosted deployment.
- Apache-2.0 licensed and actively maintained, with both stdio and streamable HTTP transports.
- Community-maintained, not an official ClinicalTrials.gov / NIH project, so support and SLAs are best-effort.
- Read-only: limited to ClinicalTrials.gov data, with no integration to other registries like the WHO ICTRP or EU CTR.
- The eligibility-matching tool depends on free-text patient input and registry filters, so results still need clinician review.
- JackKuo666/ClinicalTrials-MCP-Server: a simpler Python-based MCP bridge to ClinicalTrials.gov.
- mattjohnpowell/clinical-trials-mcp: MCP server that also covers the WHO ICTRP registry in addition to ClinicalTrials.gov.
- Cicatriiz/healthcare-mcp-public: broader healthcare MCP server bundling FDA, PubMed, ICD-10, and clinical trials tools.