> ## 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.

# Welcome to Mirobody

> An open-source, self-hosted data engine that bridges your personal data with the latest AI. This documentation covers Mirobody's health vertical, the foundation of Theta Wellness.

## What is Mirobody?

**Mirobody** is an open-source, self-hosted **health-data + AI engine** — a lightweight **C++** core that links your personal health data to LLMs and runs anywhere: standalone on a server, or **on-device** inside the Android / iOS apps so your data never has to leave the phone.

* 🧩 **One core, three forms** — a single C++ engine ships as a standalone binary (HTTP + WebSocket), as a shared library inside the mobile host apps (JNI on Android, a C API on iOS), and via a plain `extern "C"` surface that any language can embed.
* 🔌 **MCP server** — built-in tools are exposed over a Model Context Protocol endpoint, callable by ChatGPT, Claude, Cursor, or any MCP client.
* 🤖 **Multi-provider chat** — one streaming interface over OpenAI, Google Gemini, and MiroThinker, plus a fully **on-device** option (Gemma via LiteRT-LM / llama.cpp) so chat can run with no server and no network.
* 🔄 **Health-data connectors** — wearables, phone health stores, and clinical EHRs (via SMART on FHIR) flow in through pluggable vendor clients; on-device stores (Apple Health, Health Connect) are read by the host apps.
* 🏥 **FHIR R4 native** — an embedded FHIR R4 endpoint normalizes everything (units to UCUM; indicators mapped toward SNOMED CT / LOINC / RxNorm) and serves it back as FHIR resources.

> This docs site covers Mirobody's health vertical — the engine behind [Theta Wellness](https://www.thetahealth.ai/).

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/en/quickstart">
    Build the C++ core and run it in minutes
  </Card>

  <Card title="Use Cases & Examples" icon="lightbulb" href="/en/use-cases">
    Real conversations with synthetic health data
  </Card>

  <Card title="Provider Integration" icon="plug" href="/en/development/provider-integration">
    Add a new device or data source in hours
  </Card>

  <Card title="Managed API Platform" icon="cloud" href="/en/api-reference">
    Prefer a hosted API over self-hosting? Same engine, managed for you.
  </Card>
</CardGroup>

## Why Mirobody?

<AccordionGroup>
  <Accordion title="Your data stays yours" icon="lock">
    The core runs locally end-to-end. On desktop / server it's a single binary over your own Postgres (or SQLite); on phones the same core runs **on-device**, so health data never has to leave the device unless you choose to sync it. Bring your own LLM key (OpenAI, Gemini, MiroThinker) — or run **fully offline** with on-device Gemma.
  </Accordion>

  <Accordion title="One core, runs anywhere" icon="server">
    A single C++ engine with a plain `extern "C"` C API. It ships as a standalone HTTP / WebSocket binary, as a shared library inside the Android / iOS host apps, and is embeddable from Java, Go, C#, Rust, Swift, or Python via that C ABI — no per-platform rewrite.
  </Accordion>

  <Accordion title="A lightweight, tool-using agent" icon="robot">
    One agent: it picks an LLM client by **provider** name, builds the system prompt, and streams the turn back — calling built-in **MCP tools** (read files, render charts, family health, memory) as needed.
  </Accordion>

  <Accordion title="MCP tools, compiled in" icon="wrench">
    Tools are C++ files in `res/mcp_tools/` that self-register at compile time — drop a `.cpp` with the `MIROBODY_REGISTER_TOOL` macro and rebuild. They're exposed over the `/mcp` endpoint for ChatGPT / Claude / Cursor and run in-process for the built-in agent.
  </Accordion>

  <Accordion title="Files, parsed into health data" icon="file">
    PDFs (PDFium), Excel / CSV (xlnt), and images (OCR via Tesseract, plus vision-model inlining) are parsed; values are normalized (UCUM) and written to the embedded FHIR store.
  </Accordion>

  <Accordion title="Voice & realtime" icon="microphone">
    Realtime audio chat over WebSocket via **OpenAI Realtime** and **Google Gemini Live**.
  </Accordion>

  <Accordion title="Care circles" icon="users">
    Create a circle and invite people by email; members can share a conversation (view / edit) or their health data (per-person, off by default). The agent can then answer "how is my family doing?" reading only what members chose to share.
  </Accordion>
</AccordionGroup>

## Architecture at a glance

