trackmcp
Back to directory
JackKuo666

clinicaltrials-mcp-server

View on GitHub

๐Ÿ” Enable AI assistants to search and access ClinicalTrials.gov data through a simple MCP interface.

13 stars PythonSearch & Data Retrieval Updated Sep 2, 2025

Documentation

ClinicalTrials MCP Server

smithery badge

๐Ÿ” Enable AI assistants to search and access ClinicalTrials.gov data through a simple MCP interface.

The ClinicalTrials MCP Server provides a bridge between AI assistants and ClinicalTrials.gov's clinical trial repository through the Model Context Protocol (MCP). It allows AI models to search for clinical trials and access their content in a programmatic way.

๐Ÿค Contribute โ€ข ๐Ÿ“ Report Bug

โœจ Core Features

  • ๐Ÿ”Ž Trial Search: Query clinical trials with custom search strings or advanced search parameters โœ…
  • ๐Ÿš€ Efficient Retrieval: Fast access to trial metadata โœ…
  • ๐Ÿ“Š Metadata Access: Retrieve detailed metadata for specific trials using NCT ID โœ…
  • ๐Ÿ“Š Research Support: Facilitate health sciences research and analysis โœ…
  • ๐Ÿ“‹ CSV Management: Save, load, and list CSV files with trial data โœ…
  • ๐Ÿ—ƒ๏ธ Local Storage: Trials are saved locally for faster access โœ…
  • ๐Ÿ“Š Statistics: Get statistics about clinical trials โœ…

๐Ÿš€ Quick Start

Installing via Smithery

To install ClinicalTrials Server for Claude Desktop automatically via Smithery:

Claude

bash
npx -y @smithery/cli@latest install ClinicalTrials-mcp-server --client claude --config "{}"

Cursor

Paste the following into Settings โ†’ Cursor Settings โ†’ MCP โ†’ Add new server:

  • Mac/Linux
s
npx -y @smithery/cli@latest run ClinicalTrials-mcp-server --client cursor --config "{}"

Windsurf

sh
npx -y @smithery/cli@latest install ClinicalTrials-mcp-server --client windsurf --config "{}"

CLine

sh
npx -y @smithery/cli@latest install ClinicalTrials-mcp-server --client cline --config "{}"

Installing Manually

Install using uv:

bash
uv tool install ClinicalTrials-mcp-server

For development:

bash
# Clone and set up development environment
git clone https://github.com/JackKuo666/ClinicalTrials-MCP-Server.git
cd ClinicalTrials-MCP-Server

# Create and activate virtual environment
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt

๐Ÿ“Š Usage

Start the MCP server:

bash
python clinical_trials_server.py

Once the server is running, you can use the provided MCP tools in your AI assistant or application. Here are some examples of how to use the tools:

Example 1: Search for clinical trials using a search expression and save to CSV

python
result = await mcp.use_tool("search_clinical_trials_and_save_studies_to_csv", {
    "search_expr": "COVID-19 vaccine efficacy",
    "max_studies": 5
})
print(result)

Example 2: Get studies by keyword

python
result = await mcp.use_tool("get_studies_by_keyword", {
    "keyword": "diabetes",
    "max_studies": 10
})
print(result)

Example 3: Get full study details for a specific trial

python
result = await mcp.use_tool("get_full_study_details", {
    "nct_id": "NCT04280705"
})
print(result)

Example 4: Search and save studies with custom fields

python
result = await mcp.use_tool("search_clinical_trials_and_save_studies_to_csv", {
    "search_expr": "alzheimer",
    "max_studies": 20,
    "filename": "alzheimer_studies.csv",
    "fields": ["NCT Number", "Study Title", "Brief Summary", "Conditions"]
})
print(result)

These examples demonstrate how to use the main tools provided by the ClinicalTrials MCP Server. Adjust the parameters as needed for your specific use case.

๐Ÿ›  MCP Tools

