Clinical Trials MCP Server

Clinical Trials MCP Server

Provides programmatic access to ClinicalTrials.gov API with 18 specialized tools for searching, analyzing, and retrieving detailed information about 400,000+ clinical trials worldwide, including filtering by condition, location, phase, sponsor, eligibility criteria, and outcomes.

Category
访问服务器

README

Logo

Clinical Trials MCP Server

A comprehensive Model Context Protocol (MCP) server that provides access to the ClinicalTrials.gov API, enabling researchers, clinicians, and developers to access real-time clinical trial data programmatically.

Developed by bachstudio

🚀 Quick Start with npx (Recommended)

No installation required! Use npx to run the server directly:

{
  "mcpServers": {
    "clinical-trials": {
      "command": "npx",
      "args": ["-y", "bach-clinical-trials"]
    }
  }
}

Save this configuration and restart your MCP client. The npx command will automatically download and run the latest version from npm.

Package URL: https://www.npmjs.com/package/bach-clinical-trials


Overview

The Clinical Trials MCP server exposes the full ClinicalTrials.gov API v2.0.4 functionality through 18 specialized MCP tools, allowing you to search, analyze, and retrieve detailed information about clinical trials worldwide directly from your MCP-enabled environment.

Features

Core Search Tools

  • search_studies - General search with comprehensive filters (condition, intervention, location, phase, status, age, sex)
  • get_study_details - Detailed study information by NCT ID with complete metadata
  • search_by_condition - Condition-focused search with eligibility criteria
  • search_by_location - Geographic-based search with distance radius filtering
  • search_by_sponsor - Organization and sponsor-based search with sponsor type filtering
  • search_by_intervention - Treatment, drug, and intervention-focused search

Specialized Search Tools

  • get_recruiting_studies - Currently recruiting trials with active contact information
  • search_by_date_range - Temporal search by study start and completion dates
  • get_studies_with_results - Completed trials with published results
  • search_rare_diseases - Specialized search for rare diseases and orphan conditions
  • get_pediatric_studies - Pediatric-specific trials for children and adolescents
  • search_international_studies - Multi-country international trials

Advanced Analysis Tools

  • get_similar_studies - Find studies similar to a reference NCT ID by condition, sponsor, or phase
  • search_by_primary_outcome - Search by primary outcome measures and endpoints
  • search_by_eligibility_criteria - Advanced eligibility filtering with inclusion/exclusion keywords
  • get_study_timeline - Timeline analysis with current, completed, and upcoming studies
  • get_trial_statistics - Aggregate statistics and analytics with grouping capabilities

Data Quality Features

  • Real-time data access (updated daily Monday-Friday)
  • NCT ID validation with regex patterns
  • Comprehensive JSON Schema validation
  • Geographic coordinate data for study locations
  • Contact information for recruiting studies
  • Robust error handling and timeout protection

Installation

Prerequisites

  • Node.js 16+ (install from nodejs.org)
  • No API key required (ClinicalTrials.gov API is publicly accessible)

Setup Steps

  1. Navigate to your MCP directory:

    cd ~/Documents/Claude/MCP  # or your preferred MCP directory
    
  2. The server is already built and configured:

    ls clinical-trials-server/
    # Should show: build/ src/ package.json tsconfig.json README.md
    
  3. Verify build:

    cd clinical-trials-server
    ls build/
    # Should show: index.js (executable)
    

Configuration

Add this to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "clinical-trials": {
      "command": "node",
      "args": ["path/to/clinical-trials-server/build/index.js"],
      "autoApprove": [
        "search_studies",
        "get_study_details",
        "search_by_condition",
        "search_by_location",
        "get_recruiting_studies",
        "search_by_sponsor",
        "search_by_intervention",
        "get_trial_statistics"
      ]
    }
  }
}

Note: Replace path/to/clinical-trials-server with the absolute path to your server directory.

Usage Examples

Search for Cancer Trials

{
  "condition": "cancer",
  "phase": "PHASE3",
  "status": "RECRUITING",
  "pageSize": 10
}

Get Detailed Study Information

{
  "nctId": "NCT05882279"
}

Find Trials by Location

{
  "country": "United States",
  "city": "Boston",
  "distance": 50,
  "pageSize": 5
}

Search for Pediatric Studies

{
  "condition": "diabetes",
  "ageRange": "CHILD",
  "recruitmentStatus": "RECRUITING"
}

Get Recruiting Trials with Contacts

{
  "condition": "alzheimer",
  "location": "California",
  "pageSize": 5
}

Find Similar Studies

{
  "nctId": "NCT12345678",
  "similarityType": "CONDITION",
  "pageSize": 10
}

