Using a local iPhone MCP server to plan Apple Watch workouts with Codex

boernei1 pts0 comments

Planning an Apple Watch workout with Codex and Apple Health | Bernhard Hering

Apps · 01.07.2026

Planning an Apple Watch workout with Codex and Apple Health.

Ask My Health turns an iPhone into a local MCP server for HealthKit and WorkoutKit. The practical version: Codex can inspect recent training, explain the gaps, and prepare a structured workout that still needs iPhone approval before it lands on the Apple Watch.

Download Ask My Health<br>More apps

The screenshots are from the iPhone app flow. Local endpoint and token values are redacted.

I had a problem explaining Ask My Health in one sentence. "An MCP server for HealthKit" is true, but it only makes sense if you already care about MCP. The clearer version is this: it lets an agent use your iPhone as a local, permissioned bridge to Apple Health training data.

That matters because Apple Health already has the useful context: workouts, duration, distance, heart rate, power, cadence, HRV, VO2max and recovery signals. Normally, an agent cannot read that data. Ask My Health runs a local server on the iPhone and exposes a small set of tools to trusted clients on the same network.

The setup

The server is local network only. Codex connects to the iPhone endpoint over Streamable HTTP with bearer token authentication. Codex supports HTTP MCP servers and bearer tokens in its MCP configuration, so the app can be added without a cloud account or custom backend.

[mcp_servers.ask_my_health]<br>url = "http://:8787/mcp"<br>bearer_token_env_var = "ASK_MY_HEALTH_TOKEN"<br>default_tools_approval_mode = "prompt"

The token comes from the iPhone app. I do not put it into screenshots, commits or blog posts. After a demo, I rotate it.

The app shows server state, HealthKit availability, WorkoutKit support and pending approvals. Local network details are redacted here.

The prompt

The useful prompt is not "make me fitter". It should tell the agent what data to read, what to avoid guessing, and when to stop for approval.

Use my local Ask My Health MCP server.

Look at my recent cycling workouts and training load.<br>Use HealthKit as the source.<br>Say which fields are missing instead of guessing.

Then suggest one structured Apple Watch workout for tomorrow.<br>Validate it with WorkoutKit.<br>Do not schedule it until I approve it on the iPhone.

That prompt gives Codex enough shape to use the tools in the right order. First authorization and read status. Then recent workouts. Then derived load metrics if the required inputs are available. Only after that should it produce a WorkoutKit plan.

The app includes copyable prompt templates because the best results come from specific, boring prompts.

What Codex can read

For a workout planning session, the agent usually starts with these tools:

healthkit_get_authorization_status checks whether HealthKit read access can be requested.

healthkit_request_read_authorization triggers the native iPhone permission sheet when needed.

healthkit_query_workouts reads recent workouts, filtered by sport and date range.

training_compute_load_metrics computes derived load values when the required HealthKit inputs exist.

The important part is what happens when data is missing. If there is no readable cycling power, the agent should not invent TSS. If there is no recent HRV, it should say so. Health data is useful, but it gets noisy fast when software starts filling gaps with confidence.

Ask My Health is not a medical app and the agent should not give medical advice. It can describe training patterns in HealthKit data and prepare workouts. That is already enough.

Creating the workout

Writing is narrower than reading. The app does not write arbitrary HealthKit values. It can prepare and schedule WorkoutKit workouts, which means structured sessions for the Apple Watch Workout app.

The agent should validate the workout before scheduling it:

workoutkit_get_capabilities<br>workoutkit_get_authorization_status<br>workoutkit_validate_workout_plan<br>workoutkit_schedule_workout

The final scheduling call still requires iPhone approval. That is intentional. An agent may suggest the workout, but the phone remains the place where the user grants HealthKit and WorkoutKit permissions.

WorkoutKit plans are prepared on the iPhone and sync to the Apple Watch through Apple's system flow.

Why this is useful

The product is not another dashboard. It is a small local bridge. The app lets an agent answer questions that are hard to answer from a generic chat window:

What did my last three rides look like?

Did I increase volume too quickly?

What is a sensible next interval workout?

Which data is missing from HealthKit?

Can you prepare that workout for my Apple Watch?

This is where MCP makes sense to me. Not as a buzzword. As a narrow, local interface between an agent and data that should stay on the device unless the user explicitly opens it up.

The tradeoff

The local setup is slightly more work than a cloud login. You need the iPhone and the Mac on the same network. You need...

iphone apple local workout health healthkit

Related Articles