mcp-server-for-doctoralliance

adrija26sg/mcp-server-for-doctoralliance

3.1

If you are the rightful owner of mcp-server-for-doctoralliance and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Healthcare-focused AI Agent Dashboard & MCP Server is designed to streamline AI-driven healthcare workflows, integrating various communication and AI technologies.

AgenticalDoctorAlliance

Healthcare-focused AI Agent Dashboard & MCP Server

This repository contains a Model-Context-Protocol (MCP) FastAPI server paired with a Streamlit dashboard, designed to orchestrate AI-driven healthcare workflows (appointment reminders, follow-up calls, billing updates). It integrates with:

  • Gemini/CrewAI for AI response generation
  • SendGrid (via Single Sender) for outbound email
  • Twilio (Test or Live) for outbound SMS
  • Gmail API for inbound email monitoring
  • ** WebSocket** for real-time popup notifications

Flowchart

Editor _ Mermaid Chart-2025-06-17-154257

Sequence Diagram

Editor _ Mermaid Chart-2025-06-16-192336

Repository Structure

adrija-crewai-agent/
ā”œā”€ā”€ .env.example       # Template for environment variables
ā”œā”€ā”€ requirements.txt   # Python dependencies
└── src/
    └── doctoralliance_agent/
        ā”œā”€ā”€ __init__.py
        ā”œā”€ā”€ server.py         # FastAPI MCP endpoints
        ā”œā”€ā”€ streamlit_app.py  # Streamlit UI
        ā”œā”€ā”€ crew.py           # Optional CrewAI kickoff script
        ā”œā”€ā”€ persona_resolver.py
        ā”œā”€ā”€ data_fetcher.py
        ā”œā”€ā”€ summary_builder.py
        ā”œā”€ā”€ vault.py
        ā”œā”€ā”€ agents/
        │   ā”œā”€ā”€ __init__.py
        │   ā”œā”€ā”€ prompt_builder.py
        │   └── gemini_agent.py
        ā”œā”€ā”€ delivery/
        │   ā”œā”€ā”€ __init__.py
        │   ā”œā”€ā”€ channel_selector.py
        │   ā”œā”€ā”€ email.py
        │   ā”œā”€ā”€ sms_gateway.py
        │   ā”œā”€ā”€ popup.py
        │   └── logger.py
        ā”œā”€ā”€ escalation/
        │   ā”œā”€ā”€ __init__.py
        │   ā”œā”€ā”€ reminder_scheduler.py
        │   └── retry_agent.py
        └── gmail/
            ā”œā”€ā”€ __init__.py
            ā”œā”€ā”€ gmail_agent.py
            ā”œā”€ā”€ nlp_parser.py
            └── response_handler.py

Quickstart

1. Clone the repo

git clone https://github.com/your-org/adrija-crewai-agent.git
cd mcp-server-for-doctoralliance

2. Environment Variables

Copy .env.example to .env and fill in your credentials:

# Windows PowerShell
Copy-Item .env.example .env
# Linux/macOS
cp .env.example .env

Edit .env:

FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000

# Gemini/CrewAI
GEMINI_API_KEY=sk-...

GEMINI_MODEL=gemini-2.0-flash-001


# SendGrid (Single Sender)
SENDGRID_API_KEY=SG-...
FROM_EMAIL=your_verified@domain.com

# Twilio (for SMS testing)
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TWILIO_FROM_NUMBER=+15005550006

# Gmail (optional)
GMAIL_CREDENTIALS_PATH=./credentials.json

# WebSocket (optional)
WS_URL=ws://localhost:6789

Place your credentials.json (Gmail OAuth) next to .env if using inbound email.

3. Install Dependencies

python -m venv venv
# Windows
venv\Scripts\Activate.ps1
# macOS/Linux
source venv/bin/activate

pip install --upgrade pip
pip install -r requirements.txt

4. Run the MCP Server

uvicorn doctoralliance_agent.server:app \
  --reload --host $FASTAPI_HOST --port $FASTAPI_PORT \
  --app-dir src

5. Launch the Streamlit UI

streamlit run src/doctoralliance_agent/streamlit_app.py

Visit http://localhost:8501 in your browser.


MCP Endpoints

  1. POST /mcp/retrieve

    • Body: { "event_type": "appointment_reminder" }
    • Response: { "persona": "...", "context": { ... } }
  2. POST /mcp/plan

    • Body: output of /retrieve
    • Response: { "persona": "...", "summary": "..." }
  3. POST /mcp/generate

    • Body: output of /plan
    • Response: { "persona": "...", "response": "..." }
  4. POST /mcp/respond

    • Body: { "event_type":"...", "response":"...", "context":{...} }
    • Response: delivery results JSON

Customization

  • Persona Resolver (persona_resolver.py): map events to personas
  • Vault (vault.py): stubbed EHR/Billing/HHA calls
  • Prompt Builder (agents/prompt_builder.py): persona-specific instructions
  • GeminiAgent (agents/gemini_agent.py): integrates with CrewAI/Gemini
  • Delivery Channels (delivery/): email, SMS, popup
  • Escalation (escalation/): retries and reminders
  • Gmail Listener (gmail/): parse inbound replies

Testing

  • Use Invoke-RestMethod in PowerShell for quick API tests
  • Use test_sms.py and test_email.py scripts for isolated channel testing