Advanced Eligibility Search

{
  "minAge": "18 Years",
  "maxAge": "65 Years",
  "sex": "ALL",
  "healthyVolunteers": false,
  "condition": "hypertension",
  "inclusionKeywords": "medication",
  "exclusionKeywords": "pregnant"
}

Get Trial Statistics

{
  "groupBy": "phase",
  "filters": {
    "condition": "diabetes",
    "status": "RECRUITING"
  }
}

API Reference

Search Parameters

Common Parameters:

  • pageSize - Number of results (1-100, default: 10)
  • condition - Medical condition or disease
  • phase - Study phase: PHASE1, PHASE2, PHASE3, PHASE4, NA
  • status - Recruitment status: RECRUITING, NOT_YET_RECRUITING, COMPLETED, etc.

Location Parameters:

  • country - Country name
  • state - State or province
  • city - City name
  • distance - Search radius in miles (1-500)

Eligibility Parameters:

  • sex - ALL, FEMALE, MALE
  • age - CHILD, ADULT, OLDER_ADULT
  • minAge/maxAge - Age ranges (e.g., "18 Years", "65 Years")
  • healthyVolunteers - Boolean for healthy volunteer acceptance

Date Parameters:

  • startDateFrom/startDateTo - Study start date range (YYYY-MM-DD)
  • completionDateFrom/completionDateTo - Completion date range (YYYY-MM-DD)

Response Format

All tools return structured JSON data including:

  • Study metadata (NCT ID, title, status, phase, sponsor)
  • Location information with geographic coordinates
  • Eligibility criteria and contact information
  • Timeline data and key dates
  • Comprehensive search criteria documentation

NCT ID Format

All NCT IDs must follow the pattern: NCT######## (NCT followed by 8 digits)

Error Handling

The server includes comprehensive error handling for:

  • Network Issues: 30-second timeout protection with retry logic
  • Invalid Parameters: JSON Schema validation with descriptive error messages
  • API Errors: Proper HTTP status code handling and error reporting
  • Missing Data: Graceful handling of optional fields and missing information
  • Rate Limiting: Built-in request throttling and error recovery

Common error responses include:

{
  "error": "Clinical Trials API error: Invalid NCT ID format",
  "isError": true
}

Development

Building from Source

# Install dependencies
npm install

# Build TypeScript to JavaScript
npm run build

# Development with watch mode
npm run watch

Project Structure

clinical-trials-server/
├── src/
│   └── index.ts          # Main server implementation (all tools)
├── build/
│   └── index.js          # Compiled executable
├── package.json          # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
└── README.md            # This file

Key Dependencies

  • @modelcontextprotocol/sdk - MCP server framework
  • axios - HTTP client for API requests
  • TypeScript for type safety and development

Data Sources

API Endpoint: https://clinicaltrials.gov/api/v2 Data Updates: Monday through Friday (excluding federal holidays) Coverage: 400,000+ studies from 220+ countries Data Quality: Official FDA/NIH registry with verified information

Troubleshooting

  1. Server Connection Issues:

    # Test server manually
    cd clinical-trials-server
    node build/index.js
    # Should show: "Clinical Trials MCP server running on stdio"
    
  2. Invalid NCT ID Errors:

    • Ensure NCT IDs follow format: NCT########
    • Example: NCT05882279 ✓, nct123 ✗
  3. No Results Returned:

    • Check search criteria - try broader terms
    • Some filters may be too restrictive
    • Verify spelling of conditions and interventions
  4. Timeout Issues:

    • Server has 30-second timeout protection
    • Large result sets may take time to process
    • Reduce pageSize for faster responses

Clinical Research Use Cases

  • Patient Recruitment: Find actively recruiting trials for specific conditions
  • Competitive Analysis: Research similar studies by sponsors or interventions
  • Site Selection: Identify optimal locations for new studies
  • Regulatory Research: Access FDA-approved study protocols and outcomes
  • Academic Research: Analyze clinical trial trends and statistics
  • Patient Care: Help patients find appropriate treatment options

Compliance & Ethics

This server provides access to publicly available clinical trial data from ClinicalTrials.gov. Users should:

  • Follow institutional policies for clinical research
  • Respect patient privacy and confidentiality
  • Use data for legitimate research and healthcare purposes
  • Cite ClinicalTrials.gov as the data source in publications

License

MIT License - See LICENSE file for details


Data Source: ClinicalTrials.gov (https://clinicaltrials.gov) API Documentation: https://clinicaltrials.gov/data-api/api Server Version: 1.0.0 Repository: https://github.com/BACH-AI-Tools/ClinicalTrials-MCP-Server

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选