Uses OpenAI's GPT models to translate natural language queries into structured API parameters for ClinicalTrials.gov
MCP Server for ClinicalTrials.gov Natural Language API
This MCP (Model Control Protocol) server allows you to query ClinicalTrials.gov using natural language. It uses OpenAI's GPT models to translate your query into API parameters and returns structured results.
Features
Accepts natural language queries (e.g., "Show me completed phase 3 diabetes trials in Canada")
Uses OpenAI API to parse and map to ClinicalTrials.gov API parameters
Returns both the parsed parameters and the results
Related MCP server: AACT Clinical Trials MCP Server
Requirements
Python 3.8+
Dependencies in
requirements.txtOpenAI API key (set as
OPENAI_API_KEYenvironment variable)
Running the Server
Install dependencies:
pip install -r requirements.txtSet your OpenAI API key:
export OPENAI_API_KEY=sk-...Start the server:
uvicorn server:app --reload
Usage
cURL Example
Python Example
What is MCP?
MCP (Model Control Protocol) is a pattern for building AI-driven APIs that act as a control layer between natural language and structured APIs. This server uses an LLM to interpret user intent and map it to API calls, making complex data accessible via plain language.
Customization
You can modify the prompt or add more parameter schema in
server.pyto support more query types or APIs.
For questions or improvements, open an issue or PR!