Viktechenthu/patient-care-system
If you are the rightful owner of patient-care-system and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Patient Care System is a comprehensive healthcare management solution built with Spring Boot, offering REST APIs and a native Spring MCP server to manage patient data, progress notes, and care plans.
Patient Care System with Spring-based MCP Server
A comprehensive healthcare management system built with Spring Boot that exposes patient data, progress notes, and care plans through REST APIs and a native Spring MCP server.
Project Structure
patient-care-system/
├── src/main/java/com/healthcare/patientcare/
│ ├── PatientCareApplication.java
│ ├── entity/
│ │ ├── Patient.java
│ │ ├── ProgressNote.java
│ │ └── CarePlan.java
│ ├── repository/
│ │ ├── PatientRepository.java
│ │ ├── ProgressNoteRepository.java
│ │ └── CarePlanRepository.java
│ ├── service/
│ │ └── PatientService.java
│ ├── controller/
│ │ └── PatientController.java
│ ├── mcp/
│ │ ├── model/
│ │ │ ├── MCPRequest.java
│ │ │ ├── MCPResponse.java
│ │ │ ├── MCPError.java
│ │ │ ├── MCPTool.java
│ │ │ ├── MCPToolCallRequest.java
│ │ │ ├── MCPContent.java
│ │ │ └── MCPToolResponse.java
│ │ ├── service/
│ │ │ └── MCPService.java
│ │ ├── controller/
│ │ │ └── MCPController.java
│ │ └── MCPServerWrapper.java (standalone bridge)
│ └── config/
│ ├── DataInitializer.java
│ └── JacksonConfig.java
├── src/main/resources/
│ └── application.properties
├── mcp-server.sh (Linux/Mac)
├── mcp-server.bat (Windows)
└── pom.xml
Architecture
This system uses a Spring-native MCP server where:
- Spring Boot exposes an HTTP endpoint at
/mcpthat handles JSON-RPC 2.0 requests - A lightweight wrapper (shell script or Java) bridges stdio to the HTTP endpoint
- Claude Desktop communicates with the wrapper, which forwards to Spring Boot
Features
REST APIs
- Get Patient by Name:
GET /api/patients/by-name/{name} - Get Patient by ID:
GET /api/patients/{id} - Get All Patients:
GET /api/patients - Get Progress Notes:
GET /api/patients/{id}/progress-notes - Get Care Plan:
GET /api/patients/{id}/care-plan - Update Care Plan:
POST /api/patients/{id}/care-plan
MCP Endpoint
HTTP Endpoint: POST /mcp
Accepts JSON-RPC 2.0 requests with methods:
initialize- Initialize the MCP servertools/list- List available toolstools/call- Execute a tool
MCP Tools (6 Available)
- get_patient_by_name - Retrieve patient details by name
- get_patient_by_id - Retrieve patient details by ID
- get_all_patients - List all patients
- get_progress_notes - Get progress notes for a patient
- get_care_plan - Get care plan for a patient
- update_care_plan - Update or create a care plan
Setup Instructions
Prerequisites
- Java 17 or higher
- Maven 3.6+
- curl (for shell script bridge)
Step 1: Build and Run Spring Boot Application
# Navigate to project root
cd patient-care-system
# Build the project
mvn clean install
# Run the application
mvn spring-boot:run
The application will start on http://localhost:8080
You should see:
Patient Care System is running on http://localhost:8080
H2 Console available at http://localhost:8080/h2-console
Step 2: Verify the Application
# Check health
curl http://localhost:8080/
# Test REST API
curl http://localhost:8080/api/patients
# Test MCP endpoint
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
Step 3: Configure MCP Server Bridge
Choose ONE of the following options:
Option A: Shell Script Bridge (Linux/Mac) - RECOMMENDED
# Make the script executable
chmod +x mcp-server.sh
# Test it
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | ./mcp-server.sh
Option B: Batch Script Bridge (Windows)
# Test it
echo {"jsonrpc":"2.0","method":"tools/list","id":1} | mcp-server.bat
Option C: Java Wrapper Bridge (All Platforms)
# Compile
javac src/main/java/com/healthcare/patientcare/mcp/MCPServerWrapper.java
# Run
java -cp src/main/java com.healthcare.patientcare.mcp.MCPServerWrapper
# Test it
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | java -cp src/main/java com.healthcare.patientcare.mcp.MCPServerWrapper
Step 4: Configure Claude Desktop
Edit your Claude Desktop configuration file:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Add the following configuration (choose based on your bridge choice):
For Shell Script (Linux/Mac):
{
"mcpServers": {
"patient-care": {
"command": "/absolute/path/to/patient-care-system/mcp-server.sh"
}
}
}
For Batch Script (Windows):
{
"mcpServers": {
"patient-care": {
"command": "C:\\absolute\\path\\to\\patient-care-system\\mcp-server.bat"
}
}
}
For Java Wrapper:
{
"mcpServers": {
"patient-care": {
"command": "java",
"args": [
"-cp",
"/absolute/path/to/patient-care-system/src/main/java",
"com.healthcare.patientcare.mcp.MCPServerWrapper"
]
}
}
}
Important: Replace the paths with your actual absolute paths!
Step 5: Restart Claude Desktop
After updating the configuration, restart Claude Desktop. The MCP server will be available for use.
Sample Data
The application automatically loads sample data on startup:
Patient 1: John Smith
- ID: 1
- Patient ID: PAT001
- Condition: Hypertension
- Progress Notes: 2 notes
- Care Plan: Active
Patient 2: Mary Johnson
- ID: 2
- Patient ID: PAT002
- Condition: Type 2 Diabetes
- Progress Notes: 1 note
- Care Plan: Active
Using MCP Tools in Claude
Once configured, you can ask Claude to:
"Get patient details for John Smith"
"Show me the progress notes for patient ID 1"
"What is the care plan for Mary Johnson?"
"Update the care plan for patient 1 with new goals: Control blood pressure below 120/80"
Testing MCP Server Manually
You can test the MCP endpoint directly:
# List tools
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
# Get patient by name
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "get_patient_by_name",
"arguments": {
"name": "John Smith"
}
},
"id": 2
}'
# Get progress notes
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "get_progress_notes",
"arguments": {
"patient_id": 1
}
},
"id": 3
}'
# Update care plan
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "update_care_plan",
"arguments": {
"patient_id": 1,
"goals": "Achieve blood pressure below 120/80",
"interventions": "Daily exercise, low sodium diet",
"medications": "Lisinopril 10mg daily",
"status": "Active"
}
},
"id": 4
}'
REST API Examples
Get All Patients
curl http://localhost:8080/api/patients
Get Patient by Name
curl http://localhost:8080/api/patients/by-name/John%20Smith
Get Progress Notes
curl http://localhost:8080/api/patients/1/progress-notes
Get Care Plan
curl http://localhost:8080/api/patients/1/care-plan
Update Care Plan
curl -X POST http://localhost:8080/api/patients/1/care-plan \
-H "Content-Type: application/json" \
-d '{
"goals": "New health goals",
"interventions": "Updated interventions",
"medications": "Updated medications",
"startDate": "2025-01-01",
"reviewDate": "2025-06-01",
"status": "Active"
}'
H2 Database Console
Access the H2 console at: http://localhost:8080/h2-console
Connection Details:
- JDBC URL:
jdbc:h2:mem:patientdb - Username:
sa - Password: (leave empty)
Troubleshooting
Spring Boot Issues
- Port already in use: Change the port in
application.properties - Database connection: Verify H2 console settings
- Maven build fails: Run
mvn clean install -U
MCP Server Issues
- Connection refused: Ensure Spring Boot is running on port 8080
- MCP not showing in Claude:
- Check configuration path is absolute
- Verify the bridge script is executable
- Test the bridge manually with echo commands
- Tools not appearing:
- Check Spring Boot logs for errors
- Verify
/mcpendpoint is accessible - Test with curl commands above
Bridge Script Issues
- Shell script not executing: Run
chmod +x mcp-server.sh - Java wrapper not found: Ensure class is compiled and path is correct
- stdin/stdout issues: Check that the bridge properly forwards requests
Architecture Benefits
Using Spring for the MCP server provides:
- Unified Codebase: Single application serving both REST and MCP
- Dependency Injection: Leverage Spring's IoC container
- Database Integration: Direct access to JPA repositories
- Easy Testing: Use Spring Boot test framework
- Production Ready: Use Spring's robust production features
- No Node.js Dependency: Pure Java solution
Technologies Used
- Spring Boot 3.2.0 - Application framework
- Spring Data JPA - Data access layer
- H2 Database - In-memory database
- Jackson - JSON processing
- Lombok - Reduce boilerplate code
- JSON-RPC 2.0 - MCP protocol implementation
License
This is a sample project for educational purposes.