Intelligent Medical Assistant

Intelligent Medical Assistant

An MCP server and web application that enables natural language medical queries and patient data analysis powered by Gemini AI. It allows users to track and analyze patient biometrics, including vitals, sleep patterns, and laboratory results, through a comprehensive set of automated medical tools.

Category
Visit Server

README

๐Ÿฅ Intelligent Medical Assistant

A comprehensive Patient-Centric Medical Intelligence System that combines MCP (Model Context Protocol) server capabilities with an intelligent web interface. This system provides natural language medical queries, patient data analysis, and professional medical insights powered by Gemini AI.

โœจ Key Features

๐Ÿค– Intelligent Medical Assistant

  • Natural Language Processing - Ask questions like "What is Ben's sleep summary?"
  • Automatic Tool Routing - AI decides which patient data to access
  • Conversational Interface - Single input for all medical queries
  • Professional Medical Responses - Evidence-based information with disclaimers

๐Ÿ‘ฅ Patient Data Management

  • Real Patient Data - CSV-based patient records and biometrics
  • Comprehensive Tracking - Sleep patterns, vital signs, lab results, medications
  • Trend Analysis - Historical data analysis and insights
  • Multi-Patient Support - Manage multiple patient records

๐Ÿ”ง Dual Architecture

  • MCP Server - Integration with Kiro IDE and other MCP clients
  • Web Application - Professional web interface with authentication
  • RESTful API - Programmatic access to medical data and insights

๐Ÿ“Š Available Patient Data

  • Ben Smith (34M) - Hypertension, Type 2 Diabetes
    • 15 days of detailed sleep data (duration, quality, efficiency)
    • Vital signs tracking (BP, heart rate, glucose, weight)
  • Sarah Jones (28F) - Asthma
  • Mike Wilson (45M) - High Cholesterol

๐Ÿš€ Quick Start

1. Installation

# Clone and setup
git clone https://github.com/sp2learn/medical-mcp-server.git
cd medical-mcp-server

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Configuration

# Copy environment template
cp .env.example .env

# Edit .env with your API keys
MEDICAL_MODEL=gemini
GOOGLE_API_KEY=your_gemini_api_key_here
DISPLAY_TIMEZONE=America/New_York

3. Run the System

Web Application:

python web_app.py
# Visit: http://localhost:8000
# Login: demo/password, doctor/secret123, admin/admin2024

MCP Server:

python server.py
# For integration with Kiro IDE or other MCP clients

๐ŸŽฏ Usage Examples

Natural Language Queries

The intelligent assistant understands natural language and automatically routes to appropriate tools:

๐Ÿฉบ "What is Ben's sleep summary for the past week?"
โ†’ Analyzes sleep data, provides trends and insights

๐Ÿ“Š "Show me Ben's blood pressure trends"
โ†’ Reviews vital signs, identifies patterns

๐Ÿ’Š "What medications is Ben taking?"
โ†’ Lists current medications and adherence data

๐Ÿ” "What are the symptoms of diabetes?"
โ†’ Provides general medical information

๐Ÿ“ˆ "Compare Ben's glucose levels over time"
โ†’ Analyzes lab data and trends

MCP Integration

Add to your Kiro IDE configuration (.kiro/settings/mcp.json):

{
  "mcpServers": {
    "medical-query": {
      "command": "/path/to/medical-mcp-server/venv/bin/python",
      "args": ["/path/to/medical-mcp-server/server.py"],
      "disabled": false,
      "autoApprove": [
        "medical_query",
        "symptom_checker", 
        "get_patient_sleep_pattern",
        "get_patient_vitals",
        "get_patient_labs",
        "get_medication_adherence",
        "get_patient_activity",
        "get_patient_overview"
      ]
    }
  }
}

๐Ÿ› ๏ธ Available Tools

MCP Tools (8 total)

Tool Description Example Usage
medical_query General medical Q&A "What causes hypertension?"
symptom_checker Symptom analysis Analyze: headache, fever, fatigue
get_patient_sleep_pattern Sleep data analysis Ben's sleep for 30 days
get_patient_vitals Vital signs summary Ben's latest BP readings
get_patient_labs Laboratory results Ben's glucose trends
get_medication_adherence Medication compliance Ben's medication adherence
get_patient_activity Physical activity data Ben's activity levels
get_patient_overview Complete patient summary Ben's full medical profile

Tool Management

# List all tools and their status
python manage_tools.py list

# Show detailed tool information  
python manage_tools.py details get_patient_sleep_pattern

