Rehabilitation Monitoring MCP Server
# Rehabilitation Monitoring MCP Server
An MCP (Model Context Protocol) server for rehabilitation monitoring built with the Python SDK. The server exposes rehabilitation datasets, monitoring tools, reporting workflows, and research retrieval capabilities through a standardized MCP interface.
## Development Approach
This project was developed using an LLM-assisted development workflow inspired by the MCP tutorial on building MCP servers with LLMs. Functionality was designed, implemented, tested, and refined iteratively through prompt-driven development, MCP tool testing, and human review.
The project evolved from basic rehabilitation-monitoring tools into more advanced workflows, including risk assessment, decline detection, intervention planning, alert generation, and an agentic rehabilitation workflow for reviewing and updating patient plans.
Reference:
- https://modelcontextprotocol.info/docs/tutorials/building-mcp-with-llms/
## User Interface
The project includes a Gradio-based clinical dashboard (`app.py`) that provides a graphical interface for interacting with the rehabilitation-monitoring workflows.
Available dashboard views:
- Cohort Overview
- Patient Information
- Risk Assessment
- Declining Outcomes
- Review Workflow
- Alerts
- Intervention Plans
- AI Assistant
The dashboard is implemented on top of the existing MCP server functionality and does not modify the underlying MCP workflows. The dashboard also includes a rule-based AI Assistant that allows users to ask natural-language rehabilitation-monitoring questions. The assistant dynamically selects and combines information from existing MCP tools to provide patient-level and cohort-level summaries, risk explanations, rehabilitation concerns, intervention recommendations, alert information, and monitoring insights.
## AI Agent Documentation
The repository includes an `AGENTS.md` file that provides project-specific guidance for AI coding agents such as Goose, Claude Code, GitHub Copilot, Codex, and Cursor.
The document describes:
- project goals
- repository structure
- MCP tools and workflows
- development workflow
- testing instructions
- coding conventions
- risk-classification logic
- persistence behaviour
- project-specific constraints
- AI-assisted development guidelines
The AGENTS.md file serves as the primary reference for AI agents working on the rehabilitation-monitoring MCP server.
## What it provides
### Tools
- `get_patient_information`
- `calculate_patient_risk_scores`
- `identify_declining_rehabilitation_outcomes`
- `generate_rehabilitation_reports`
- `create_patient_alerts`
- `create_intervention_plan`
- `review_and_update_patient_plan`
- `search_rehabilitation_research`
### Prompts
- `generate_patient_progress_summaries`
- `create_rehabilitation_monitoring_reports`
- `explain_risk_classifications`
- `recommend_follow_up_actions`
### Resources
- `rehab://data/patients.csv`
- `rehab://data/therapy_sessions.csv`
- `rehab://data/wearable_measurements.csv`
- `rehab://data/medication_adherence.csv`
- `rehab://alerts`
## Data directory
By default the server reads CSV files from `./data`. You can override that with `REHAB_DATA_DIR`.
Expected filenames:
- `patients.csv`
- `therapy_sessions.csv`
- `wearable_measurements.csv`
- `medication_adherence.csv`
## Firecrawl research search
The research search tool uses the Firecrawl API. Set:
- `FIRECRAWL_API_KEY`
- optionally `FIRECRAWL_API_URL` if you use a different endpoint
The tool uses Firecrawl to retrieve rehabilitation-related research papers and summaries from external sources.
## Example MCP Usage
Examples:
- Calculate patient risk scores
- Generate rehabilitation reports
- Identify declining rehabilitation outcomes
- Create patient alerts
- Retrieve rehabilitation-related research
Example prompts:
- Use the rehab-monitor MCP server to calculate patient risk scores.
- Use the rehab-monitor MCP server to generate a rehabilitation report for patient P001.
- Use the rehab-monitor MCP server to search rehabilitation research related to stroke recovery.
Example dashboard workflows:
- Review a patient rehabilitation plan.
- Monitor rehabilitation alerts.
- Review intervention plans.
- Monitor rehabilitation risk levels across the patient cohort.
- Ask natural-language rehabilitation-monitoring questions through the AI Assistant.
## Sample Data
The repository includes synthetic rehabilitation monitoring datasets containing:
- patient records
- therapy session data
- wearable sensor measurements
- medication adherence records
These datasets are intended for MCP development and testing purposes only and do not contain real patient information.
## Run
### Run the MCP Server
```bash
uv run rehab-monitor
```
Or run the server module directly:
```bash
uv run python -m rehab_monitor.server
```
### Run the Gradio Dashboard
```bash
uv run python app.py
```
The dashboard will be available at:
```text
http://127.0.0.1:7860
```
The Gradio dashboard uses the existing MCP tools and workflows without modifying the underlying server logic.
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: risk calculation, alert creation, report generation, patient info retrieval, outcome decline detection, and research search. No overlap in functionality.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., calculate_patient_risk_scores, create_patient_alerts, generate_rehabilitation_reports). No deviations.
Six tools is well-scoped for a rehabilitation monitoring server, covering the core tasks without being too few or excessive.
The tools cover risk assessment, alerting, reporting, patient info, outcome decline identification, and research. Minor gaps exist (e.g., no tool for inputting or updating patient measurements), but the surface is largely complete for monitoring and analysis.