Skip to main content
Glama
baala-saravanan

FHIR MCP Server

README.md
# šŸ„ FHIR MCP Server

A FastMCP server that exposes healthcare data from the **Public HAPI FHIR R4 Server** using the **Model Context Protocol (MCP)**.

This project demonstrates how AI applications can interact with standardized Electronic Health Record (EHR) data through FHIR resources.

---

## Features

- Search patients by name
- Retrieve patient demographics
- Retrieve medical conditions
- Retrieve observations
- Retrieve medication requests
- Async communication using HTTPX
- Compatible with MCP Inspector
- Built using FastMCP

---

## Technologies

- Python 3.11+
- FastMCP
- MCP
- HTTPX
- FHIR R4
- Public HAPI FHIR Server

---

## Project Structure

```
fhir-mcp-server/
│
ā”œā”€ā”€ server.py
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ README.md
ā”œā”€ā”€ LICENSE
ā”œā”€ā”€ .gitignore
│
ā”œā”€ā”€ screenshots/
│   ā”œā”€ā”€ home.png
│   ā”œā”€ā”€ search_patient.png
│   ā”œā”€ā”€ get_patient.png
│   ā”œā”€ā”€ get_conditions.png
│   ā”œā”€ā”€ get_observations.png
│   ā”œā”€ā”€ get_medications.png
│   └── architecture.png
│
└── docs/
    └── architecture.md
```

---

## Installation

Clone the repository:

```bash
git clone https://github.com/baala-saravanan/fhir-mcp-server.git
cd fhir-mcp-server
```

Create a virtual environment:

```bash
python -m venv .venv
```

Activate the environment:

Windows:

```bash
.venv\Scripts\activate
```

Install dependencies:

```bash
pip install -r requirements.txt
```

---

## Running the Project

Launch the MCP development server:

```bash
mcp dev server.py
```

The MCP Inspector will open automatically in your browser.

---

## Available MCP Tools

| Tool | Description |
|------|-------------|
| search_patient | Search patients by name |
| get_patient | Retrieve patient demographics |
| get_conditions | Retrieve patient conditions |
| get_observations | Retrieve laboratory results and observations |
| get_medications | Retrieve medication history |

---

## Data Source

Public HAPI FHIR R4 Test Server

```
https://hapi.fhir.org/baseR4
```

This server provides synthetic healthcare data for development and testing.

---

## Architecture

The application follows the Model Context Protocol (MCP) architecture.

See:

- `docs/architecture.md`
- `screenshots/architecture.png`

---

## Screenshots

The project includes screenshots demonstrating the available MCP tools.

- Home
- Search Patient
- Get Patient
- Get Conditions
- Get Observations
- Get Medications
- Architecture Diagram

---

## Future Improvements

- Patient Timeline
- Clinical Summary
- Laboratory Trend Analysis
- Medication Intelligence
- Clinical Decision Support
- AI-powered Patient Summaries
- Streamlit Dashboard
- FastAPI Backend
- LLM Integration

---

## License

This project is licensed under the MIT License.

See the `LICENSE` file for details.

---

## Author

**Bala Saravanan Muthukumar**

- Data Scientist
- Biomedical Engineer
- AI & Healthcare Enthusiast