Documentation Index Fetch the complete documentation index at: https://docs.mirobody.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before setting up your development environment, ensure you have:
Python 3.12+ Required for running the application
Node.js 18+ Required for chart rendering and SSR
Docker & Docker Compose For running PostgreSQL and Redis
System Build Tools gcc, gfortran, and scientific libraries
Code Editor VS Code, PyCharm, or your preferred IDE
Quick Setup
Clone the repository
git clone https://github.com/thetahealth/mirobody-health.git
cd mirobody-health
Install system dependencies
macOS
Linux (Ubuntu/Debian)
xcode-select --install
brew install gcc gfortran fftw hdf5 openblas lapack
sudo apt install -y g++ gfortran build-essential \
libfftw3-dev libhdf5-dev libblas-dev liblapack-dev
Create virtual environment
python3.12 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install Python dependencies
pip install mirobody -r requirements.txt
The mirobody package contains core utilities. Installing in development mode with -e . is optional.
Install Node.js dependencies
npm install @antv/gpt-vis-ssr ws
Required for chart rendering service.
Start services
docker-compose up -d postgres redis
Or use your own PostgreSQL and Redis instances.
Configure environment
cp .env.example .env
cp config.yaml config.localdb.yaml
Edit .env: Edit config.localdb.yaml with your settings: # At least one LLM API key required
GOOGLE_API_KEY : ''
OPENAI_API_KEY : ''
OPENROUTER_API_KEY : ''
# Database settings
PG_HOST : 'localhost'
PG_PORT : 5432
PG_USER : 'holistic_user'
PG_PASSWORD : 'holistic_password'
PG_DBNAME : 'holistic_db'
PG_SCHEMA : 'theta_ai'
# Redis settings
REDIS_HOST : 'localhost'
REDIS_PORT : 6379
REDIS_DB : 0
REDIS_PASSWORD : ''
# MCP and Agent directories
MCP_TOOL_DIRS :
- mirobody/pub/tools
- mirobody/pub/tools_health
MCP_RESOURCE_DIRS :
- mirobody/pub/resources
AGENT_DIRS :
- mirobody/pub/agents
Run the application
Server should start on http://localhost:18080 If running under WSL, access from Windows via http://localhost:18080
Recommended VS Code Extensions
{
"recommendations" : [
"ms-python.python" ,
"ms-python.vscode-pylance" ,
"ms-python.black-formatter" ,
"charliermarsh.ruff" ,
"tamasfe.even-better-toml" ,
"redhat.vscode-yaml"
]
}
# Install development dependencies
pip install black ruff pytest pytest-asyncio
# Format code
black .
# Lint code
ruff check .
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=connect --cov-report=html
# Run specific test file
pytest tests/test_provider_garmin.py
# Run integration tests
pytest -m integration
Project Structure
mirobody-health/
├── mirobody/ # Main application package
│ ├── chat/ # Chat and agent services
│ │ ├── adapters/ # Protocol adapters (HTTP, WebSocket)
│ │ ├── agent.py # Agent registry and loading
│ │ ├── service.py # Chat service routes
│ │ └── unified_chat_service.py # Core chat logic
│ ├── mcp/ # MCP protocol implementation
│ │ ├── service.py # JSON-RPC handler
│ │ ├── tool.py # Tool loading and execution
│ │ └── resource.py # Resource management
│ ├── pulse/ # Health data platform
│ │ ├── theta/ # OAuth providers (Garmin, Whoop, etc.)
│ │ ├── apple/ # Apple Health platform
│ │ ├── core/ # Core health services
│ │ ├── file_parser/ # File processing handlers
│ │ └── router/ # API routes
│ ├── pub/ # Public tools and agents
│ │ ├── tools/ # General MCP tools
│ │ ├── tools_health/ # Health-specific MCP tools
│ │ ├── resources/ # MCP resources
│ │ └── agents/ # Agent implementations
│ ├── server/ # HTTP server
│ ├── user/ # Authentication
│ └── utils/ # Utilities
├── database/ # Database schemas and migrations
│ └── resource/ # SQL initialization files
├── compose.yaml # Docker Compose configuration
├── config.yaml # Base configuration (immutable)
├── config.localdb.yaml # Your environment configuration
├── .env # Environment variables
├── main.py # Application entry point
├── requirements.txt # Python dependencies
├── package.json # Node.js dependencies
└── run.sh # Deployment script
Key Directories
Chat service with agent orchestration, message history, and protocol adapters for HTTP (SSE) and WebSocket.
MCP protocol implementation with JSON-RPC 2.0 handler, tool/resource loading, and authentication.
Health data platform with OAuth providers, Apple Health integration, file processing, and data aggregation.
Public tools, resources, and agents that can be discovered via MCP. Add custom tools here.
Next Steps
Contributing Learn how to contribute to the project
Testing Write tests for your code
Provider Integration Add a new provider integration
Deployment Deploy your changes