Spaces:
Running
title: 'MediAgent AI: Conversational Health Navigator & MCP Tool Server'
emoji: ๐งฌ
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.33.1
app_file: app.py
pinned: false
secrets:
- MODAL_BACKEND_URL
tags:
- mcp-server-track
- agent-demo-track
๐งฌ MediAgent AI: Conversational Health Navigator & MCP Tool Server
โก๏ธ Try the Live Demo Here!
Powered by Modal and LlamaIndex. Special thanks for their support!
MediAgent AI is a sophisticated, conversational health assistant and a fully MCP-compliant tool server, built on Modal and Gradio. It provides reliable, sourced, and role-adapted answers to a wide range of medical questions.
This project is a submission for the Gradio Agents & MCP Hackathon 2025, competing in two tracks:
- ๐ง MCP Tool / Server Track: Our backend exposes a robust, MCP-compliant endpoint for any agent to use.
- ๐ค Agentic Demo Showcase Track: The Gradio UI provides a powerful demonstration of an agent using these tools to help users.
๐ Key Features
- ๐ Multilingual Support: Automatically detects and responds in English, Spanish, Hindi, and French.
- ๐ค Role-Based Adaptation:
- Patient Mode: Simplified, easy-to-understand health information.
- Doctor Mode: In-depth, technical insights using specialized medical databases.
- ๐ก๏ธ Critical Safety Layer: Identifies keywords related to medical emergencies (e.g., "chest pain") and immediately instructs the user to seek professional help, bypassing the AI.
- ๐ Sourced & Verifiable: All information is backed by citations from authoritative sources.
- ๐ฌ Stateful Conversations: Remembers chat history for contextual follow-up questions.
- ๐ ๏ธ Fully Compliant MCP Tool Server: Our tools can be called externally by any MCP client.
๐ ๏ธ Tools & Technology Stack
Our agent leverages a powerful, specialized toolkit to provide accurate information. These tools are exposed via our public MCP endpoint.
Tool Name | Description | Data Source(s) |
---|---|---|
search_web |
For general health queries and patient-level explanations. | DuckDuckGo |
search_pubmed |
Accesses peer-reviewed medical literature for evidence-based information. | PubMed / NCBI |
get_drug_label_info |
Retrieves detailed, official FDA-approved prescribing information. | openFDA / DailyMed |
check_drug_side_effects |
Finds known side effects for a specific medication. | openFDA / DailyMed |
check_drug_interactions |
Checks for adverse interactions between two or more drugs. | RxNorm API (NIH) |
search_clinical_trials |
Discovers ongoing or completed clinical studies for conditions/treatments. | ClinicalTrials.gov (NIH) |
Core Technologies:
- Backend & Compute: Modal for scalable, serverless GPU and CPU functions.
- AI Agent Framework: LlamaIndex for orchestrating the agent's think-plan-act loop.
- LLM: Mistral 7B for high-quality reasoning.
- Frontend UI: Gradio for the interactive chat interface.
๐๏ธ Architecture: Hybrid Single-Server MCP
Our single Modal application serves as both the core Agent and its own MCP-compliant Tool Server.
- Agent Endpoint (
/
): A private endpoint that takes a user query and orchestrates the full agentic workflow (planning, tool selection, synthesis). - MCP Tool Endpoint (hidden in backend): A public endpoint that exposes our individual tools. This makes our application a valid MCP Server, proving compliance and allowing any external MCP client to use our medical tools.
๐ Test our MCP Tool Server Live!
You can call our tools from any MCP-compatible client or directly with curl
.
โ ๏ธ Note: The first call may take 30-60 seconds as the serverless backend spins up. Subsequent calls are much faster.
# Example: Check for a critical drug interaction
curl -X POST 'https://sunilpanda992--medi-agent-ai-final-backend-mediagentai-m-3f699b.modal.run' \
--header 'Content-Type: application/json' \
--data '{
"tool_name": "check_drug_interactions",
"tool_args": {
"drugs": ["warfarin", "amiodarone"]
}
}'
# Example: Search for PubMed articles
curl -X POST 'https://sunilpanda992--medi-agent-ai-final-backend-mediagentai-m-3f699b.modal.run' \
--header 'Content-Type: application/json' \
--data '{
"tool_name": "search_pubmed",
"tool_args": {"query": "metformin AND cardiovascular outcomes", "max_results": 2}
}'
# Example: Get official FDA label information (CORRECTED)
curl -X POST 'https://sunilpanda992--medi-agent-ai-final-backend-mediagentai-m-3f699b.modal.run' \
--header 'Content-Type: application/json' \
--data '{
"tool_name": "get_drug_label_info",
"tool_args": {"drug_name": "atorvastatin"}
}'
IGNORE_WHEN_COPYING_START Use code with caution. Markdown IGNORE_WHEN_COPYING_END
๐งช Try It Out in the App!
Select the appropriate "patient" or "doctor" role in the chat interface above and try these prompts:
Patient Query: "What are the most common side effects of metformin?"
Doctor Query: "My patient with Crohn's is on methotrexate and we are considering adding infliximab. I need the latest PubMed literature on efficacy and a check for interactions between the two drugs."
Spanish Query: "ยฟCuรกles son los sรญntomas de la diabetes tipo 2?"
Interaction Check: "Can I take ibuprofen with lisinopril?"