
ClinicalTrials.gov
Connects to ClinicalTrials.gov's database to search and retrieve clinical trial information by condition, location, status, and study ID. Includes data cleaning and local backup storage.
Integrates with ClinicalTrials.gov REST API to search clinical trials by conditions, interventions, locations, and status, plus retrieve detailed study information by NCT ID with automatic data cleaning and local backup storage.
What it does
- Search clinical trials by medical conditions and interventions
- Filter trials by location and recruitment status
- Retrieve detailed study information using NCT IDs
- Compare multiple clinical studies side by side
- Analyze trial trends and patterns
- Match patients to eligible trials
Best for
About ClinicalTrials.gov
ClinicalTrials.gov is a community-built MCP server published by cyanheads that provides AI assistants with tools and capabilities via the Model Context Protocol. Integrate ClinicalTrials.gov API to search clinical trials by condition, intervention, or location, with detailed study It is categorized under databases, analytics data.
How to install
You can install ClinicalTrials.gov in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
License
ClinicalTrials.gov is released under the Apache-2.0 license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
clinicaltrialsgov-mcp-server
MCP server for the ClinicalTrials.gov v2 API. Search trials, retrieve study details, compare studies, analyze trends, and match patients to eligible trials. Runs over stdio or HTTP. Deployable to Cloudflare Workers.
Tools
Seven tools for working with ClinicalTrials.gov data:
| Tool Name | Description |
|---|---|
clinicaltrials_search_studies | Searches for clinical studies using query terms, filters, pagination, and sorting. Includes geographic and enum-based filtering. |
clinicaltrials_get_study | Fetches one or more clinical studies by their NCT IDs, returning either full data or concise summaries. |
clinicaltrials_get_study_results | Fetches trial results data for completed studies — outcomes, adverse events, participant flow, and baseline characteristics. |
clinicaltrials_get_field_values | Discovers valid enum values for any API field with study counts, enabling informed query construction. |
clinicaltrials_analyze_trends | Performs statistical analysis on up to 5000 studies by status, country, sponsor, phase, year, month, study type, or intervention type. |
clinicaltrials_compare_studies | Side-by-side comparison of 2-5 clinical studies across eligibility, design, interventions, outcomes, and sponsors. |
clinicaltrials_find_eligible_studies | Matches patient profiles to eligible clinical trials, filtering by age, sex, conditions, and location. Returns studies sorted by proximity. |
clinicaltrials_search_studies
Search for clinical trials using free-text queries and filters.
- Full-text search plus specialized condition, intervention, and sponsor queries targeting specific API indexes
- Typed enum filters for study status and phase (single value or array)
- Geographic proximity filtering by coordinates and distance
- Advanced filtering with ClinicalTrials.gov's AREA[] syntax
- Pagination (up to 200 per page), sorting, and field selection
clinicaltrials_get_study
Fetch one or more clinical trials by NCT ID, with full data or concise summaries.
- Batch fetch up to 5 studies at once
- Full data includes protocol sections, results, adverse events, outcome measures, eligibility, and locations
- Partial success reporting when some studies in a batch fail
clinicaltrials_analyze_trends
Aggregate statistics across up to 5,000 studies by status, country, sponsor, phase, year, month, study type, or intervention type.
- Combine multiple analysis types in a single request
- Filter to focus on specific subsets
- Returns counts and top categories (percentages omitted for phase breakdowns, where multi-phase studies make the denominator ambiguous)
clinicaltrials_compare_studies
Compare 2-5 studies side-by-side across eligibility, design, interventions, outcomes, sponsors, and locations.
- Configurable comparison fields — compare everything or focus on specific aspects
- Handles partial failures if some studies can't be fetched
clinicaltrials_find_eligible_studies
Match a patient profile (age, sex, conditions, location) to eligible clinical trials.
- Hard filters on age, sex, healthy volunteer status, and country — ineligible studies are excluded entirely
- Condition token overlap used as a false-positive gate (studies with zero relevance to the patient's conditions are excluded)
- Results sorted by location proximity: city match → state match → country-only, then by number of nearby sites
- Returns a summary of why each study is a potential match
clinicaltrials_get_study_results
Fetch results data (outcomes, adverse events, participant flow, baseline characteristics) for completed studies.
- Section-level filtering — request only the sections you need
- Batch up to 5 studies per request
- Reports which studies lack results or failed to fetch
- Includes statistical analyses (p-values, methods) with outcome data
clinicaltrials_get_field_values
Look up valid enum values for any ClinicalTrials.gov API field, with study counts per value.
- Sorted by frequency
- Useful for exploring OverallStatus, Phase, InterventionType, StudyType, and other fields before constructing filters
Features
Built on mcp-ts-template:
- Declarative tool definitions — single file per tool, framework handles registration and validation
- Unified
McpErrorerror handling across all tools - Pluggable auth (
none,jwt,oauth) - Swappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2 - Structured logging (Pino) with optional OpenTelemetry tracing
- Typed DI container with
Token<T>phantom branding - Runs locally (stdio/HTTP) or on Cloudflare Workers from the same codebase
ClinicalTrials.gov-specific:
- Type-safe client for the ClinicalTrials.gov v2 API
- Tools for search, filtering, statistical aggregation, and patient matching
- Automatic cleaning and simplification of API responses for agent consumption
Getting started
Public Hosted Instance
A public instance is available at https://clinicaltrials.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"clinicaltrialsgov": {
"type": "streamable-http",
"url": "https://clinicaltrials.caseyjhand.com/mcp"
}
}
}
Self-Hosted / Local
Add the following to your MCP Client configuration file (e.g., cline_mcp_settings.json).
{
"mcpServers": {
"clinicaltrialsgov-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["clinicaltrialsgov-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or for Streamable HTTP:
MCP_TRANSPORT_TYPE=http
MCP_HTTP_PORT=3017
Prerequisites
- Bun v1.2.0 or higher.
Installation
- Clone the repository:
git clone https://github.com/cyanheads/clinicaltrialsgov-mcp-server.git
- Navigate into the directory:
cd clinicaltrialsgov-mcp-server
- Install dependencies:
bun install
Configuration
All configuration is centralized and validated at startup in src/config/index.ts. Key environment variables in your .env file include:
| Variable | Description | Default |
|---|---|---|
MCP_TRANSPORT_TYPE | The transport to use: stdio or http. | http |
MCP_HTTP_PORT | The port for the HTTP server. | 3017 |
MCP_AUTH_MODE | Authentication mode: none, jwt, or oauth. | none |
STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv, cloudflare-r2, cloudflare-d1. | in-memory |
OTEL_ENABLED | Set to true to enable OpenTelemetry. | false |
MCP_LOG_LEVEL | The minimum level for logging (RFC 5424: debug, info, notice, warning, error, crit, alert, emerg). | info |
MCP_AUTH_SECRET_KEY | ** |
README truncated. View full README on GitHub.
Alternatives
Related Skills
Browse all skillsConduct comprehensive, systematic literature reviews using multiple academic databases (PubMed, arXiv, bioRxiv, Semantic Scholar, etc.). This skill should be used when conducting systematic literature reviews, meta-analyses, research synthesis, or comprehensive literature searches across biomedical, scientific, and technical domains. Creates professionally formatted markdown documents and PDFs with verified citations in multiple citation styles (APA, Nature, Vancouver, etc.).
Comprehensive guide for PostgreSQL psql - the interactive terminal client for PostgreSQL. Use when connecting to PostgreSQL databases, executing queries, managing databases/tables, configuring connection options, formatting output, writing scripts, managing transactions, and using advanced psql features for database administration and development.
Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.
Advanced content and topic research skill that analyzes trends across Google Analytics, Google Trends, Substack, Medium, Reddit, LinkedIn, X, blogs, podcasts, and YouTube to generate data-driven article outlines based on user intent analysis
Expert data scientist for advanced analytics, machine learning, and statistical modeling. Handles complex data analysis, predictive modeling, and business intelligence. Use PROACTIVELY for data analysis tasks, ML modeling, statistical analysis, and data-driven insights.
Analyze Google Analytics data, review website performance metrics, identify traffic patterns, and suggest data-driven improvements. Use when the user asks about analytics, website metrics, traffic analysis, conversion rates, user behavior, or performance optimization.