fartlek-mcp 0.3.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.
- fartlek_mcp-0.3.0/.dockerignore +21 -0
- fartlek_mcp-0.3.0/.github/workflows/ci.yml +18 -0
- fartlek_mcp-0.3.0/.github/workflows/release.yml +27 -0
- fartlek_mcp-0.3.0/.gitignore +54 -0
- fartlek_mcp-0.3.0/.mcp.json +8 -0
- fartlek_mcp-0.3.0/Dockerfile +28 -0
- fartlek_mcp-0.3.0/LICENSE +202 -0
- fartlek_mcp-0.3.0/PKG-INFO +122 -0
- fartlek_mcp-0.3.0/README.md +96 -0
- fartlek_mcp-0.3.0/fartlek/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/analytics/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/analytics/alerts.py +246 -0
- fartlek_mcp-0.3.0/fartlek/analytics/attribution.py +168 -0
- fartlek_mcp-0.3.0/fartlek/analytics/baselines.py +175 -0
- fartlek_mcp-0.3.0/fartlek/analytics/convergence.py +228 -0
- fartlek_mcp-0.3.0/fartlek/analytics/efficiency.py +374 -0
- fartlek_mcp-0.3.0/fartlek/analytics/fusion.py +411 -0
- fartlek_mcp-0.3.0/fartlek/analytics/gear.py +159 -0
- fartlek_mcp-0.3.0/fartlek/analytics/load.py +152 -0
- fartlek_mcp-0.3.0/fartlek/analytics/matcher.py +204 -0
- fartlek_mcp-0.3.0/fartlek/analytics/pmc.py +204 -0
- fartlek_mcp-0.3.0/fartlek/analytics/precedent.py +215 -0
- fartlek_mcp-0.3.0/fartlek/analytics/projection.py +203 -0
- fartlek_mcp-0.3.0/fartlek/analytics/race.py +238 -0
- fartlek_mcp-0.3.0/fartlek/analytics/sleep.py +295 -0
- fartlek_mcp-0.3.0/fartlek/analytics/tid.py +256 -0
- fartlek_mcp-0.3.0/fartlek/analytics/trends.py +343 -0
- fartlek_mcp-0.3.0/fartlek/cli.py +447 -0
- fartlek_mcp-0.3.0/fartlek/health/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/health/adapters/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/health/adapters/garmin_connect.py +248 -0
- fartlek_mcp-0.3.0/fartlek/health/adapters/garmin_export.py +520 -0
- fartlek_mcp-0.3.0/fartlek/health/domain.py +20 -0
- fartlek_mcp-0.3.0/fartlek/health/exceptions.py +19 -0
- fartlek_mcp-0.3.0/fartlek/health/ports.py +25 -0
- fartlek_mcp-0.3.0/fartlek/health/service.py +252 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/context.py +339 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/prompts.py +119 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/server.py +540 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/setup_state.py +177 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/__init__.py +20 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/_zones.py +53 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/activities.py +268 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/activity.py +730 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/athlete.py +307 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/brief.py +489 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/fitness.py +647 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/gear.py +167 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/load.py +507 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/log_tool.py +257 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/raw.py +360 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/recovery.py +333 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/reference.py +723 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/set_profile.py +236 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/setup_tool.py +171 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/sync_tool.py +126 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/week.py +672 -0
- fartlek_mcp-0.3.0/fartlek/mcp_server/tools/whats_changed.py +263 -0
- fartlek_mcp-0.3.0/fartlek/paths.py +31 -0
- fartlek_mcp-0.3.0/fartlek/render/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/render/renderer.py +291 -0
- fartlek_mcp-0.3.0/fartlek/store/__init__.py +3 -0
- fartlek_mcp-0.3.0/fartlek/store/schema.sql +224 -0
- fartlek_mcp-0.3.0/fartlek/store/store.py +575 -0
- fartlek_mcp-0.3.0/fartlek/sync/__init__.py +0 -0
- fartlek_mcp-0.3.0/fartlek/sync/engine.py +2089 -0
- fartlek_mcp-0.3.0/fartlek/sync/export_import.py +124 -0
- fartlek_mcp-0.3.0/pyproject.toml +67 -0
- fartlek_mcp-0.3.0/server.json +23 -0
- fartlek_mcp-0.3.0/tests/conftest.py +37 -0
- fartlek_mcp-0.3.0/tests/golden_renders.py +183 -0
- fartlek_mcp-0.3.0/tests/test_alerts.py +298 -0
- fartlek_mcp-0.3.0/tests/test_attribution.py +173 -0
- fartlek_mcp-0.3.0/tests/test_attribution_language.py +114 -0
- fartlek_mcp-0.3.0/tests/test_baselines.py +271 -0
- fartlek_mcp-0.3.0/tests/test_budget_gate.py +88 -0
- fartlek_mcp-0.3.0/tests/test_cli.py +295 -0
- fartlek_mcp-0.3.0/tests/test_context.py +260 -0
- fartlek_mcp-0.3.0/tests/test_convergence.py +157 -0
- fartlek_mcp-0.3.0/tests/test_efficiency.py +303 -0
- fartlek_mcp-0.3.0/tests/test_export_mode.py +268 -0
- fartlek_mcp-0.3.0/tests/test_fusion.py +425 -0
- fartlek_mcp-0.3.0/tests/test_garmin_export.py +255 -0
- fartlek_mcp-0.3.0/tests/test_gear.py +159 -0
- fartlek_mcp-0.3.0/tests/test_gear_sync.py +398 -0
- fartlek_mcp-0.3.0/tests/test_guardrails.py +189 -0
- fartlek_mcp-0.3.0/tests/test_load.py +213 -0
- fartlek_mcp-0.3.0/tests/test_matcher.py +180 -0
- fartlek_mcp-0.3.0/tests/test_pmc.py +272 -0
- fartlek_mcp-0.3.0/tests/test_precedent.py +187 -0
- fartlek_mcp-0.3.0/tests/test_projection.py +153 -0
- fartlek_mcp-0.3.0/tests/test_prompts.py +63 -0
- fartlek_mcp-0.3.0/tests/test_race.py +222 -0
- fartlek_mcp-0.3.0/tests/test_renderer.py +292 -0
- fartlek_mcp-0.3.0/tests/test_setup.py +422 -0
- fartlek_mcp-0.3.0/tests/test_sleep.py +267 -0
- fartlek_mcp-0.3.0/tests/test_splits.py +277 -0
- fartlek_mcp-0.3.0/tests/test_store.py +547 -0
- fartlek_mcp-0.3.0/tests/test_sync.py +1254 -0
- fartlek_mcp-0.3.0/tests/test_tid.py +209 -0
- fartlek_mcp-0.3.0/tests/test_tool_activities.py +165 -0
- fartlek_mcp-0.3.0/tests/test_tool_activity.py +392 -0
- fartlek_mcp-0.3.0/tests/test_tool_athlete.py +181 -0
- fartlek_mcp-0.3.0/tests/test_tool_brief.py +351 -0
- fartlek_mcp-0.3.0/tests/test_tool_fitness.py +413 -0
- fartlek_mcp-0.3.0/tests/test_tool_gear.py +222 -0
- fartlek_mcp-0.3.0/tests/test_tool_load.py +360 -0
- fartlek_mcp-0.3.0/tests/test_tool_raw.py +305 -0
- fartlek_mcp-0.3.0/tests/test_tool_recovery.py +263 -0
- fartlek_mcp-0.3.0/tests/test_tool_reference.py +306 -0
- fartlek_mcp-0.3.0/tests/test_tool_week.py +439 -0
- fartlek_mcp-0.3.0/tests/test_tool_whats_changed.py +283 -0
- fartlek_mcp-0.3.0/tests/test_tool_writes.py +443 -0
- fartlek_mcp-0.3.0/tests/test_trends.py +308 -0
- fartlek_mcp-0.3.0/tests/test_without_connect_extra.py +90 -0
- fartlek_mcp-0.3.0/uv.lock +1237 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.git
|
|
2
|
+
.github
|
|
3
|
+
.env
|
|
4
|
+
.venv
|
|
5
|
+
.pytest_cache
|
|
6
|
+
__pycache__
|
|
7
|
+
*.pyc
|
|
8
|
+
*.pyo
|
|
9
|
+
*.egg-info
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov
|
|
12
|
+
.mypy_cache
|
|
13
|
+
.ruff_cache
|
|
14
|
+
*.db
|
|
15
|
+
*.db-journal
|
|
16
|
+
data/
|
|
17
|
+
scratchpad/
|
|
18
|
+
private/
|
|
19
|
+
.fartlek/
|
|
20
|
+
garmin_tokens.json
|
|
21
|
+
.DS_Store
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: uv sync --frozen
|
|
17
|
+
- run: uv run ruff check fartlek/ tests/
|
|
18
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publish to PyPI via trusted publishing (OIDC) on version tags.
|
|
4
|
+
# Requires a one-time PyPI trusted-publisher setup and a GitHub environment named `pypi`.
|
|
5
|
+
# No API tokens: identity is proven by GitHub Actions to PyPI directly.
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi # must match the environment name configured on PyPI
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write # required for trusted publishing (OIDC)
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
# Gate the release on the same checks as CI — a bad version can't be
|
|
22
|
+
# re-uploaded, so don't ship one that fails its own tests.
|
|
23
|
+
- run: uv sync --frozen
|
|
24
|
+
- run: uv run ruff check fartlek/ tests/
|
|
25
|
+
- run: uv run pytest -q
|
|
26
|
+
- run: uv build
|
|
27
|
+
- run: uv publish
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
*.egg
|
|
8
|
+
*.egg-info/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# Environment / secrets
|
|
18
|
+
.env
|
|
19
|
+
.env.local
|
|
20
|
+
*.pem
|
|
21
|
+
*.key
|
|
22
|
+
|
|
23
|
+
# uv
|
|
24
|
+
.uv-cache/
|
|
25
|
+
|
|
26
|
+
# IDE
|
|
27
|
+
.vscode/
|
|
28
|
+
.idea/
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
|
|
32
|
+
# macOS
|
|
33
|
+
.DS_Store
|
|
34
|
+
|
|
35
|
+
# Logs
|
|
36
|
+
*.log
|
|
37
|
+
|
|
38
|
+
# Test artifacts
|
|
39
|
+
.pytest_cache/
|
|
40
|
+
.coverage
|
|
41
|
+
htmlcov/
|
|
42
|
+
.mypy_cache/
|
|
43
|
+
.ruff_cache/
|
|
44
|
+
|
|
45
|
+
# Local data
|
|
46
|
+
*.db
|
|
47
|
+
*.sqlite
|
|
48
|
+
*.sqlite3
|
|
49
|
+
|
|
50
|
+
# Playwright MCP page snapshots
|
|
51
|
+
.playwright-mcp/
|
|
52
|
+
|
|
53
|
+
# Local agent instructions
|
|
54
|
+
CLAUDE.md
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
FROM python:3.12-slim
|
|
3
|
+
|
|
4
|
+
# Install uv
|
|
5
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
8
|
+
|
|
9
|
+
# Copy project metadata and install dependencies first (better layer caching)
|
|
10
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
11
|
+
COPY fartlek/ ./fartlek/
|
|
12
|
+
|
|
13
|
+
# The base install reads a Garmin account export and needs no Garmin login.
|
|
14
|
+
# The direct connection is optional and left out of the image by default:
|
|
15
|
+
# docker build --build-arg CONNECT=true -t fartlek-mcp .
|
|
16
|
+
# adds the `connect` extra (garminconnect). Read the README warning first.
|
|
17
|
+
ARG CONNECT=false
|
|
18
|
+
RUN if [ "$CONNECT" = "true" ]; then uv pip install --system ".[connect]"; \
|
|
19
|
+
else uv pip install --system .; fi
|
|
20
|
+
|
|
21
|
+
# The store (and tokens, with the direct connection) live on a volume, not in the image
|
|
22
|
+
ENV FARTLEK_HOME=/data
|
|
23
|
+
VOLUME /data
|
|
24
|
+
|
|
25
|
+
# The MCP server speaks stdio. To import an export, override the entrypoint:
|
|
26
|
+
# docker run --rm -v "$PWD/fartlek-data:/data" -v "$PWD/export.zip:/export/export.zip:ro" \
|
|
27
|
+
# --entrypoint fartlek fartlek-mcp import /export/export.zip
|
|
28
|
+
ENTRYPOINT ["fartlek-mcp"]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Matis Despujols
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fartlek-mcp
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Fartlek — a coach's morning report from your Garmin data, for any LLM via MCP
|
|
5
|
+
Project-URL: Homepage, https://github.com/matisdsp/fartlek
|
|
6
|
+
Project-URL: Repository, https://github.com/matisdsp/fartlek
|
|
7
|
+
Project-URL: Issues, https://github.com/matisdsp/fartlek/issues
|
|
8
|
+
Author: Fartlek contributors
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: coaching,garmin,llm,mcp,running,training
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: fitdecode>=0.11.0
|
|
22
|
+
Requires-Dist: mcp[cli]<2,>=1.27.1
|
|
23
|
+
Provides-Extra: connect
|
|
24
|
+
Requires-Dist: garminconnect>=0.3.6; extra == 'connect'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<!-- mcp-name: io.github.matisdsp/fartlek -->
|
|
28
|
+
|
|
29
|
+
# Fartlek
|
|
30
|
+
|
|
31
|
+
*A coach's morning report from your Garmin data, for any LLM via MCP.*
|
|
32
|
+
|
|
33
|
+
Every other Garmin MCP server hands the LLM a filing cabinet of raw JSON: one night of sleep is ~52K tokens, one activity stream ~155K. The model can't read it, so it skims and improvises. Fartlek does the synthesis server-side: computed sports-science metrics (CTL/ATL/TSB, ACWR, monotony, calibrated training load), personal baselines with significance floors, safety alerts, delivered as compact, verdict-first reports the model can actually reason about.
|
|
34
|
+
|
|
35
|
+
**The token contract:** calling every tool in the catalog once, at default arguments, costs under 17K tokens, about a third of one raw Garmin sleep payload (the sum of the caps below is 16,970; `tests/test_guardrails.py` fails above 17,000). Without `garmin_raw` and `garmin_reference` the sum is 9,970. Hard caps are enforced per response by the renderer, with disclosed truncation, and `tests/test_budget_gate.py` counts golden renders with a real tokenizer.
|
|
36
|
+
|
|
37
|
+
## The tools
|
|
38
|
+
|
|
39
|
+
Caps are in tokens, as set in the code (`CAP` constants in `fartlek/mcp_server/tools/`).
|
|
40
|
+
|
|
41
|
+
| Tool | What it answers | Cap |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `garmin_brief` | "How am I today, can I train hard?" Fused GREEN/AMBER/RED verdict vs your own baselines | 600 |
|
|
44
|
+
| `garmin_activities` | Browse the log, get activity IDs | 1,300 |
|
|
45
|
+
| `garmin_activity` | One session in depth: reps, fade, comparison to your most similar past session (`detail` standard, splits, full) | 1,000 / 2,000 / 4,000 |
|
|
46
|
+
| `garmin_athlete` | Reference card: zones, PRs, goal, data coverage | 600 |
|
|
47
|
+
| `garmin_gear` | Shoe and bike mileage vs the retirement limits you set in Garmin Connect, and what you actually rotate | 500 |
|
|
48
|
+
| `garmin_set_profile` | Tell it your goal race, phase and availability (local only) | 200 |
|
|
49
|
+
| `garmin_log` | Log RPE, wellness, illness or injury; the athlete outranks the sensors | 120 |
|
|
50
|
+
| `garmin_sync` | Re-read the export, or deepen history | 150 |
|
|
51
|
+
| `garmin_setup` | Is the server configured, and what is missing; starts with the export | 400 |
|
|
52
|
+
| `garmin_recovery` | Sleep, HRV, resting HR and load structure vs baselines, plus the overtraining audit | 1,100 |
|
|
53
|
+
| `garmin_load` | Multi-week load: CTL/ATL/TSB, ramp, ACWR, monotony, intensity drift | 1,100 |
|
|
54
|
+
| `garmin_fitness` | VO2max and efficiency trends, race projection against your goal, taper guidance | 1,000 |
|
|
55
|
+
| `garmin_week` | One week in session-level detail, with load vs recent weeks | 1,200 |
|
|
56
|
+
| `garmin_whats_changed` | Only the statistically significant changes of the last N days | 700 |
|
|
57
|
+
| `garmin_reference` | How a number was computed, and whether to trust it | 2,000 per topic |
|
|
58
|
+
| `garmin_raw` | Bounded, compacted escape hatch to named raw sources | 5,000 |
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pipx install fartlek-mcp # or: uv tool install fartlek-mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
1. In your Garmin account, open **Data Management > Export Your Data** and request the export. Garmin
|
|
67
|
+
emails you a download link. It says this usually takes about 48 hours and can take up to 30 days.
|
|
68
|
+
2. Import the zip. Nothing connects to Garmin and no credentials are involved:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
fartlek import ~/Downloads/<your-export>.zip
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. Point your MCP client at the server. Claude Code:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
claude mcp add fartlek -- fartlek-mcp
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Any other MCP client: add a stdio server whose command is `fartlek-mcp`.
|
|
81
|
+
|
|
82
|
+
The report stops at the day of the export. Importing a newer export updates the store. Your own settings
|
|
83
|
+
and log entries are kept.
|
|
84
|
+
|
|
85
|
+
## What the export does not contain
|
|
86
|
+
|
|
87
|
+
Compared on one real account against the Connect API, over 530 activities and 356 days: activities, laps,
|
|
88
|
+
overnight HRV and sleep scores are identical after converting units, and daily totals match on 99 % of days
|
|
89
|
+
or more. A one-account check is not a guarantee for other devices. The export lacks:
|
|
90
|
+
|
|
91
|
+
| Missing | Effect |
|
|
92
|
+
|---|---|
|
|
93
|
+
| Per-minute sleep stages | Sleep regularity index unavailable |
|
|
94
|
+
| Garmin's nightly sleep need | Sleep debt uses 8 h, or the need you set |
|
|
95
|
+
| HRV status and weekly average | Not shown; Fartlek's own HRV band does not use them |
|
|
96
|
+
| Grade-adjusted speed per lap | Efficiency and decoupling use plain speed |
|
|
97
|
+
| Model names of unrenamed gear | Gear may appear under its brand only |
|
|
98
|
+
| Raw detail per session | `garmin_raw` and `garmin_activity detail=full` have nothing to return |
|
|
99
|
+
|
|
100
|
+
## CLI
|
|
101
|
+
|
|
102
|
+
| Command | What it does |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `fartlek import <zip>` | fill the local store from a Garmin account export (`--since YYYY-MM-DD` limits how far back) |
|
|
105
|
+
| `fartlek accounts` | list local accounts |
|
|
106
|
+
| `fartlek export [dir]` | export the store (SQLite snapshot and one CSV per table) |
|
|
107
|
+
| `fartlek reset` | wipe all local data (asks confirmation) |
|
|
108
|
+
|
|
109
|
+
`FARTLEK_HOME` sets the data directory (default `~/.fartlek`). The `Dockerfile` builds the same server: mount
|
|
110
|
+
a data volume on `/data`.
|
|
111
|
+
|
|
112
|
+
## Privacy and Garmin's terms
|
|
113
|
+
|
|
114
|
+
Stdio transport, local SQLite store: your health data stays on your machine, and importing an export contacts
|
|
115
|
+
nobody. The code also contains a direct connection to Garmin Connect. It is off by default and unsupported: it
|
|
116
|
+
reads endpoints Garmin does not publish for third parties, which Garmin's
|
|
117
|
+
[Terms of Use](https://www.garmin.com/en-US/legal/terms-of-use/) do not allow, and Garmin can suspend accounts
|
|
118
|
+
for automated access.
|
|
119
|
+
|
|
120
|
+
## License & trademark
|
|
121
|
+
|
|
122
|
+
Apache 2.0. Fartlek is an independent open-source project, **not affiliated with, endorsed by, or sponsored by Garmin Ltd.** "Garmin" is used only to describe compatibility with Garmin Connect data.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.matisdsp/fartlek -->
|
|
2
|
+
|
|
3
|
+
# Fartlek
|
|
4
|
+
|
|
5
|
+
*A coach's morning report from your Garmin data, for any LLM via MCP.*
|
|
6
|
+
|
|
7
|
+
Every other Garmin MCP server hands the LLM a filing cabinet of raw JSON: one night of sleep is ~52K tokens, one activity stream ~155K. The model can't read it, so it skims and improvises. Fartlek does the synthesis server-side: computed sports-science metrics (CTL/ATL/TSB, ACWR, monotony, calibrated training load), personal baselines with significance floors, safety alerts, delivered as compact, verdict-first reports the model can actually reason about.
|
|
8
|
+
|
|
9
|
+
**The token contract:** calling every tool in the catalog once, at default arguments, costs under 17K tokens, about a third of one raw Garmin sleep payload (the sum of the caps below is 16,970; `tests/test_guardrails.py` fails above 17,000). Without `garmin_raw` and `garmin_reference` the sum is 9,970. Hard caps are enforced per response by the renderer, with disclosed truncation, and `tests/test_budget_gate.py` counts golden renders with a real tokenizer.
|
|
10
|
+
|
|
11
|
+
## The tools
|
|
12
|
+
|
|
13
|
+
Caps are in tokens, as set in the code (`CAP` constants in `fartlek/mcp_server/tools/`).
|
|
14
|
+
|
|
15
|
+
| Tool | What it answers | Cap |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `garmin_brief` | "How am I today, can I train hard?" Fused GREEN/AMBER/RED verdict vs your own baselines | 600 |
|
|
18
|
+
| `garmin_activities` | Browse the log, get activity IDs | 1,300 |
|
|
19
|
+
| `garmin_activity` | One session in depth: reps, fade, comparison to your most similar past session (`detail` standard, splits, full) | 1,000 / 2,000 / 4,000 |
|
|
20
|
+
| `garmin_athlete` | Reference card: zones, PRs, goal, data coverage | 600 |
|
|
21
|
+
| `garmin_gear` | Shoe and bike mileage vs the retirement limits you set in Garmin Connect, and what you actually rotate | 500 |
|
|
22
|
+
| `garmin_set_profile` | Tell it your goal race, phase and availability (local only) | 200 |
|
|
23
|
+
| `garmin_log` | Log RPE, wellness, illness or injury; the athlete outranks the sensors | 120 |
|
|
24
|
+
| `garmin_sync` | Re-read the export, or deepen history | 150 |
|
|
25
|
+
| `garmin_setup` | Is the server configured, and what is missing; starts with the export | 400 |
|
|
26
|
+
| `garmin_recovery` | Sleep, HRV, resting HR and load structure vs baselines, plus the overtraining audit | 1,100 |
|
|
27
|
+
| `garmin_load` | Multi-week load: CTL/ATL/TSB, ramp, ACWR, monotony, intensity drift | 1,100 |
|
|
28
|
+
| `garmin_fitness` | VO2max and efficiency trends, race projection against your goal, taper guidance | 1,000 |
|
|
29
|
+
| `garmin_week` | One week in session-level detail, with load vs recent weeks | 1,200 |
|
|
30
|
+
| `garmin_whats_changed` | Only the statistically significant changes of the last N days | 700 |
|
|
31
|
+
| `garmin_reference` | How a number was computed, and whether to trust it | 2,000 per topic |
|
|
32
|
+
| `garmin_raw` | Bounded, compacted escape hatch to named raw sources | 5,000 |
|
|
33
|
+
|
|
34
|
+
## Quickstart
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pipx install fartlek-mcp # or: uv tool install fartlek-mcp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
1. In your Garmin account, open **Data Management > Export Your Data** and request the export. Garmin
|
|
41
|
+
emails you a download link. It says this usually takes about 48 hours and can take up to 30 days.
|
|
42
|
+
2. Import the zip. Nothing connects to Garmin and no credentials are involved:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
fartlek import ~/Downloads/<your-export>.zip
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. Point your MCP client at the server. Claude Code:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
claude mcp add fartlek -- fartlek-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Any other MCP client: add a stdio server whose command is `fartlek-mcp`.
|
|
55
|
+
|
|
56
|
+
The report stops at the day of the export. Importing a newer export updates the store. Your own settings
|
|
57
|
+
and log entries are kept.
|
|
58
|
+
|
|
59
|
+
## What the export does not contain
|
|
60
|
+
|
|
61
|
+
Compared on one real account against the Connect API, over 530 activities and 356 days: activities, laps,
|
|
62
|
+
overnight HRV and sleep scores are identical after converting units, and daily totals match on 99 % of days
|
|
63
|
+
or more. A one-account check is not a guarantee for other devices. The export lacks:
|
|
64
|
+
|
|
65
|
+
| Missing | Effect |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Per-minute sleep stages | Sleep regularity index unavailable |
|
|
68
|
+
| Garmin's nightly sleep need | Sleep debt uses 8 h, or the need you set |
|
|
69
|
+
| HRV status and weekly average | Not shown; Fartlek's own HRV band does not use them |
|
|
70
|
+
| Grade-adjusted speed per lap | Efficiency and decoupling use plain speed |
|
|
71
|
+
| Model names of unrenamed gear | Gear may appear under its brand only |
|
|
72
|
+
| Raw detail per session | `garmin_raw` and `garmin_activity detail=full` have nothing to return |
|
|
73
|
+
|
|
74
|
+
## CLI
|
|
75
|
+
|
|
76
|
+
| Command | What it does |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `fartlek import <zip>` | fill the local store from a Garmin account export (`--since YYYY-MM-DD` limits how far back) |
|
|
79
|
+
| `fartlek accounts` | list local accounts |
|
|
80
|
+
| `fartlek export [dir]` | export the store (SQLite snapshot and one CSV per table) |
|
|
81
|
+
| `fartlek reset` | wipe all local data (asks confirmation) |
|
|
82
|
+
|
|
83
|
+
`FARTLEK_HOME` sets the data directory (default `~/.fartlek`). The `Dockerfile` builds the same server: mount
|
|
84
|
+
a data volume on `/data`.
|
|
85
|
+
|
|
86
|
+
## Privacy and Garmin's terms
|
|
87
|
+
|
|
88
|
+
Stdio transport, local SQLite store: your health data stays on your machine, and importing an export contacts
|
|
89
|
+
nobody. The code also contains a direct connection to Garmin Connect. It is off by default and unsupported: it
|
|
90
|
+
reads endpoints Garmin does not publish for third parties, which Garmin's
|
|
91
|
+
[Terms of Use](https://www.garmin.com/en-US/legal/terms-of-use/) do not allow, and Garmin can suspend accounts
|
|
92
|
+
for automated access.
|
|
93
|
+
|
|
94
|
+
## License & trademark
|
|
95
|
+
|
|
96
|
+
Apache 2.0. Fartlek is an independent open-source project, **not affiliated with, endorsed by, or sponsored by Garmin Ltd.** "Garmin" is used only to describe compatibility with Garmin Connect data.
|
|
File without changes
|
|
File without changes
|