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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。