Five pieces make up the core (all C++):

| Piece              | Path                          | Notes                                                                                                                                       |
| ------------------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **LLM clients**    | `src/llm/`                    | One streaming client per provider — OpenAI, Google Gemini, MiroThinker, on-device Gemma (LiteRT-LM / llama.cpp), plus Realtime / Live audio |
| **MCP tools**      | `src/mcp/` + `res/mcp_tools/` | Server-side tools over a Model Context Protocol endpoint                                                                                    |
| **Agent**          | `src/chat/` + `res/agents/`   | Picks a client by provider, builds the prompt, streams the turn                                                                             |
| **Health vendors** | `src/health/vendor/`          | Wearables, phone stores, and EHRs (SMART on FHIR) behind one authorize / fetch / webhook contract                                           |
| **FHIR R4**        | `src/fhir/`                   | Embedded FHIR endpoint + terminology (UCUM; SNOMED CT / LOINC / RxNorm)                                                                     |

Agents and tools **self-register at compile time**: drop a `.cpp` in the matching `res/` directory and rebuild.

## Data sources

Health data flows in through pluggable **vendor clients**, in four buckets:

<CardGroup cols={2}>
  <Card title="Aggregator platforms" icon="layer-group">Terra, Validic, Human API, Junction, Metriport, … — 15 B2B platforms behind one contract</Card>
  <Card title="Device brands" icon="watch">Fitbit, Garmin, Withings (first-party OAuth) — Oura / Polar / Whoop via aggregators</Card>
  <Card title="Clinical EHRs" icon="hospital">SMART on FHIR — one generic client for ONC-certified EHRs (Epic, Oracle Health / Cerner, athenahealth, …)</Card>
  <Card title="On-device stores" icon="mobile">Apple Health, Samsung Health, Google Health Connect, Huawei — read on-device, POSTed as FHIR</Card>
</CardGroup>

Add a source by implementing a `vendor::Vendor` in `src/health/vendor/`. See [Provider Integration](/en/development/provider-integration).

## Tech Stack

* **C++11** core, built with **CMake** (+ vcpkg on Windows)
* **libwebsockets** / **libcurl** / **OpenSSL** for HTTP + WebSocket + TLS
* **Storage backends** selected at build time: PostgreSQL (desktop default) or SQLite (mobile), also MySQL / DuckDB / ClickHouse; files to S3 / OSS / Azure Blob / local
* **On-device LLM**: Gemma via **LiteRT-LM** (mobile) / **llama.cpp** (Electron)
* **Embedded FHIR R4** with UCUM / SNOMED CT / LOINC / RxNorm terminology
* **OAuth 2.0 / OIDC** authorization server; email-code + Google / Apple / WeChat / GitHub login

## Who is this for?

<CardGroup cols={2}>
  <Card title="Individual users" icon="user">
    Anyone who wants a private, AI-powered home for their health data — without handing it over to a third party
  </Card>

  <Card title="Developers" icon="code">
    Engineers building personal-data AI products who want a private, embeddable, on-device-capable health engine instead of building the data + FHIR + MCP plumbing themselves
  </Card>
</CardGroup>

## Real-World Examples

<Info>
  Showcase conversations below use **synthetic health data** and some Theta-private tools.
</Info>

### Private Health Data Management & Chat

<AccordionGroup>
  <Accordion title="Track health issues across systems and years" icon="timeline">
    Query the same condition across multiple health systems, even across countries:

    <CardGroup cols={2}>
      <Card title="Knee Pain Progress" icon="link" href="https://test-mirobody.thetahealth.ai/share/c2ee8160-33c5-4642-9b34-639390b350ba">
        Track knee pain progression across providers
      </Card>

      <Card title="Cardiovascular Disorders" icon="link" href="https://test-mirobody.thetahealth.ai/share/045adc4b-cf67-45ca-a416-9bdc12670f47">
        Monitor cardiovascular health across health systems
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Unified health issue analysis" icon="chart-line">
    Combine device data, medical records, and self-reported notes:

    <CardGroup cols={2}>
      <Card title="Cardiovascular Summary" icon="link" href="https://test-mirobody.thetahealth.ai/share/84b5e136-f8d1-4264-bd95-5dfdd814ba4f">
        Summarize cardiovascular conditions across sources
      </Card>

      <Card title="Diabetes History & Progress" icon="link" href="https://test-mirobody.thetahealth.ai/share/b1948930-ce86-4925-8082-62e5273b567c">
        Track diabetes from devices, records, and other sources
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Prepare for doctor visits" icon="user-doctor">
    <Card title="PCP Visit Preparation" icon="link" href="https://test-mirobody.thetahealth.ai/share/9c4aea9e-3a73-4bfa-901c-33392897bd52">
      Generate a comprehensive summary and questions for your primary care visit
    </Card>
  </Accordion>
