MCPHealthContextOctopus AI: MCP-Powered Patient Insight Engine:
Inspiration:
Healthcare data is often scattered across multiple systems—lab results, vitals, and clinical records are not unified. This project was inspired by the need to: create a single source of truth for patient health context enable dynamic tool discovery via MCP integrate FHIR-compliant healthcare data with AI agents reduce manual effort in interpreting patient data
What it does
Retrieves patient data using FHIR APIs Exposes clinical tools via MCP server Aggregates: Blood Pressure Cholesterol Triglycerides Builds a structured patient health context Enables A2A + MCP hybrid architecture Uses LLM (Grok / Gemini) for reasoning and summarization
How we built it
Core Architecture Custom Agent → MCP Server → Tools → FHIR API pipeline
Pipeline Components Agent Layer PatientHealthContextAgent System prompt-driven context builder MCP Server (mcp-health-context-server) Tool mapping layer Exposes: GetPatientBloodPressure GetPatientCholesterol GetPatientTriglycerides FHIR Layer fhir_client.py API-based retrieval using secure token Utilities mcp_utilities.py → response formatting mcp_instance.py → MCP server initialization API Layer FastAPI ngrok for external exposure
Context Handling
FHIR context injected via middleware / environment
Challenges we ran into
- Unable to fetch latest data uploaded
FHIR returned older observations instead of latest
_sort was unreliable across server implementations
Required manual sorting using effectiveDateTime
- MCP Tool Mapping Complexity Mapping tools dynamically to MCP server required careful design Ensuring consistent input/output contracts
- Data Consistency Issues Multiple records for same metric (e.g., triglycerides) Needed validation and filtering (final vs preliminary)
- Context Propagation Passing FHIR context correctly across agent → MCP → tools
Accomplishments that we're proud of
Built a custom MCP server for healthcare tools Successfully integrated FHIR APIs with AI agents Enabled dynamic tool usage via MCP skills layer Created a scalable multi-agent + MCP architecture Solved real-world issue of clinical data inconsistency
Built With
- backend
- configuration
- cutomagent
- geminiflash
- llm
- logic
- mcpserver
- mcptools
- ngrok
- promtpopinion
- python
Log in or sign up for Devpost to join the conversation.