ClinicalTrials MCP Server

by jackkuo666

Not rated
GitHub

About

Search and access clinical trial data from ClinicalTrials.gov.

Details

Author
jackkuo666
Categories
Search, Other, API
Tags
#research, #healthcare, #data-analysis, #web-research

Setup

Install ClinicalTrials MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/jackkuo666/ClinicalTrials-MCP-Server

Follow the installation instructions in the repository README, then restart your MCP client.

Search and access clinical trial data from ClinicalTrials.gov.

πŸ” 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.

- πŸ”Ž 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 βœ…

To install ClinicalTrials Server for Claude Desktop automatically viaSmithery:

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

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

npx -y @smithery/cli@latest run ClinicalTrials-mcp-server --client cursor --config "{}"
npx -y @smithery/cli@latest install ClinicalTrials-mcp-server --client windsurf --config "{}"
npx -y @smithery/cli@latest install ClinicalTrials-mcp-server --client cline --config "{}"
uv tool install ClinicalTrials-mcp-server
# 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

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

result = await mcp.use_tool("search_clinical_trials_and_save_studies_to_csv", { "search_expr": "COVID-19 vaccine efficacy", "max_studies": 5 }) print(result)
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

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

Example 4: Search and save studies with custom fields

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.

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.

- 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 detailed information about a specific clinical trial.

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

Returns:String representation of the study details

Get studies related to a specific keyword.

- 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

- condition(str, optional): Optional condition to filter by

Returns:String representation of the statistics

- 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

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

Returns:String representation of the CSV data

List all available CSV files in the current directory.

Returns:String representation of the available CSV files

The ClinicalTrials MCP Server also provides the following resources:

Get the corona fields data as a resource.

Get the full studies data as a resource.

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

Get studies related to a specific condition.

- condition(str): The condition to search for

Add this configuration to yourclaude_desktop_config.json:

{ "mcpServers": { "ClinicalTrials": { "command": "python", "args": ["-m", "ClinicalTrials-mcp-server"] } } }
{ "mcpServers": { "ClinicalTrials": { "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python311\\python.exe", "args": [ "-m", "ClinicalTrials-mcp-server" ] } } }
{ "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:

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

Can you search for recent clinical trials about diabetes?

The search will return basic information about matching trials including:

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

Can you show me the details for trial NCT04280705?

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

You can install the required dependencies using:

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

This project is licensed under the MIT License.

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

Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.

An AI-powered API for medical research, unifying ClinicalTrials.gov, PubMed, and FDA databases with intelligent analysis.

A server for searching, retrieving, and analyzing articles from the PubMed database.

This server allow you to ask questions with way more accurate nutrition facts.

About An MCP server that provides comprehensive medical information by querying multiple authoritative medical APIs including FDA, WHO, PubMed, Google Scholar, and RxNorm.

Pay-per-success public-data result packs for AI agents with free quotes, source URLs, confidence, timestamps, and receipt hashes.

An MCP (Model Context Protocol) server for searching and analyzing academic papers across multiple databases (Semantic Scholar, Crossref, OpenAlex, PubMed), with regex-powered filtering and statistical analysis.

Search scientific papers with structured experimental data extracted from full-text studies. Returns 25+ fields per paper including methods, results, sample sizes, limitations, and quality scores.

Query rich bird observation data from the eBird API using natural language.

Edama remote MCP effectively gives an AI the ability to "understand" food in the same way a nutritionist would, by translating natural language descriptions, images or barcodes into structured nutrition and food.

A search server for PubMed, the biomedical literature database, using a pure Node.js implementation.

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.