The ClinicalTrials MCP Server provides the following tools:

search_clinical_trials_and_save_studies_to_csv

Search for clinical trials using a search expression and save the results to a CSV file.

Parameters:

  • `search_expr` (str): Search expression (e.g., "Coronavirus+COVID")
  • `max_studies` (int, optional): Maximum number of studies to return (default: 10)
  • `save_csv` (bool, optional): Whether to save the results as a CSV file (default: True)
  • `filename` (str, optional): Name of the CSV file to save (default: corona_fields.csv)
  • `fields` (list, optional): List of fields to include (default: NCT Number, Conditions, Study Title, Brief Summary)

Returns: String representation of the search results

get_full_study_details

Get detailed information about a specific clinical trial.

Parameters:

  • `nct_id` (str): The NCT ID of the clinical trial

Returns: String representation of the study details

get_studies_by_keyword

Get studies related to a specific keyword.

Parameters:

  • `keyword` (str): Keyword to search for
  • `max_studies` (int, optional): Maximum number of studies to return (default: 20)
  • `save_csv` (bool, optional): Whether to save the results as a CSV file (default: True)
  • `filename` (str, optional): Name of the CSV file to save (default: keyword_results_{keyword}.csv)

Returns: String representation of the studies

get_study_statistics

Get statistics about clinical trials.

Parameters:

  • `condition` (str, optional): Optional condition to filter by

Returns: String representation of the statistics

get_full_studies_and_save

Get full studies data and save to CSV.

Parameters:

  • `search_expr` (str): Search expression (e.g., "Coronavirus+COVID")
  • `max_studies` (int, optional): Maximum number of studies to return (default: 20)
  • `filename` (str, optional): Name of the CSV file to save (default: full_studies.csv)

Returns: Message indicating the results were saved

load_csv_data

Load and display data from a CSV file.

Parameters:

  • `filename` (str): Name of the CSV file to load

Returns: String representation of the CSV data

list_saved_csv_files

List all available CSV files in the current directory.

Returns: String representation of the available CSV files

๐Ÿ” MCP Resources

The ClinicalTrials MCP Server also provides the following resources:

clinicaltrials://corona_fields

Get the corona fields data as a resource.

clinicaltrials://full_studies

Get the full studies data as a resource.

clinicaltrials://csv/{filename}

Get data from a specific CSV file.

Parameters:

  • `filename` (str): Name of the CSV file

clinicaltrials://available_files

Get a list of all available CSV files.

clinicaltrials://study/{nct_id}

Get a specific study by NCT ID.

Parameters:

  • `nct_id` (str): The NCT ID of the clinical trial

clinicaltrials://condition/{condition}

Get studies related to a specific condition.

Parameters:

  • `condition` (str): The condition to search for

Usage with Claude Desktop

Add this configuration to your `claude_desktop_config.json`:

(Mac OS)

json
{
  "mcpServers": {
    "ClinicalTrials": {
      "command": "python",
      "args": ["-m", "ClinicalTrials-mcp-server"]
      }
  }
}

(Windows version):

json
{
  "mcpServers": {
    "ClinicalTrials": {
      "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python311\\python.exe",
      "args": [
        "-m",
        "ClinicalTrials-mcp-server"
      ]
    }
  }
}

Using with Cline

json
{
  "mcpServers": {
    "ClinicalTrials": {
      "command": "bash",
      "args": [
        "-c",
        "source /home/YOUR/PATH/ClinicalTrials-MCP-Server/.venv/bin/activate && python /home/YOUR/PATH/ClinicalTrials-MCP-Server/clinical_trials_server.py"
      ],
      "env": {},
      "disabled": false,
      "autoApprove": []
    }
  }
}

After restarting Claude Desktop, the following capabilities will be available:

Searching Clinical Trials

You can ask Claude to search for clinical trials using queries like:

code
Can you search for recent clinical trials about diabetes?

The search will return basic information about matching trials including:

โ€ข Trial title

