medical-mcp-agent
Provides medical symptom extraction, differential diagnosis generation, PubMed literature search, and abstract summarization tools for LLM agents.
README
medical-mcp-agent
Overview ๐ฉบ
medical-mcp-agent is a Python-based AI-powered medical assistant prototype that combines Groq's Llama-3.3-70b model, real-time PubMed literature search, and a Model Context Protocol (MCP) server.
It provides three interfaces:
- FastAPI REST API backend for structured diagnostic JSON responses
- Streamlit web dashboard for an interactive dark-themed clinical assistant experience
- FastMCP server exposing medical tools to LLM clients
This repository is designed for clinical decision support research and prototyping, not for actual medical diagnosis.
Table of Contents ๐
- Features
- Tech Stack
- Project Structure
- Installation
- Usage
- MCP Tools
- Environment Variables
- Example API Request
- Disclaimer
Features โจ
- Extracts medical symptoms from natural language patient descriptions using AI
- Generates ranked differential diagnoses, home remedies, treatments, and red-flag warnings
- Searches and fetches real research articles from the NCBI PubMed database
- Summarizes medical research abstracts into concise 3-4 line insights using AI
- Beautiful dark-themed Streamlit dashboard with symptom tags, expandable article cards, and emergency warning banners
- FastAPI REST endpoint:
POST /diagnosis - MCP server with four callable tools for LLM agents
Tech Stack ๐ง
- Python 3.12
- Groq API with
Llama-3.3-70b-versatile - FastAPI + Uvicorn for REST backend
- Streamlit for web UI
- FastMCP for MCP server framework
- NCBI PubMed Entrez API for medical literature search
- BeautifulSoup4 + lxml for HTML/XML parsing
uvas the Python package manager
Project Structure ๐๏ธ
medical-mcp-agent/
โโโ src/
โ โโโ core/
โ โ โโโ config.py # Groq client setup
โ โ โโโ symptom_extractor.py # AI symptom extraction
โ โ โโโ diagnosis_symptoms.py # AI diagnosis generation
โ โ โโโ pubmed_articles.py # PubMed search and fetch
โ โ โโโ summarize_pubmed.py # AI abstract summarization
โ โโโ app/
โ โ โโโ api.py # FastAPI backend
โ โ โโโ streamlit.py # Streamlit web dashboard
โ โโโ mcp/
โ โโโ server.py # FastMCP MCP server
โโโ .env # API keys
โโโ pyproject.toml # Project dependencies
โโโ requirements.txt
Installation โ๏ธ
- Clone the repository:
git clone https://github.com/your-username/medical-mcp-agent.git
cd medical-mcp-agent
- Create a
.envfile in the project root with your Groq API key:
GROQ_API_KEY=your_key_here
- Install dependencies with
uv:
uv sync
Always prefix commands with
PYTHONPATH=.when running from the project root.
Usage ๐
Run FastAPI
Start the REST backend using the repository root:
PYTHONPATH=. python src/app/api.py
The API exposes:
POST /diagnosis
Run Streamlit
Open the Streamlit dashboard with:
PYTHONPATH=. uv run streamlit run src/app/streamlit.py
Run MCP Server
Launch the MCP server for LLM integrations:
PYTHONPATH=. uv run fastmcp dev inspector src/mcp/server.py
MCP Tools ๐งฉ
The MCP server exposes the following callable tools:
extract_patient_symptomsโ Extracts symptoms from natural language textgenerate_differential_diagnosisโ Generates diagnoses from a list of symptomssearch_pubmed_literatureโ Searches NCBI PubMed and returns article metadatasynthesize_medical_abstractsโ Summarizes medical research abstracts
These tools allow LLM clients to request structured medical assistance through MCP-aware workflows.
Environment Variables ๐
Create a .env file and add the following variable:
GROQ_API_KEY=your_key_here
The Groq API key is required for all AI-powered operations.
Example API Request ๐งช
Send a patient description to the FastAPI endpoint:
curl -X POST http://127.0.0.1:8000/diagnosis \
-H "Content-Type: application/json" \
-d '{"patient_description": "36-year-old female with fever, cough, and chest pain."}'
The response returns structured JSON with symptoms, differential diagnosis, treatments, and alerts.
Notes ๐
- The Streamlit dashboard includes symptom tags, article cards, and warning banners for urgent issues.
- The PubMed integration searches the NCBI Entrez API and parses results with BeautifulSoup.
- The MCP server supports integration with external LLM agents and tool-based workflows.
Disclaimer โ ๏ธ
This repository is a clinical decision support prototype and NOT a replacement for professional medical advice.
Use this project for experimentation, research, and learning only. Always consult a licensed healthcare professional for real medical decisions.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.