Skip to main content

Quantified Self MCP

Your health data. Your AI. Your machine.

CI PyPI Python License Glama

Quantified Self MCP is a privacy-first Model Context Protocol (MCP) server that gives AI agents controlled access to your personal health data stored locally.

Built with Python, FastMCP, and SQLite, it works with both local LLMs and cloud-based LLMs. You choose where your AI runs.

Try it on Glama →


What Is It?

Quantified Self MCP connects an AI agent to your personal health data through the Model Context Protocol (MCP).

                 ┌─────────────────────┐
                 │      AI Agent       │
                 │                     │
                 │ Local LLM / Cloud   │
                 └──────────▲──────────┘
                            │
                     MCP tool result
                            │
                     MCP tool call
                            │
                 ┌──────────┴──────────┐
                 │ Quantified Self MCP │
                 │      FastMCP        │
                 │       LOCAL         │
                 └──────────▲──────────┘
                            │
                       SQL / data
                            │
                 ┌──────────┴──────────┐
                 │    Local SQLite     │
                 │     Health Data     │
                 │       LOCAL         │
                 └─────────────────────┘

The MCP server does not require a specific AI provider.

You can run the entire AI stack locally, or connect the server to an online model when you prefer.


🏠 Local AI or ☁️ Cloud AI

The important distinction is between the MCP server and the AI model.

Fully Local

Your Health Data
       ↓
Local SQLite
       ↓
Quantified Self MCP
       ↓
Local AI Agent
       ↓
Local LLM

With a local MCP-compatible agent and local LLM, your health data and AI inference can remain on your machine.

Cloud LLM

Your Health Data
       ↓
Local SQLite
       ↓
Quantified Self MCP
       ↓
AI Agent
       ↓
Cloud LLM

You can also connect the same MCP server to a hosted model.

In that setup, your database and MCP server remain local, while data returned by MCP tools may be sent to the cloud model provider.

The choice is yours.

Quantified Self MCP does not lock you into Claude, OpenAI, or any other model provider.


🔒 Privacy First

Your health data is stored locally in SQLite, and the MCP server runs on your machine.

The server itself does not require a cloud database, account, or hosted data store.

For maximum privacy, use a local LLM so the entire pipeline can remain on your machine.

┌───────────────────────────────────┐
│          YOUR MACHINE             │
│                                   │
│  Health Data                      │
│       ↓                           │
│  Local SQLite                     │
│       ↓                           │
│  Quantified Self MCP              │
│       ↓                           │
│  Local AI Agent                   │
│       ↓                           │
│  Local LLM                        │
│                                   │
└───────────────────────────────────┘

Optional Private Fields

If specific metrics should never be returned to the model, configure:

HEALTH_PRIVATE_FIELDS=weight_kg,mood

Private fields can still be stored and logged, but MCP read operations return them as null.

This gives you another layer of control over which health metrics an AI agent can access.


❤️ What Can It Track?

Quantified Self MCP currently supports:

  • 👟 Daily steps
  • 😴 Sleep duration
  • ❤️ Resting heart rate
  • ⚖️ Weight
  • 🏋️ Workout minutes
  • 🙂 Mood
  • 💧 Water intake

Every metric is optional, so you can track only the measurements you actually use.


💬 What Can You Ask?

Once connected to an MCP-compatible AI agent, you can ask questions naturally.

For example:

How has my sleep changed over the last 30 days?
What was my average step count this week?
Show me my resting heart rate trend.
How much water did I drink on average this month?
What patterns do you see in my recent health data?

You can also log information through the AI agent:

Log 7.5 hours of sleep for today.

Or correct a mistake:

Clear today's mood entry.

🧠 MCP Tools

The server currently provides three MCP tools:

Tool Purpose
read_health_data Read health metrics for a selected date range
log_daily_metric Record one or more health metrics for a specific day
clear_metric Clear a single metric without affecting other data

The server also exposes read-only MCP resources for health metric schemas and individual days.

All data operations are scoped to the supported health metrics. The server does not expose arbitrary SQL execution to the model.


📥 Import Your Health Data

You can initialize the local database from CSV data.

quantified-self-init-db sample_data/health_sample.csv

The supported health fields include:

date
steps
sleep_hours
resting_heart_rate
weight_kg
workout_minutes
mood
water_ml

You can also import an Apple Health export:

quantified-self-init-db export.xml

The importer maps supported Apple Health records into the local database.


⚡ Installation

PyPI

pip install quantified-self-mcp

This installs:

quantified-self-mcp
quantified-self-init-db

From Source

git clone https://github.com/Thecimal/quantified-self-mcp.git
cd quantified-self-mcp

python3 -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Docker

docker build -t quantified-self-mcp .

The included Docker configuration can be used for containerized MCP deployments, including Glama.


🚀 Quick Start

1. Install

pip install quantified-self-mcp

2. Load your health data

quantified-self-init-db your-health-data.csv

3. Connect the MCP server

Connect Quantified Self MCP to an MCP-compatible AI agent.

4. Choose your model

Use either:

  • A local LLM
  • A cloud-based LLM

5. Ask your health data questions

How has my sleep changed over the last 30 days?

The AI agent retrieves the relevant health data through MCP and analyzes it.


🔌 MCP Client Compatibility

Quantified Self MCP uses the standard Model Context Protocol, so the server is designed to work with MCP-compatible clients and models rather than being tied to a single AI application.

The project includes configuration for clients supported by FastMCP, and standard MCP configuration can be generated for other compatible clients.

For local AI setups, pair the server with an MCP-compatible client and a local LLM runtime.

For example:

Local LLM
   +
MCP-compatible Agent
   +
Quantified Self MCP

This allows the complete AI workflow to remain local.


🏗️ Architecture

                         ┌────────────────────┐
                         │      AI Agent      │
                         └─────────┬──────────┘
                                   │
                              MCP Protocol
                                   │
                                   ▼
                         ┌────────────────────┐
                         │ Quantified Self    │
                         │       MCP          │
                         │                    │
                         │      FastMCP       │
                         └─────────┬──────────┘
                                   │
                                   ▼
                         ┌────────────────────┐
                         │    Local SQLite    │
                         │                    │
                         │    Health Data     │
                         └────────────────────┘

The AI model and the MCP server are separate components.

This means you can change the AI model without changing how your health data is stored or exposed.


🛠️ Technology

Component Technology
Language Python
Protocol Model Context Protocol
MCP Framework FastMCP
Database SQLite
Containerization Docker
CI GitHub Actions
Package PyPI

🧪 Development

Clone the repository:

git clone https://github.com/Thecimal/quantified-self-mcp.git
cd quantified-self-mcp

Create a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install dependencies:

pip install -r requirements-dev.txt

Run tests:

pytest

Build the package:

python -m build

GitHub Actions validates the project in a clean environment.


📁 Project Structure

quantified-self-mcp/
├── .github/
│   └── workflows/
├── sample_data/
├── tests/
├── Dockerfile
├── fastmcp.json
├── glama.json
├── init_db.py
├── logic.py
├── import_adapters.py
├── server.py
├── pyproject.toml
├── requirements.txt
├── requirements-dev.txt
├── SECURITY.md
├── CONTRIBUTING.md
├── LICENSE
└── README.md

🛡️ Security

Health information is sensitive personal data.

Never commit:

  • Personal health records
  • Private SQLite databases
  • API keys
  • Passwords
  • Authentication tokens
  • Other sensitive personal information

For security vulnerabilities, please follow the instructions in SECURITY.md.


⭐ Glama

Quantified Self MCP is available through the Glama MCP directory.

Glama Score

A / A / B

Category Score
License A
Quality A
Maintenance B

The project is listed as a Python / Local MCP server on Glama, and its current MCP inspection shows three health-data tools with maintained activity.

View Quantified Self MCP on Glama →


🤝 Contributing

Contributions, bug reports, documentation improvements, and ideas are welcome.

Before contributing, please read:

If you find a bug, please open an issue with enough information to reproduce it.


📄 License

MIT License.


Links


Quantified Self MCP

Your health data. Your AI. Your machine.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantified_self_mcp-0.2.2.tar.gz (55.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantified_self_mcp-0.2.2-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file quantified_self_mcp-0.2.2.tar.gz.

File metadata

  • Download URL: quantified_self_mcp-0.2.2.tar.gz
  • Upload date:
  • Size: 55.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for quantified_self_mcp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 49da6f9a1c072f775b40be493a59217c1f477d128fbcd135840a03651b4575f4
MD5 ba80ad5086c2a015907383a591564f35
BLAKE2b-256 05072247d0e2c9a52256014a9295053dd1f7d143fe52732c118cc9a06f2389ec

See more details on using hashes here.

File details

Details for the file quantified_self_mcp-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for quantified_self_mcp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bed15f5a4771977185949abad01c236b38987f84a080d5974d0a57e7dff48519
MD5 bbd78da3bcaa83de5c1fc5545294a7e3
BLAKE2b-256 be224f19e39dc6d3608a0624508d52189bfed5a4f5e21256ed270100f3a6a99d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page