I’m training for a 20 km run, and part of my setup is a tool I normally associate with writing code: OpenCode.
The idea is simple. My Garmin records my runs and recovery data. An MCP server makes that information available to the agent. OpenRouter provides access to the language model. Instead of copying numbers out of Garmin Connect into a chat, I can ask questions with the data already within reach.
This isn’t about letting a language model decide how hard I should run every day. It’s about making my training history easier to review, asking better questions, and reducing the administration around a plan.
The prompts below illustrate the workflow, rather than reproduce saved conversations.
The Stack
There are three pieces:
- OpenCode is the interface: a terminal-based agent that can call tools and work with local files.
- OpenRouter connects it to a language model. The model needs reliable tool-calling support for this workflow.
- Garmin MCP connects to Garmin Connect through the
python-garminconnectlibrary and exposes activities, health summaries, training metrics, and workout tools.
MCP stands for Model Context Protocol. In this setup, it gives the agent a defined set of operations, such as fetching recent activities or reading a workout’s structure. The model doesn’t magically know my Garmin history: it has to request it through those tools.
Connecting Garmin
The project’s README documents a one-time authentication command, using uvx and Python 3.12:
uvx --python 3.12 --from git+https://github.com/Taxuspt/garmin_mcp garmin-mcp-auth
This handles the Garmin login, including MFA when required, and saves authentication tokens locally. There’s no need to put a Garmin password in the OpenCode configuration.
The following is a minimal MCP configuration, adapted from the repository’s OpenCode example. Merge it into an existing configuration rather than replacing other settings:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"garmin": {
"type": "local",
"command": [
"uvx",
"--python",
"3.12",
"--from",
"git+https://github.com/Taxuspt/garmin_mcp",
"garmin-mcp"
],
"enabled": true,
"timeout": 30000
}
}
}
OpenCode supports a global configuration at ~/.config/opencode/opencode.json. After restarting, check the connection with:
opencode mcp list
For the model, connect OpenRouter using /connect, then choose a suitable model with /models. The Garmin connection stays the same when switching models.
Start with What Actually Happened
A generic “make me a 20 km training plan” prompt leaves a lot to guesswork. I’d rather start with recent training and explicitly supply the things a watch cannot know: my available days, how a run felt, and whether anything hurts.
An example opening prompt:
I’m training for a 20 km run on [date]. Review my last four weeks of running: weekly distance, frequency, longest run, and intensity distribution where available. Ask about my schedule, experience, and any pain before proposing changes. Clearly separate recorded data from interpretation. Don’t modify anything in Garmin.
That last sentence matters. Reading activities and changing my calendar are different permissions, even if both are available through the same server.
The useful output is not necessarily a complicated plan. It might be a compact summary that makes an inconsistent week or a sudden jump in running volume easier to spot.
Review Recovery in Context
Garmin exposes more than pace and distance. Depending on the device and available data, the server can retrieve sleep, HRV, resting heart rate, training status, and recovery information.
Those numbers are context, not instructions. A single bad night or an unusual HRV reading shouldn’t automatically rewrite a training week.
An example check-in:
Compare my recent running load with the previous weeks, and review the last two weeks of available sleep and HRV data. I felt [description] on my last run. What supports keeping the next session as planned, and what supports making it easier? Flag missing data and don’t treat any metric as a diagnosis.
I want the reasoning to remain inspectable: which observations came from Garmin, which came from me, and which conclusions are uncertain.
From a Conversation to a Workout
The server also supports creating structured workouts and scheduling them in Garmin Connect. That closes an interesting loop: a conversation can produce something executable on the watch, rather than another paragraph I have to translate manually.
I’d keep that as a separate, explicit step:
Show me the proposed workout first, including warmup, work intervals, recovery, cooldown, and total duration. Explain whether the targets use my configured Garmin zones or a custom range. Wait for approval before creating or scheduling it.
After approval, the agent can use the appropriate workout tools. Scheduled workouts reach the watch’s calendar through Garmin sync; creating a workout in the library alone is not the same as scheduling it.
I’d also check the saved structure before running it. A plausible description in chat doesn’t guarantee that the uploaded interval count or target range is correct.
The Privacy Trade-off
A local MCP server does not make this an entirely local AI setup.
Garmin authentication tokens stay on the machine running the server, but tool results included in model requests are sent through OpenRouter to the selected model provider. Activity details can contain sensitive information, including location data.
For this workflow, summaries are often enough. I don’t need a full GPS track to discuss weekly consistency. It’s worth limiting the tools exposed, requesting only relevant data, and reviewing the applicable OpenRouter and provider data policies.
The Garmin MCP project supports tool profiles and explicit allowlists. A read-only selection is a sensible starting point; workout creation and other write operations can be added deliberately.
What I Want from This Experiment
The goal isn’t an AI-generated prediction of my finish time. It’s a useful feedback loop:
- Run and record the session.
- Review what happened alongside how it felt.
- Decide whether the next sessions still make sense.
- Approve any changes before they reach Garmin.
There are limits. Wearable measurements are imperfect, the model can misinterpret them, and neither replaces a qualified coach or medical advice when needed. I still have to notice pain, explain fatigue, and make the final decision.
What interests me is that the same agent interface used for software work can also make personal data easier to work with. Garmin MCP supplies the tools, OpenCode coordinates the interaction, and OpenRouter lets me choose the model.
The running part, unfortunately, is still mine.