# Enable/disable tools
python manage_tools.py enable medical_query
python manage_tools.py disable symptom_checker

๐Ÿ“ Project Structure

medical-mcp-server/
โ”œโ”€โ”€ ๐Ÿค– Core Intelligence
โ”‚   โ”œโ”€โ”€ intelligent_medical_assistant.py  # Natural language processing
โ”‚   โ”œโ”€โ”€ medical_client.py                 # AI model integration
โ”‚   โ””โ”€โ”€ patient_data_manager.py           # Patient data management
โ”œโ”€โ”€ ๐ŸŒ Web Interface  
โ”‚   โ”œโ”€โ”€ web_app.py                        # FastAPI web application
โ”‚   โ”œโ”€โ”€ templates/                        # HTML templates
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard.html                # Main interface
โ”‚   โ”‚   โ”œโ”€โ”€ login.html                    # Authentication
โ”‚   โ”‚   โ””โ”€โ”€ base.html                     # Base template
โ”‚   โ””โ”€โ”€ static/                           # CSS, JavaScript, assets
โ”œโ”€โ”€ ๐Ÿ”ง MCP Server
โ”‚   โ”œโ”€โ”€ server.py                         # MCP protocol server
โ”‚   โ”œโ”€โ”€ tool_config.py                    # Centralized tool configuration
โ”‚   โ””โ”€โ”€ manage_tools.py                   # Tool management CLI
โ”œโ”€โ”€ ๐Ÿ“Š Patient Data
โ”‚   โ””โ”€โ”€ data/
โ”‚       โ”œโ”€โ”€ patients.csv                  # Patient demographics
โ”‚       โ”œโ”€โ”€ ben_sleep_data.csv            # Ben's sleep metrics
โ”‚       โ””โ”€โ”€ ben_vitals_data.csv           # Ben's vital signs
โ””โ”€โ”€ ๐Ÿš€ Deployment
    โ”œโ”€โ”€ Dockerfile                        # Container configuration
    โ”œโ”€โ”€ docker-compose.yml                # Multi-service setup
    โ””โ”€โ”€ render.yaml                       # Render deployment config

๐ŸŒ Deployment

Local Development

source venv/bin/activate
python web_app.py
# Access: http://localhost:8000

Cloud Deployment (Render)

  1. Push to GitHub
  2. Connect repository to Render
  3. Set environment variables:
    • MEDICAL_MODEL=gemini
    • GOOGLE_API_KEY=your_key
  4. Deploy automatically

Docker Deployment

# Build and run with Docker Compose
docker-compose up --build

# Or build manually
docker build -t medical-mcp-server .
docker run -p 8000:8000 --env-file .env medical-mcp-server

๐Ÿ” Authentication & Security

Web Interface

  • Session-based authentication with secure cookies
  • Role-based access (demo, doctor, admin accounts)
  • 24-hour session expiration
  • HTTPS ready for production deployment

Demo Accounts

Username Password Role Description
demo password Patient Basic demo access
doctor secret123 Healthcare Provider Full medical access
admin admin2024 Administrator System administration

๐Ÿ“ˆ Patient Data Format

Patient Demographics (patients.csv)

patient_id,first_name,last_name,age,gender,conditions,medications,last_visit
ben_smith,Ben,Smith,34,male,"hypertension,type_2_diabetes","metformin,lisinopril",2024-01-15

Sleep Data (ben_sleep_data.csv)

date,sleep_hours,bedtime,wake_time,sleep_quality,deep_sleep_minutes,rem_sleep_minutes
2024-09-14,7.2,22:30,05:42,good,85,92

Vital Signs (ben_vitals_data.csv)

date,systolic_bp,diastolic_bp,heart_rate,temperature_f,weight_kg,glucose_mg_dl
2024-09-14,142,88,72,98.6,78.2,156

๐Ÿงช Testing

# Test MCP server functionality
python test_server.py

# Test tool configuration
python manage_tools.py list

# Test web application
curl http://localhost:8000/health

# Run comprehensive tests
./run_tests.sh

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

  • Issues: GitHub Issues
  • Documentation: See individual module docstrings
  • Examples: Check the examples/ directory

โš ๏ธ Medical Disclaimer

This tool provides general medical information for educational and professional reference purposes only. It is not intended to be a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of qualified healthcare providers with any questions regarding medical conditions or treatment decisions.


Built with โค๏ธ for healthcare professionals and medical AI research

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured