MCP Clinical Research Server
MCP Clinical Research Server
This project exposes an MCP server that can:
search ClinicalTrials.gov for studies by condition or keyword
fetch the latest stock price for a company ticker from Yahoo Finance
Local setup
Create a virtual environment if you want one.
Install dependencies:
python -m pip install -e .
Set your PAT and the server endpoint:
export MCP_PAT="your_personal_access_token" export MCP_ACCESS_URL="http://localhost:8000/mcp" export MCP_HOST="0.0.0.0" export MCP_PORT="8000"
Start the server:
python -m mcp_clinical.server
or:
mcp-clinical
Access pattern
Your MCP client should connect to:
Auth header: Authorization: Bearer
The server expects the same token in the MCP_PAT environment variable when it starts.
Available tools
server_access_info()clinical_trials_search(condition, max_results=5)get_company_price(ticker, range_name="1d")
Example calls
ClinicalTrials.gov
condition: "breast cancer"
max_results: 5
Market ticker
ticker: "AAPL"
range_name: "1d"
Public EC2 deployment
The safest public setup is:
EC2 instance with a public IP or Elastic IP
security group allowing
22,80, and443inboundNGINX listening on
80/443and proxying to the MCP app on127.0.0.1:8000systemdservice running the Python app withMCP_PATset via a.envfileGitHub Actions on pushes to
mainthat SSHs into the instance and redeploys the app
EC2 setup
Launch an Ubuntu or Amazon Linux 2023 EC2 instance.
Open inbound ports:
22for SSH80for HTTP443for HTTPS
Install nginx and Python dependencies on the EC2 VM:
sudo apt-get update
sudo apt-get install -y python3 python3-venv python3-pip git nginxClone the repo:
cd /home/ubuntu
git clone git@github.com:Harshahi/ClinicalMCP.git
cd ClinicalMCP
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .
cp .env.example .envUpdate
.envwith a real PAT and your public URL:
MCP_PAT=your-real-pat
MCP_ACCESS_URL=https://your-domain.example.com/mcp
MCP_PUBLIC_URL=https://your-domain.example.com
MCP_HOST=0.0.0.0
MCP_PORT=8000Configure NGINX to proxy traffic:
sudo tee /etc/nginx/conf.d/clinicalmcp.conf <<'EOF'
server {
listen 80;
server_name your-domain.example.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
EOF
sudo nginx -t
sudo systemctl enable --now nginxCreate a
systemdservice:
sudo tee /etc/systemd/system/clinicalmcp.service <<'EOF'
[Unit]
Description=ClinicalMCP Server
After=network.target
[Service]
WorkingDirectory=/home/ubuntu/ClinicalMCP
EnvironmentFile=/home/ubuntu/ClinicalMCP/.env
ExecStart=/home/ubuntu/ClinicalMCP/.venv/bin/python -m mcp_clinical.server
Restart=always
RestartSec=5
User=ubuntu
Group=ubuntu
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now clinicalmcp.service
sudo systemctl status clinicalmcp.service --no-pagerGitHub Actions deployment to EC2
Add the following repository secrets in GitHub:
EC2_HOSTEC2_USEREC2_SSH_KEYMCP_PATMCP_PUBLIC_URL
Example workflow:
name: deploy-to-ec2
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Deploy to EC2
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
set -e
cd /home/ubuntu/ClinicalMCP || git clone git@github.com:Harshahi/ClinicalMCP.git /home/ubuntu/ClinicalMCP
cd /home/ubuntu/ClinicalMCP
git pull origin main
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .
cat > .env <<EOF
MCP_PAT=${{ secrets.MCP_PAT }}
MCP_ACCESS_URL=${{ secrets.MCP_PUBLIC_URL }}/mcp
MCP_PUBLIC_URL=${{ secrets.MCP_PUBLIC_URL }}
MCP_HOST=0.0.0.0
MCP_PORT=8000
EOF
sudo cp infra/clinicalmcp.service /etc/systemd/system/clinicalmcp.service
sudo systemctl daemon-reload
sudo systemctl restart clinicalmcp.service
sudo systemctl reload nginx || trueNotes
Use a public DNS name with HTTPS in front of the EC2 instance if you want a stable public URL.
If you want to terminate TLS at the EC2 load balancer or NGINX layer, install Certbot and configure
443with Let’s Encrypt.Keep the PAT in GitHub secrets and never commit it to source control.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Harshahi/ClinicalMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server