</AccordionGroup>

### Deep Research for Personal Health

<AccordionGroup>
  <Accordion title="Identify patterns and drivers" icon="magnifying-glass-chart">
    Figure out what's actually helping or hurting you:

    <CardGroup cols={2}>
      <Card title="Blood Glucose Analysis" icon="link" href="https://test-mirobody.thetahealth.ai/share/efdb4367-2ae4-491f-a36f-a8f9ee7ed909">
        Find factors that help or harm your blood glucose
      </Card>

      <Card title="Symptoms & Feelings Drivers" icon="link" href="https://test-mirobody.thetahealth.ai/share/59710b3e-c3c2-4c21-a650-f2020316acd9">
        Discover the main drivers behind your symptoms and mood
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Personalized treatment research" icon="flask">
    <Card title="Diabetes Treatment Options" icon="link" href="https://test-mirobody.thetahealth.ai/share/b6490f33-b287-4c47-9474-fae89c8e5615">
      Research personalized options (meds, devices, lifestyle) for diabetes management
    </Card>
  </Accordion>
</AccordionGroup>

### Mirobody as a Data Engine for Developers

<CardGroup cols={2}>
  <Card title="Wearable manufacturers" icon="watch">
    Add AI chat over your device data without building the backend
  </Card>

  <Card title="Research applications" icon="microscope">
    Drop custom tools into `tools/` to deploy subject-facing research apps
  </Card>

  <Card title="Consumer health apps" icon="mobile">
    Use Mirobody as the data + AI backend behind your product
  </Card>

  <Card title="Enterprise" icon="building">
    Contact us for custom integrations and enterprise support
  </Card>
</CardGroup>

## Theta Wellness: Mirobody in Production

[**Theta Wellness**](https://www.thetahealth.ai/) is our flagship application built on Mirobody — a personal health intelligence app that demonstrates what Mirobody can do at production scale. It connects wearables, phone health stores, and EHR records, and supports voice, image, file, and text as inputs.

We're open-sourcing the engine so you can run the same private, on-device-capable health core yourself — self-hosted for the whole family, on your phone offline, or embedded in your own app via the C API.

## Next Steps

<Steps>
  <Step title="Get started">
    Follow the [Quick Start](/en/quickstart) to build the core (`./build.sh`) and run it.
  </Step>

  <Step title="Configure providers">
    Set OAuth credentials for the devices you want — see [Configuration](/en/configuration).
  </Step>

  <Step title="Explore the API">
    Read the [API Reference](/en/api-reference/overview) for the OpenAI-compatible `/v1` endpoints.
  </Step>

  <Step title="Add custom providers or tools">
    Use [Provider Integration](/en/development/provider-integration) for new data sources, or add a C++ tool in `res/mcp_tools/`.
  </Step>
</Steps>

## Contributing

We welcome contributions — new providers, new tools, framework improvements, anything.

<CardGroup cols={2}>
  <Card title="GitHub Repository" icon="github" href="https://github.com/thetahealth/mirobody">
    Source code, issues, and PRs
  </Card>

  <Card title="Contributing Guide" icon="code-pull-request" href="/en/development/contributing">
    How to submit changes
  </Card>
</CardGroup>

## Community & Support

<CardGroup cols={2}>
  <Card title="Discord" icon="discord">
    Community discussions (coming soon)
  </Card>

  <Card title="GitHub Issues" icon="bug" href="https://github.com/thetahealth/mirobody/issues">
    Bug reports and feature requests
  </Card>

  <Card title="Mirobody Support" icon="envelope" href="mailto:developer@thetahealth.ai">
    Direct technical support
  </Card>
</CardGroup>

<Note>
  This docs site covers Mirobody's **health vertical**. For the open-source engine repo, see <a href="https://github.com/thetahealth/mirobody">github.com/thetahealth/mirobody</a>.
</Note>