โ€ข NCT Number

โ€ข Conditions

โ€ข Brief Summary

Getting Trial Details

Once you have an NCT ID, you can ask for more details:

code
Can you show me the details for trial NCT04280705?

This will return:

โ€ข Full trial title

โ€ข Conditions

โ€ข Brief Summary

โ€ข Other available details

๐Ÿ“ Project Structure

  • `clinical_trials_server.py`: The main MCP server implementation using FastMCP
  • `clinical_trials.py`: Contains helper functions for interacting with the ClinicalTrials.gov API

๐Ÿ”ง Dependencies

  • Python 3.10+
  • FastMCP
  • pytrials
  • pandas

You can install the required dependencies using:

bash
pip install FastMCP pytrials pandas

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.

โš ๏ธ Disclaimer

This tool is for research purposes only. Please respect ClinicalTrials.gov's terms of service and use this tool responsibly.

Frequently asked questions

What is clinicaltrials-mcp-server?

clinicaltrials-mcp-server is ๐Ÿ” Enable AI assistants to search and access ClinicalTrials.gov data through a simple MCP interface.

How do I install clinicaltrials-mcp-server?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is clinicaltrials-mcp-server open source?

Yes โ€” it is hosted on GitHub at https://github.com/JackKuo666/ClinicalTrials-MCP-Server and has 13 stars.

Related MCP tools

All-Hands-AIopenhands

๐Ÿ™Œ OpenHands: Code Less, Make More for the Model Context Protocol. Enhance AI assistants with powerful integrations. Python-based implementation.

64,677 Python
agentartificial-intelligencechatgpt+6
mem0aimem0

Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.

42,646 Python
agentsaiai-agents+12
zhayujiechatgpt-on-wechat

ๅŸบไบŽๅคงๆจกๅž‹ๆญๅปบ็š„่Šๅคฉๆœบๅ™จไบบ๏ผŒๅŒๆ—ถๆ”ฏๆŒ ๅพฎไฟกๅ…ฌไผ—ๅทใ€ไผไธšๅพฎไฟกๅบ”็”จใ€้ฃžไนฆใ€้’‰้’‰ ็ญ‰ๆŽฅๅ…ฅ๏ผŒๅฏ้€‰ๆ‹ฉChatGPT/Claude/DeepSeek/ๆ–‡ๅฟƒไธ€่จ€/่ฎฏ้ฃžๆ˜Ÿ็ซ/้€šไน‰ๅƒ้—ฎ/ Gemini/GLM-4/Kimi/LinkAI๏ผŒ่ƒฝๅค„็†ๆ–‡ๆœฌใ€่ฏญ้Ÿณๅ’Œๅ›พ็‰‡๏ผŒ่ฎฟ้—ฎๆ“ไฝœ็ณป็ปŸๅ’Œไบ’่”็ฝ‘๏ผŒๆ”ฏๆŒๅŸบไบŽ่‡ชๆœ‰็Ÿฅ่ฏ†ๅบ“่ฟ›่กŒๅฎšๅˆถไผไธšๆ™บ่ƒฝๅฎขๆœใ€‚

39,573 Python
aiai-agentchatgpt+17
assafelovicgpt-researcher

An LLM agent that conducts deep research (local and web) on any given topic and generates a long report with citations. Built for the Model Context Protocol to

24,026 Python
agentaiautomation+8
jlowinfastmcp

๐Ÿš€ The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.

19,927 Python
agentsfastmcpllms+6
1Panel-devmaxkb

๐Ÿ”ฅ MaxKB is an open-source platform for building enterprise-grade agents. MaxKB ๆ˜ฏๅผบๅคงๆ˜“็”จ็š„ๅผ€ๆบไผไธš็บงๆ™บ่ƒฝไฝ“ๅนณๅฐใ€‚ for the Model Context Protocol. Enhance AI assistants with po

19,062 Python
agentagentic-aichatbot+11

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP