- Home
- MCP servers
- ClinicalTrials NLP
ClinicalTrials NLP
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can query ClinicalTrials.gov with natural language through this MCP server. It uses a language model to translate your plain-English questions into API parameters and then returns both the parsed parameters and the resulting trials data in a structured format, making complex searches fast and approachable.
How to use
Start the MCP server locally and use a client to send natural language queries. Your client should send a plain text query to the server’s query endpoint, and you will receive a structured response that includes both the interpreted parameters and the matching ClinicalTrials.gov results.
How to install
# Prerequisites
- Python 3.8+
- Internet access
# Install dependencies
pip install -r requirements.txt
# Set your OpenAI API key
export OPENAI_API_KEY=sk-...
# Run the server
uvicorn server:app --reload
Additional considerations
Usage notes: you can submit natural language questions like “Show me completed phase 3 diabetes trials in Canada” and receive results that include the parsed API parameters and the corresponding trials data.
Security: protect your OpenAI API key and limit access to the local server. Do not expose the key in client-side code or logs.
Server connection example
POST http://127.0.0.1:8000/query
Content-Type: application/json
{"query": "Show me completed phase 3 diabetes trials in Canada"}
Notes on customization
You can adjust the prompt or add more parameter mappings in the server code to support additional APIs or query types. This enables you to tailor the natural language interface to your data needs.
Available tools
nl_to_params
Converts natural language queries into ClinicalTrials.gov API parameters using an LLM, returning a structured parameter map.
execute_ct_api
Calls the ClinicalTrials.gov API with the translated parameters and returns raw results.