ClinicalTrials.gov MCP Server

ClinicalTrials.gov MCP Server

Enables searching and retrieving information from the ClinicalTrials.gov database of over 400,000 clinical studies, including trial details, eligibility criteria, locations, and results across 220+ countries.

Category
Visit Server

README

ClinicalTrials.gov MCP Server

A Model Context Protocol (MCP) server that provides access to the ClinicalTrials.gov database, enabling Claude and other AI assistants to search and retrieve information about clinical trials.

Overview

This MCP server implements the ClinicalTrials.gov API v2, providing comprehensive access to information about clinical studies registered in the United States and internationally. The database contains over 400,000 clinical trials from 220+ countries.

Features

  • Comprehensive Search: Search clinical trials by:

    • Medical conditions/diseases
    • Interventions/treatments
    • Sponsors and investigators
    • Geographic location
    • Study status (recruiting, completed, etc.)
    • NCT identifiers
  • Detailed Study Information: Retrieve complete study records including:

    • Protocol information
    • Eligibility criteria
    • Intervention details
    • Outcome measures
    • Contact information and locations
    • Study design and methodology
    • Results (when available)
  • Aggregate Statistics: Get summary statistics and trends across clinical trials

Installation

Prerequisites

  • Python 3.10 or higher
  • pip

Install from source

# Clone or download the server files
git clone <repository-url>
cd clinicaltrials-mcp-server

# Install dependencies
pip install -r requirements.txt

# Or install the package
pip install -e .

Configuration

For Claude Desktop

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "clinicaltrials": {
      "command": "python",
      "args": ["/path/to/clinicaltrials_mcp_server.py"]
    }
  }
}

For other MCP clients

Use the stdio transport to connect:

import asyncio
from mcp.client.stdio import stdio_client

async def main():
    async with stdio_client(
        server_params={
            "command": "python",
            "args": ["/path/to/clinicaltrials_mcp_server.py"]
        }
    ) as (read, write):
        # Use the client
        pass

asyncio.run(main())

Tools

1. search_clinical_trials

Search for clinical trials using various criteria.

Parameters:

  • query_cond (string): Search by condition/disease (e.g., "Depression", "Breast Cancer")
  • query_term (string): General keyword search across all fields
  • query_intr (string): Search by intervention/treatment (e.g., "Pembrolizumab", "CBT")
  • query_titles (string): Search in study titles
  • query_outc (string): Search in outcome measures
  • query_spons (string): Search by sponsor name
  • query_lead (string): Search by lead sponsor
  • query_id (string): Search by NCT ID
  • query_patient (string): Search using patient-friendly language
  • query_locn (string): Search by location (e.g., "New York", "Mayo Clinic")
  • filter_overallStatus (array): Filter by recruitment status
    • Valid values: RECRUITING, NOT_YET_RECRUITING, ACTIVE_NOT_RECRUITING, COMPLETED, SUSPENDED, TERMINATED, WITHDRAWN, ENROLLING_BY_INVITATION, AVAILABLE, NO_LONGER_AVAILABLE, APPROVED_FOR_MARKETING, WITHHELD, TEMPORARILY_NOT_AVAILABLE
  • filter_geo (string): Geographic filter (e.g., "distance(40.7,-74,50mi)")
  • filter_advanced (string): Advanced filter expression
  • page_size (integer): Results per page (default 20, max 1000)
  • page_token (string): Token for pagination
  • count_total (boolean): Include total count of results
  • sort (array): Sort order (e.g., ["@relevance"])

Example Usage:

Search for recruiting clinical trials about depression with cognitive behavioral therapy:
- query_cond: "Depression"
- query_intr: "Cognitive Behavioral Therapy"
- filter_overallStatus: ["RECRUITING"]

2. get_clinical_trial

Retrieve detailed information about a specific clinical trial by its NCT ID.

Parameters:

  • nct_id (string, required): The NCT ID of the study (e.g., "NCT04267848")
  • fields (array, optional): Specific fields to return (returns all if not specified)

Example Usage:

Get details for study NCT04267848:
- nct_id: "NCT04267848"

3. get_trial_statistics

Get aggregate statistics about clinical trials.

Parameters:

  • filter_overallStatus (array): Filter statistics by recruitment status
  • filter_geo (string): Geographic filter for statistics
  • agg_filters (string): Aggregation filter expression

Example Usage:

Get statistics on recruiting trials:
- filter_overallStatus: ["RECRUITING"]

Common Use Cases

1. Finding trials for a specific condition

Use search_clinical_trials with:
- query_cond: "Type 2 Diabetes"
- filter_overallStatus: ["RECRUITING"]
- page_size: 50

2. Finding trials by a specific sponsor

Use search_clinical_trials with:
- query_spons: "National Institute of Mental Health"
- filter_overallStatus: ["RECRUITING", "ACTIVE_NOT_RECRUITING"]

3. Finding trials in a specific location

Use search_clinical_trials with:
- query_cond: "Alzheimer's Disease"
- query_locn: "Stanford"

4. Finding trials with specific interventions

Use search_clinical_trials with:
- query_intr: "Pembrolizumab"
- query_cond: "Melanoma"

5. Getting detailed information about a trial

First search to find NCT IDs, then use get_clinical_trial:
- nct_id: "NCT04267848"

API Details

This server uses the ClinicalTrials.gov API v2, which is a REST API with OpenAPI 3.0 specification.

Base URL: https://clinicaltrials.gov/api/v2

Key Endpoints:

  • /studies - Search and list studies
  • /studies/{nctId} - Get specific study details
  • /stats - Get aggregate statistics

Rate Limits: The API does not publish specific rate limits, but reasonable use is expected. The server implements timeout handling (30 seconds per request).

Data Structure

Study records contain multiple modules:

  • protocolSection: Core study information

    • identificationModule: NCT ID, title, org info
    • statusModule: Recruitment status, dates
    • descriptionModule: Brief and detailed descriptions
    • conditionsModule: Conditions being studied
    • designModule: Study design details
    • armsInterventionsModule: Study arms and interventions
    • outcomesModule: Primary and secondary outcomes
    • eligibilityModule: Inclusion/exclusion criteria
    • contactsLocationsModule: Contact info and study sites
    • referencesModule: Related publications
  • resultsSection: Study results (when available)

  • derivedSection: Computed/derived information

  • documentSection: Supporting documents

Troubleshooting

Connection Issues

If you encounter connection errors:

  1. Verify internet connectivity
  2. Check that the ClinicalTrials.gov API is accessible
  3. Review proxy settings if behind a corporate firewall

No Results Found

If searches return no results:

  1. Try broader search terms
  2. Remove filters to see all results
  3. Check spelling of medical terms
  4. Try alternative terminology (e.g., "MI" vs "Myocardial Infarction")

Pagination

For large result sets:

  1. Use page_size to control results per page (max 1000)
  2. Use page_token from response to fetch next page
  3. Set count_total: true to see total matching studies

References

License

This MCP server is provided as-is for accessing public data from ClinicalTrials.gov. Users must comply with ClinicalTrials.gov Terms and Conditions.

Support

For issues with:

  • This MCP server: Create an issue in the repository
  • ClinicalTrials.gov API: Contact register@clinicaltrials.gov
  • Study data questions: Contact the study sponsor or principal investigator

Version History

1.0.0 (2025-12-02)

  • Initial release
  • Support for ClinicalTrials.gov API v2
  • Search, retrieve, and statistics tools
  • Comprehensive field support
  • Pagination support

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured