quantified-self-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ .git
2
+ .gitignore
3
+ .venv
4
+ __pycache__/
5
+ *.pyc
6
+ data/
7
+ README.md
8
+ LICENSE
@@ -0,0 +1,76 @@
1
+ name: Bug Report
2
+ description: Report a reproducible problem with Quantified Self MCP
3
+ title: "[Bug]: "
4
+ labels:
5
+ - bug
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ Thank you for reporting a bug.
11
+
12
+ Please do not include real personal health data, credentials, API keys,
13
+ tokens, or private databases.
14
+
15
+ - type: textarea
16
+ id: description
17
+ attributes:
18
+ label: What happened?
19
+ description: Clearly describe the problem.
20
+ placeholder: Describe the bug.
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ id: reproduce
26
+ attributes:
27
+ label: Steps to reproduce
28
+ description: Tell us how to reproduce the issue.
29
+ placeholder: |
30
+ 1. Start the server
31
+ 2. Run ...
32
+ 3. Call tool ...
33
+ 4. Observe ...
34
+ validations:
35
+ required: true
36
+
37
+ - type: textarea
38
+ id: expected
39
+ attributes:
40
+ label: Expected behavior
41
+ description: What did you expect to happen?
42
+ validations:
43
+ required: true
44
+
45
+ - type: textarea
46
+ id: actual
47
+ attributes:
48
+ label: Actual behavior
49
+ description: What actually happened?
50
+ validations:
51
+ required: true
52
+
53
+ - type: input
54
+ id: version
55
+ attributes:
56
+ label: Quantified Self MCP version or commit
57
+ placeholder: e.g. v1.0.0 or commit hash
58
+
59
+ - type: input
60
+ id: python
61
+ attributes:
62
+ label: Python version
63
+ placeholder: e.g. Python 3.12.0
64
+ validations:
65
+ required: true
66
+
67
+ - type: dropdown
68
+ id: os
69
+ attributes:
70
+ label: Operating system
71
+ options:
72
+ - Linux
73
+ - macOS
74
+ - Windows
75
+ - Other
76
+ validations:
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/Thecimal/quantified-self-mcp/security/advisories
5
+ about: Please report security vulnerabilities privately when private reporting is enabled.
@@ -0,0 +1,56 @@
1
+ name: Feature Request
2
+ description: Suggest an improvement or new capability
3
+ title: "[Feature]: "
4
+ labels:
5
+ - enhancement
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ Thank you for suggesting an improvement.
11
+
12
+ For significant features, please describe the privacy and security implications.
13
+
14
+ - type: textarea
15
+ id: problem
16
+ attributes:
17
+ label: Problem
18
+ description: What problem would this feature solve?
19
+ validations:
20
+ required: true
21
+
22
+ - type: textarea
23
+ id: solution
24
+ attributes:
25
+ label: Proposed solution
26
+ description: Describe the feature you would like.
27
+ validations:
28
+ required: true
29
+
30
+ - type: textarea
31
+ id: alternatives
32
+ attributes:
33
+ label: Alternatives considered
34
+ description: Are there other ways to solve this problem?
35
+
36
+ - type: textarea
37
+ id: privacy
38
+ attributes:
39
+ label: Privacy and security considerations
40
+ description: |
41
+ Could this feature expose additional personal data, require network access,
42
+ introduce write access, or affect the local-first architecture?
43
+
44
+ - type: textarea
45
+ id: additional
46
+ attributes:
47
+ label: Additional context
48
+ description: Add any other context, examples, or references.
49
+
50
+ - type: checkboxes
51
+ id: checklist
52
+ attributes:
53
+ label: Checklist
54
+ options:
55
+ - label: I have searched existing issues and feature requests.
56
+ required: true
@@ -0,0 +1,36 @@
1
+ ## Summary
2
+
3
+ Describe what this pull request changes and why.
4
+
5
+ ## Related Issue
6
+
7
+ Closes #
8
+
9
+ ## Changes
10
+
11
+ -
12
+ -
13
+ -
14
+
15
+ ## Testing
16
+
17
+ Describe how you tested these changes.
18
+
19
+ ```text
20
+ Commands run:
21
+ ```
22
+
23
+ ## Privacy and Security
24
+
25
+ Please check all that apply:
26
+
27
+ - [ ] This change does not introduce unnecessary telemetry or tracking.
28
+ - [ ] This change does not expose additional personal user data.
29
+ - [ ] This change does not introduce unexpected network communication.
30
+ - [ ] This change does not modify user data unexpectedly.
31
+ - [ ] No credentials, tokens, private databases, or personal data are included.
32
+
33
+ ## Documentation
34
+
35
+ - [ ] Documentation was updated where necessary.
36
+ - [ ] No documentation changes are required.
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install dependencies
22
+ run: pip install -r requirements-dev.txt
23
+
24
+ - name: Run test suite
25
+ run: pytest tests/ -v
26
+
27
+ - name: Check server.py syntax
28
+ run: python -m py_compile server.py && echo "server.py OK"
29
+
30
+ - name: Check init_db.py syntax
31
+ run: python -m py_compile init_db.py && echo "init_db.py OK"
32
+
33
+ - name: Test database initialization
34
+ run: |
35
+ python init_db.py sample_data/health_sample.csv
36
+ python -c "
37
+ import sqlite3
38
+ conn = sqlite3.connect('data/health.db')
39
+ count = conn.execute('SELECT COUNT(*) FROM daily_metrics').fetchone()[0]
40
+ assert count > 0, 'No rows loaded'
41
+ print(f'health.db OK — {count} rows')
42
+ "
43
+
44
+ - name: Test server imports cleanly
45
+ run: python -c "import server; print('server imports OK')"
@@ -0,0 +1,14 @@
1
+ # Personal data — never commit this
2
+ data/
3
+ *.db
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.pyc
8
+ .venv/
9
+ venv/
10
+ *.egg-info/
11
+
12
+ # OS
13
+ .DS_Store
14
+ Thumbs.db
@@ -0,0 +1,52 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of experience
7
+ level, background, identity, or personal characteristics.
8
+
9
+ We are committed to fostering an open, welcoming, respectful, and collaborative
10
+ environment.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment include:
15
+
16
+ - Being respectful and constructive in discussions.
17
+ - Welcoming different viewpoints and experiences.
18
+ - Giving and accepting constructive feedback.
19
+ - Focusing on what is best for the project and its community.
20
+ - Showing empathy toward other community members.
21
+ - Respecting the privacy and security principles of the project.
22
+
23
+ Examples of unacceptable behavior include:
24
+
25
+ - Harassment, discrimination, or personal attacks.
26
+ - Trolling, insulting, or deliberately disruptive comments.
27
+ - Publishing another person's private information without permission.
28
+ - Sharing sensitive data, credentials, personal health data, or other confidential information.
29
+ - Misrepresenting the project's capabilities or security guarantees.
30
+ - Any other conduct that could reasonably be considered inappropriate in a
31
+ professional and collaborative environment.
32
+
33
+ ## Enforcement Responsibilities
34
+
35
+ Project maintainers are responsible for clarifying and enforcing our standards
36
+ of acceptable behavior.
37
+
38
+ Maintainers may remove, edit, or reject comments, commits, code, issues, pull
39
+ requests, or other contributions that do not align with this Code of Conduct.
40
+
41
+ ## Scope
42
+
43
+ This Code of Conduct applies within all project spaces, including GitHub issues,
44
+ pull requests, discussions, community communication channels, and public
45
+ representation of the project.
46
+
47
+ ## Reporting Issues
48
+
49
+ If you experience or witness unacceptable behavior, please report it privately
50
+ to the project maintainers.
51
+
52
+ Please do not post sensitive reports, personal information, credentials, or
@@ -0,0 +1,108 @@
1
+ # Contributing to Quantified Self MCP
2
+
3
+ Thank you for your interest in contributing to Quantified Self MCP.
4
+
5
+ This project aims to provide a privacy-first, local MCP server for querying
6
+ personal data through AI assistants while keeping users in control of their data.
7
+
8
+ We welcome bug reports, documentation improvements, tests, feature ideas, and
9
+ code contributions.
10
+
11
+ ## Before You Start
12
+
13
+ Before making significant changes:
14
+
15
+ 1. Check existing issues and pull requests.
16
+ 2. Open an issue to discuss large features or architectural changes.
17
+ 3. Make sure your contribution aligns with the project's privacy-first and
18
+ local-first principles.
19
+
20
+ For small fixes, documentation improvements, and test improvements, you can
21
+ usually open a pull request directly.
22
+
23
+ ## Development Setup
24
+
25
+ Clone the repository:
26
+
27
+ ```bash
28
+ git clone https://github.com/Thecimal/quantified-self-mcp.git
29
+ cd quantified-self-mcp
30
+ ```
31
+
32
+ Create and activate your development environment according to the installation
33
+ instructions in the README.
34
+
35
+ Install the required dependencies:
36
+
37
+ ```bash
38
+ pip install -r requirements.txt
39
+ ```
40
+
41
+ Run the available tests before submitting changes.
42
+
43
+ ## Project Principles
44
+
45
+ ### Privacy First
46
+
47
+ Do not introduce unnecessary telemetry, tracking, analytics, or network
48
+ communication.
49
+
50
+ Personal user data should remain under the user's control.
51
+
52
+ ### Local First
53
+
54
+ The project should continue to work locally without requiring cloud
55
+ infrastructure unless an optional integration explicitly documents otherwise.
56
+
57
+ ### Security
58
+
59
+ Do not commit:
60
+
61
+ - API keys
62
+ - Access tokens
63
+ - Passwords
64
+ - Private keys
65
+ - Personal databases
66
+ - Personal health data
67
+ - Real user datasets
68
+
69
+ Use synthetic or anonymized sample data for tests and examples.
70
+
71
+ ### Data Safety
72
+
73
+ Contributors should not introduce unexpected modification of user data.
74
+
75
+ Any future write functionality should require explicit discussion, documentation,
76
+ and security review.
77
+
78
+ ## Making Changes
79
+
80
+ 1. Fork the repository.
81
+ 2. Create a new branch.
82
+ 3. Make your changes.
83
+ 4. Add or update tests where appropriate.
84
+ 5. Update documentation if user-facing behavior changes.
85
+ 6. Run the test suite.
86
+ 7. Commit your changes with a clear commit message.
87
+ 8. Open a pull request.
88
+
89
+ ## Code Quality
90
+
91
+ Please aim for contributions that are:
92
+
93
+ - Clear and readable.
94
+ - Focused on a single purpose.
95
+ - Covered by tests when practical.
96
+ - Documented when behavior changes.
97
+ - Compatible with supported Python versions.
98
+ - Consistent with the existing project architecture.
99
+
100
+ Avoid unrelated refactoring in the same pull request.
101
+
102
+ ## Testing
103
+
104
+ Before opening a pull request, verify that:
105
+
106
+ - Existing tests still pass.
107
+ - New functionality is tested when appropriate.
108
+ - Sample data does not contain real private information.
@@ -0,0 +1,39 @@
1
+ # Dockerfile for quantified-self-mcp (https://github.com/Thecimal/quantified-self-mcp)
2
+ #
3
+ # This server is Python-only (FastMCP) — there is no server.js / Node.js
4
+ # entrypoint anywhere in this repo. Building from an explicit Python base
5
+ # image here, instead of relying on Glama's generic buildpack, guarantees
6
+ # `python` and `pip` are actually present in the image and that the
7
+ # platform launches `python server.py` (not a Node.js fallback).
8
+ #
9
+ # Build:
10
+ # docker build -t quantified-self-mcp .
11
+ # Run (stdio MCP server):
12
+ # docker run -i --rm -v "$PWD/data:/app/data" quantified-self-mcp
13
+
14
+ FROM python:3.12-slim
15
+
16
+ ENV PYTHONUNBUFFERED=1 \
17
+ PIP_NO_CACHE_DIR=1 \
18
+ PIP_DISABLE_PIP_VERSION_CHECK=1
19
+
20
+ WORKDIR /app
21
+
22
+ # Install dependencies first so this layer is cached across source edits.
23
+ COPY requirements.txt ./
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Application source. init_db.py and sample_data are included so the
27
+ # server can be seeded with example data inside the container.
28
+ COPY server.py init_db.py ./
29
+ COPY sample_data ./sample_data
30
+
31
+ # health.db / finance.db live here by default (see server.py). Point them
32
+ # at Glama's persistent volume mount (/data) so a redeploy doesn't wipe
33
+ # your data; override with your own path if you're not on Glama.
34
+ ENV HEALTH_DB_PATH=/data/health.db \
35
+ FINANCE_DB_PATH=/data/finance.db
36
+
37
+ # Talks to its client over stdio — Glama (and Claude Desktop) wrap stdio
38
+ # servers automatically, so the container just needs to run the process.
39
+ ENTRYPOINT ["python", "server.py"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Behnoud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.5
2
+ Name: quantified-self-mcp
3
+ Version: 0.1.0
4
+ Summary: Local MCP server for personal health and finance data
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Behnoud
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ License-File: LICENSE
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: fastmcp<4.0,>=3.0
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Quantified Self MCP
32
+
33
+ [![Glama MCP Server](https://glama.ai/mcp/servers/Thecimal/quantified-self-mcp/badge)](https://glama.ai/mcp/servers/Thecimal/quantified-self-mcp)
34
+
35
+ *Try it Live!*
36
+
37
+ **A private, local-first MCP server that lets LLMs access your personal health data.**
38
+
39
+ Quantified Self MCP connects an LLM to health data stored on your computer using the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
40
+
41
+ It is **not limited to Claude**. It can work with local LLMs as well as cloud-based models that support MCP.
42
+
43
+ ## Privacy first
44
+
45
+ Your health data is stored locally in SQLite, and the MCP server runs entirely on your computer.
46
+
47
+ ```text
48
+ Your Health Data
49
+ ↓
50
+ Local SQLite
51
+ ↓
52
+ MCP Server
53
+ ↓
54
+ LLM
55
+ ```
56
+
57
+ For maximum privacy, use a local LLM so everything stays on your machine.
58
+
59
+ Cloud LLMs such as Claude can also be used. In that case, your database and MCP server remain local, but the data returned to the model may be sent to the cloud provider.
60
+
61
+ ## Current functionality
62
+
63
+ The server currently provides three tools:
64
+
65
+ **`read_health_data`** — read-only
66
+
67
+ It can access:
68
+
69
+ * Daily steps
70
+ * Sleep duration
71
+ * Resting heart rate
72
+ * Weight (kg)
73
+ * Workout minutes
74
+ * Mood (1–10 scale)
75
+ * Water intake (ml)
76
+ * Data for a selected date range
77
+
78
+ Every field is optional per day — log just the metrics you actually track.
79
+
80
+ **`log_daily_metric`** — write
81
+
82
+ Lets the LLM record any of the metrics above for a given day, without you touching a CSV or SQLite directly. Pass just the fields you're logging (e.g. only `mood`) and the rest of that day's data is left exactly as it was — nothing is ever cleared, only set. Values are checked against generous sanity bounds before being written (e.g. `mood` 1–10, `resting_heart_rate` 20–250 bpm) — this catches unit mix-ups and typos, not "abnormal" readings. It's a plain per-date upsert into `daily_metrics`; there's no way for it (or anything else in this server) to run arbitrary SQL. The same bounds are applied to CSV imports via `init_db.py`, so a bad value there is skipped with a warning rather than silently loaded.
83
+
84
+ **`clear_metric`** — write
85
+
86
+ Blanks out a single metric for a single day, for undoing a bad `log_daily_metric` call (wrong date, wrong units, etc.) without needing to re-run `init_db.py`.
87
+
88
+ ## Installation
89
+
90
+ ```bash
91
+ git clone https://github.com/Thecimal/quantified-self-mcp.git
92
+ cd quantified-self-mcp
93
+
94
+ python3 -m venv .venv
95
+ source .venv/bin/activate
96
+ pip install -r requirements.txt
97
+ ```
98
+
99
+ Initialize the database:
100
+
101
+ ```bash
102
+ python init_db.py sample_data/health_sample.csv
103
+ ```
104
+
105
+ CSV columns: `date, steps, sleep_hours, resting_heart_rate` are required;
106
+ `weight_kg, workout_minutes, mood, water_ml` are optional — include any
107
+ subset of them. Re-running `init_db.py` upserts by date, and a CSV that
108
+ omits an optional column leaves that column's existing values alone
109
+ rather than clearing them, so you can add a new metric later without
110
+ disturbing what's already logged. An existing database is migrated
111
+ automatically, so upgrading never requires deleting it.
112
+
113
+ ## Using it with LLMs
114
+
115
+ Use it with any MCP-compatible client and model.
116
+
117
+ Examples:
118
+
119
+ * Local LLMs
120
+ * Claude
121
+ * Other MCP-compatible LLMs
122
+
123
+ Example:
124
+
125
+ > How has my sleep changed over the last 30 days?
126
+
127
+ The LLM retrieves the relevant data through MCP and analyzes it.
128
+
129
+ ## Project structure
130
+
131
+ ```text
132
+ server.py # MCP server
133
+ logic.py # Data validation and analysis
134
+ init_db.py # Database initialization
135
+ sample_data/ # Example health data
136
+ ```
137
+
138
+ ## Philosophy
139
+
140
+ **Your data stays yours.**
141
+
142
+ Keep your personal data local, give the LLM controlled access, and choose whether the model runs locally or in the cloud.
143
+
144
+ ## License
145
+
146
+ MIT