شعار Garmin Connect Plugin For Dsh

Garmin Connect Plugin For Dsh

المجتمع
Likenttt

A TypeScript-based Garmin Connect plugin and MCP server with secure browser-based MFA, built for DeepSeek Harness and designed to work with other AI agents.

الناشرLikenttt
المستودعgarmin-connect-plugin-for-dsh
اللغةTypeScript
التفريعات
7
النجوم
41
الأدوات المتاحة
0
نوع نقل البياناتstdio
الفئات
الترخيصMIT
الروابط
  • اربط الأدوات بسير عمل الذكاء الاصطناعي

    يتيح Garmin Connect Plugin For Dsh إمكانات MCP التي يمكن لتطبيقات الذكاء الاصطناعي العميلة ووكلاء الذكاء الاصطناعي المتوافقة استخدامها.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم أمثلة إعداد التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات الاهتمام بالمصدر المفتوح

    النجوم: 41، والنسخ المتفرعة: 7 في المستودع المرتبط.

dsh-plugin-garmin-connect

A TypeScript-based Garmin Connect plugin and MCP server with official Personal API and secure browser-based MFA, built for DeepSeek Harness and designed to work with other AI agents.

npm version npm downloads CI Test Report Node.js License: MIT

English | 简体中文 | Test Report | Changelog

Developed by Li Erniu (李二牛), connecting Garmin training to your AI assistant.

This open-source DeepSeek Harness plugin and MCP connector support Garmin China and International accounts. Explore full activities and splits, sleep, heart rate and HRV with AI, then create, schedule or delete workouts or cancel calendar entries after your confirmation.

You control your account. Your password is not shared with AI. With the recommended Garmin browser sign-in, passwords and verification codes are entered only on Garmin’s official page, not given to AI or the developer. Session credentials are stored locally with restricted file permissions. Authorized fitness and health queries return data to your chosen AI client for analysis.

[!NOTE] MFA support in 0.1.6: local dsh Web, the garmin-connect-auth serve system-browser flow, and MCP URL elicitation can bootstrap the same owner-only session for China and International accounts. Real-account MFA completed in both regions on 2026-08-29, including a full China-region browser-to-session-and-read chain and an International-region system-browser DI exchange with owner-only session persistence. Browser policy may still block an individual flow. The older login --browser command is retained only as a diagnostic.


More Apps

IconAppWhat it does
WristTaleRead TXT and Markdown on your Garmin, Apple, and Android watch
JiaKe.appTurn Garmin screenshots into polished assets
GameraSnapControl your phone camera from your Garmin watch
WristAlbumKeep a private photo album on your Garmin
WristPassKeep cards and tickets ready on your wrist
2FA4GKeep offline 2FA codes on your Garmin

What It Does

This plugin connects DeepSeek Harness or any MCP-compatible AI agent to Garmin Connect, exposing your wearable data as AI-callable tools. Once installed, the agent can automatically query your activities, sleep, steps, and heart rate to provide personalized fitness insights — all through natural language.

Registered Tools

Version 0.1.20 provides 29 tools for Connect web-session accounts. Twenty-four provide queries or local advice without writing; download_garmin_activity_fit writes one local file on the MCP/dsh host. Creating, scheduling or deleting a workout and cancelling a calendar entry change Garmin data after explicit confirmation. Personal-only DSH connections and Personal MCP servers expose 15 compatible tools for Garmin reads, local FIT downloads and local coaching knowledge. Mixed DSH accounts keep the combined tool set and route each call by the selected account’s capabilities. The 13 recovery and training tools introduced in 0.1.14 depend on the published maintained SDK through an exact npm alias; see Maintained SDK dependency.

ToolDescriptionExample Args
get_garmin_activitiesFetch recent activities (runs, rides, swims…) with full detail by default; compact is optional{"limit": 5}
get_garmin_sleepSleep score, duration, and stage breakdown for a date or range{"startDate": "2023-10-01", "endDate": "2023-10-02"}
get_garmin_stepsStep totals for a date or range; goal/distance appear only when Garmin supplies them{"startDate": "2023-10-01"}
get_garmin_heart_rateResting, max, and min heart rate for a date or range{"startDate": "2023-10-01", "endDate": "2023-10-02"}
get_garmin_weightBody composition (weight, BMI, body fat %, muscle mass, etc.) for a date or range{"startDate": "2023-10-01"}
get_garmin_workoutsWorkout templates from your Garmin workout library (not calendar scheduling){"limit": 10, "offset": 0}
get_garmin_profileUser profile summary{} or omit
get_running_skill_adviceExplain 8 workout types and 4 training philosophies, or collect the mandatory intake for personalized coaching{"mode": "explain", "query": "Daniels", "language": "en"}
download_garmin_activity_fitDownload an activity's original archive and safely extract its single FIT file to the account directory under the configured host parent{"activityId": 123456789}
create_garmin_workoutPreview and confirm a structured workout; optionally schedule it on scheduleDate{"name": "Threshold 3×8min", "steps": [...], "scheduleDate": "2026-10-24"}
schedule_garmin_workoutPreview and confirm a calendar date for an existing workout{"workoutId": "123456", "date": "2026-10-24"}

Recovery and training tools (introduced in 0.1.14)

These tools are shared by DSH and MCP and map directly to the maintained SDK:

ToolSDK methodData and example arguments
get_garmin_hrvgetHrvDataDaily HRV status, baseline and overnight readings; {"date":"2026-10-15"}
get_garmin_hrv_summariesgetHrvSummariesDaily HRV summaries; {"startDate":"2026-10-09","endDate":"2026-10-15"}
get_garmin_stressgetStressDataDaily stress and available Body Battery time series; {"date":"2026-10-15"}
get_garmin_stress_summariesgetStressSummariesDaily stress summaries; {"startDate":"2026-10-09","endDate":"2026-10-15"}
get_garmin_body_batterygetBodyBatteryDaily Body Battery reports and time series; {"startDate":"2026-10-09","endDate":"2026-10-15"}
get_garmin_training_readinessgetTrainingReadinessEvery readiness snapshot and recovery factor; {"date":"2026-10-15"}
get_garmin_daily_training_statusgetDailyTrainingStatusDaily status and acute/chronic load across returned devices; {"date":"2026-10-15"}
get_garmin_training_statusgetTrainingStatusAggregated training status, VO2 max and load; {"date":"2026-10-15"}
get_garmin_training_load_balancegetTrainingLoadBalanceFour-week load balance ending on a date; {"date":"2026-10-15"}
get_garmin_max_metricsgetMaxMetricsDaily max metrics, including available VO2 max; {"date":"2026-10-15"}
get_garmin_max_metrics_rangegetMaxMetricsRangeMax metrics through a native range request; {"startDate":"2026-10-09","endDate":"2026-10-15"}
get_garmin_race_predictionsgetRacePredictionsLatest predictions for the authenticated account; {}
get_garmin_race_predictions_rangegetRacePredictionsRangePrediction history; {"startDate":"2026-10-09","endDate":"2026-10-15","aggregation":"daily"}

Blood oxygen and respiration (introduced in 0.1.18)

These read-only tools are shared by DSH and MCP and use the maintained SDK's authenticated HTTP transport. They preserve the complete service response, including available summary fields, descriptors and time series:

ToolClient methodData and example arguments
get_garmin_spo2getSpO2DataDaily blood oxygen (SpO₂) data; {"date":"2026-10-20"}
get_garmin_respirationgetRespirationDataDaily respiration data; {"date":"2026-10-20"}

Ask, for example: “Show my blood oxygen and respiration records for October 20, 2026.” Both tools take a single date; no range parameter is accepted. Availability depends on the selected account, date and recorded device data. Missing fields, null and empty arrays stay missing; they are not converted to zero. Update the plugin/MCP server and reconnect before using these tools, then check the actual tool schemas.

On 2026-10-21, existing China and International sessions passed the shared DSH/MCP read checks, and all four new-tool calls succeeded in a real Harness desktop conversation using the local release candidate. The International account returned blood oxygen and respiration records; the China account returned successful responses with no measurements on the tested dates. See the verification record.

Daily tools use date, defaulting to the host's current local date. Range tools use inclusive startDate and endDate; the start defaults to today and the end defaults to the start. Race prediction history accepts aggregation: "daily" (default) or "monthly", with a maximum calendar span of 366 days. Inputs must be real calendar dates in YYYY-MM-DD format. The service response fields, device maps, unknown fields and complete time series are retained. null and empty arrays are valid no-data results, not authentication failures.

When multiple Harness accounts are configured, add the stable account ID shown in settings as the tool's account argument. With only one configured account, the parameter can be omitted. Display aliases and regions help identify accounts but do not change their IDs. This also applies to all recovery tools, for example {"account":"personal","date":"2026-10-15"}. Standalone MCP uses the account configured for its process; select the corresponding MCP server instead of adding an account argument.

Workout creation is a two-call flow. The preview response includes a one-time confirmationId; after the user approves the unchanged preview, call the tool again with the same definition, confirmed: true, and that confirmationId. An ID expires after 10 minutes and cannot be reused.

Schedule a workout (0.1.20)

With a Connect web-session account, you can ask: “Create this workout and arrange it for 2026-10-24” or “Schedule workout 123456 for 2026-10-24.” Personal API accounts remain read-only. This capability is available in 0.1.20.

  • New workout: add optional scheduleDate: "2026-10-24" to create_garmin_workout. One preview covers both the workout and its date; after explicit approval, repeat the unchanged inputs with confirmed: true and the returned confirmationId. Without scheduleDate, creation saves only to the library.
  • Existing workout: preview schedule_garmin_workout with workoutId and date, then confirm the same account, workout and date with confirmed: true and the one-use confirmationId. Changing any of them requires a fresh preview and approval.
  • Result: a successful calendar write is “scheduled, waiting for Garmin Connect sync.” The plugin does not trigger watch synchronization or confirm delivery to the watch. Scheduling adds a new calendar entry; moving or cancelling an existing entry is a separate, explicitly requested operation.

If the workout is created but scheduling fails, retain the returned workoutId. Read the target date with get_garmin_scheduled_workouts; if scheduling is still needed, preview and confirm only schedule_garmin_workout. Do not repeat creation. Read back any uncertain write outcome before another attempt.

The development candidate passed a real Harness desktop check with the China main account: both creation with a date and scheduling an existing template succeeded. The test template and both calendar entries were removed afterward; the original 42 library entries were preserved. See the verification record.

Workout deletion and calendar cancellation (0.1.17)

Version 0.1.17 introduced these three workout management tools (26 tools in that release):

Both write operations passed a live Harness desktop check with the China account; see the workout management verification record (Chinese).

ToolPurposePreview arguments
get_garmin_scheduled_workoutsRead an inclusive range of up to 31 calendar days and discover actual schedule IDs{"startDate":"2026-10-18","endDate":"2026-10-24"}
delete_garmin_workoutDelete a template from the workout library{"workoutId":"123456"}
unschedule_garmin_workoutCancel one calendar entry while retaining its library template{"scheduleId":"654321"}

workoutId and scheduleId identify different resources. Positive decimal ID strings are accepted; numeric IDs must be JavaScript safe integers. Both destructive tools first read the target and return a preview. After user approval, submit the same target, confirmed: true and its confirmationId. Confirmations bind the account, operation and target details, expire after ten minutes and work once; a changed target requires a new preview. Read back uncertain outcomes before another attempt; writes are not automatically replayed.

Personalized running coaching

get_running_skill_advice deliberately separates explanation from planning:

  • mode: "explain" explains a workout type or training philosophy. It does not invent an athlete-specific schedule.
  • mode: "personalized" is required for any recommendation or plan. Before it returns planning material, the tool requires answers for all six intake areas below. Missing answers are returned as focused questions; Garmin activity data is not fetched and a schedule must not be generated yet.
Intake fieldWhat the assistant must ask
goalTarget distance/event, future ISO YYYY-MM-DD date, and completion or ideal/minimum time goal
currentPerformance + performanceBasisA representative race/time trial from the past two years, result, non-future date, effort/conditions, or an explicit no_recent_benchmark
trainingBackgroundRunning history and recent 4–8 week volume, frequency, long run, quality work, and interruptions
availabilityAvailable days/time, fixed rest and long-run days, terrain/facility limits, strength-training time, and whether double days are possible
healthConstraints + hasWarningSymptomsCurrent/past-year injury, pain, relevant disease/medication, sleep and recovery, plus an explicit warning-symptom boolean
trainingPreference + preference detailssteady, hard_easy, or mixed, plus maxQualitySessionsPerWeek (0–7) and intensityGuidancePreference (pace, heart_rate, rpe, or mixed)

If hasWarningSymptoms is true—for example current chest discomfort, unusual breathlessness with mild activity, fainting/dizziness, or abnormal palpitations—the tool returns a safety stop without workout material or Garmin activity access. It advises medical clearance and does not diagnose. If performanceBasis is no_recent_benchmark, planning material instructs the assistant to begin with easy base work or a low-risk benchmark instead of inventing precise threshold or interval paces.

The compact philosophy layer contains:

  • Hansons — frequent, more evenly distributed mileage, pace discipline, and cumulative fatigue; its 16-mile long run is not a standalone prescription.
  • Jack Daniels — derive VDOT and E/M/T/I/R intensity from current, recent performance, never from the goal time.
  • Norwegian threshold — borrow controlled, non-exhaustive threshold work and hard/easy separation; double-threshold days are not prescribed by default.
  • Polarized training — keep most work genuinely easy and a small amount clearly hard; 80/20 is a direction rather than an exact quota.

Recent Garmin runs may supplement this intake but never replace the athlete's answers. The method notes and evidence boundaries are summarized in the training-method research note. Each philosophy and workout-card output labels its statements as system_principle, research_evidence, or application_inference so a method definition or coaching inference is not misrepresented as comparative proof.


Quick Start

1. Install this plugin — from the npm registry (recommended)

bash
npx @deepseek-ai/dsh plugin --profile web add dsh-plugin-garmin-connect

This single command installs the dependency and activates the plugin layer — the first run automatically initializes the web profile. You only need pnpm on your PATH:

bash
npm install -g pnpm

Verify the plugin layer is composed without booting:

bash
npx @deepseek-ai/dsh --profile web --dump-config | grep -A 2 garmin-connect

Other install sources:

bash
# Local checkout (development)
cd garmin-connect-plugin-for-dsh && npm install
npx @deepseek-ai/dsh plugin --profile web add .

# GitHub source install
npx @deepseek-ai/dsh plugin --profile web add github:<owner>/<repo>

2. Install the Harness CLI (if you haven't already)

bash
npx @deepseek-ai/dsh web

The web UI starts at http://127.0.0.1:3080 by default. If you launch Harness via npx, keep using the same prefix for the commands below (npx @deepseek-ai/dsh …); if you have dsh installed globally, you can drop the npx @deepseek-ai/ prefix.

3. Configure the Garmin account when you are ready to sign in

Choose the connection method per account. The existing browser flow below remains available; the new Personal API option is described separately here.

Official Personal API (introduced in 0.1.19)

Available in 0.1.19. The plugin uses the separately maintained connect-personal-api-ts implementation based on Garmin's official Python client. The SDK is published on official npm as @likenttt/connect-personal-api-ts@0.1.0. It is bundled with the plugin, so plugin users do not need to install another package. The SDK exchanges a Personal API key for a token and reads supported resources.

In Harness plugin settings, add an account with +, choose Official Personal API (International, read-only) (官方 Personal API(国际版,只读)), enter its alias and API key, save, then select Verify connection (验证连接). No email or Garmin password is required. A new Personal account has only two required inputs: display alias and API key. It defaults to the international .com endpoint; the form does not ask for an email, password or region. Existing mainland Personal accounts retain their cn configuration and show the current availability note. Saved keys are not returned to the settings form or AI tools. The real Harness desktop screenshot and desktop acceptance report record six successful reads in the release candidate: five using Personal API and one using the existing mainland web session. Saved settings survived a restart and connection verification passed again.

For standalone MCP, use the released package:

json
{
  "mcpServers": {
    "garmin-personal": {
      "command": "npx",
      "args": ["-y", "--registry=https://registry.npmjs.org/", "--package", "dsh-plugin-garmin-connect@0.1.20", "garmin-connect-mcp"],
      "env": {
        "GARMIN_PROVIDER": "personal",
        "GARMIN_ACCOUNT": "my-garmin",
        "GARMIN_ALIAS": "My Garmin International",
        "GARMIN_REGION": "global",
        "GARMIN_PERSONAL_API_KEY_FILE": "/absolute/private/path/garmin-personal.key"
      }
    }
  }
}

The key file contains only the key and must be private to its owner. An explicit GARMIN_PERSONAL_API_KEY environment variable is also supported; keep real keys out of shared JSON, source control, screenshots, and AI conversations. GARMIN_USERNAME and browser session variables are unnecessary for this provider. GARMIN_ALIAS is the display name; GARMIN_ACCOUNT is the stable machine ID. Neither is an email address. Standalone MCP keeps an explicit region setting: GARMIN_REGION=global selects personal.connectapi.garmin.com; GARMIN_REGION=cn selects personal.connectapi.garmin.cn. Match the region to where the key was created. Personal authentication errors never silently select a browser session or send the key to the other region.

Personal API covers supported reads, including HRV and SpO2. Respiration is limited to available daily/sleep summaries. Workout creation/deletion and calendar changes still require a separate Connect web session (existing method) account; Personal does not provide those operations or Webhooks. Although the existing method uses Garmin's official sign-in page, its web-session data access is not Personal API authorization. See the illustrated guide and results (Chinese) and Garmin's official instructions.

Regional validation (2026-10-22): a separately created international Key on .com passed token exchange, eight SDK reads and five real MCP tool reads. The mainland Key on .cn returned HTTP 526; the mainland Personal endpoint is currently unavailable. Credentials were kept separate; no cross-region fallback was used. See the endpoint test report (Chinese).

For SDK maintenance, update the independently committed source with npm run sync:personal-sdk -- /absolute/path/to/connect-personal-api-ts. The bundled snapshot records its source commit, file hashes and attribution.

Browser Connect configuration

The Harness plugin can be installed and started without a Garmin email. In the local Harness Plugins page, open dsh-plugin-garmin-connect and use Garmin 账号配置 and click + to add accounts as needed, up to five. Choose China (cn) or International (global) for each account; multiple accounts may use the same region. Give each an optional display alias. Settings show a masked preview of the saved email; selecting that field lets you replace it without exposing the complete saved address. Adding an account or changing its email saves the address and starts a fresh Garmin login from the same settings page. Harness opens the Garmin sign-in flow inside its own window; enter your password and MFA code on Garmin's official page there. Every account has an independent session and a stable account ID shown in settings. With multiple accounts configured, pass that ID as the tool's account argument so the plugin reads or writes the intended account.

For CLI, MCP, or headless use, configure the account through environment variables (or your launcher's secret store). Keep .env out of version control. The local Web MFA flow saves an owner-only DI session file after explicit profile confirmation. It never saves the password, MFA code, or CAPTCHA response.

bash
# Source checkout only: copy the bundled template
cp .env.example .env

# Edit .env only if using CLI/MCP or environment-based configuration

For environment-based configuration with a registry installation, create .env in the directory where you run dsh (your workspace root), then add the variables from the table below. The package's template is inside the installed dependency rather than your current directory. The plugin loads the workspace .env automatically. An explicitly saved plugin email takes precedence over GARMIN_USERNAME.

VariableRequiredDescription
GARMIN_USERNAMEBrowser CLI/MCPGarmin account email; Harness users can instead save it in the plugin settings after installation. Not needed for Personal API
GARMIN_ACCOUNT❌Lowercase local alias used for the implicit Web/CLI/MCP session path (default when omitted)
GARMIN_PASSWORD✅*Legacy direct-login password; do not use this for the interactive MFA setup below
GARMIN_SESSION_TOKEN✅*Inline pre-authenticated token (supported, but the session file is safer)
GARMIN_SESSION_TOKEN_FILE✅*Path to the owner-only DI v2 (or compatible legacy OAuth) session file generated by the local auth command
GARMIN_REGION❌global (default) or cn for Garmin China
GARMIN_FIT_DOWNLOAD_DIRFIT onlyUser-selected host parent directory for FIT exports; no default. The generated account directory includes GARMIN_REGION
GARMIN_CACHE_TTL❌Cache duration in seconds (default: 300)
GARMIN_REQUEST_TIMEOUT_MS❌Garmin request timeout in milliseconds (default: 15000)
GARMIN_LOG_LEVEL❌debug | info | warn | error
GARMIN_ACTIVITY_DETAIL❌full (default; preserves available expanded activity-list fields, including lap counts and split summaries when Garmin supplies them; may include precise route/location) or compact (smaller output). Credentials and unrelated account/social identifiers are filtered.

* Browser Connect data access needs one of GARMIN_PASSWORD, GARMIN_SESSION_TOKEN, or GARMIN_SESSION_TOKEN_FILE. The local Web, auth:serve, and standalone MCP flows may start without one and create the implicit account session file. The account email is still needed before starting authentication; Harness users can enter it in the plugin settings after installation. A protected file is safer than an inline token, especially when isolating multiple processes. If more than one is configured, the inline token takes precedence over the file until Garmin explicitly rejects it; a newly written, account-matching session file can then take over on retry. A valid session takes precedence over password login.

⚠️ If your password contains # or other special characters, wrap it in double quotes — otherwise # and everything after it will be treated as a comment:

GARMIN_PASSWORD="my#secret!pass"

GARMIN_SESSION_TOKEN and the contents of GARMIN_SESSION_TOKEN_FILE are as sensitive as a password. Token export is intentionally not AI-callable; never paste a token into an AI conversation.

Two-step verification — browser-based MFA

When dsh and its Web UI are running together on the same local machine, use the matching Log in action in the plugin's Garmin 账号配置 page after saving that account's email. Each account has its own login and session. Harness embeds a custom bridge on an ephemeral 127.0.0.1 port; that bridge, rather than the dsh page itself, embeds Garmin's official GAuth page. The configured account email is stored in the local Harness plugin settings; any email entry on Garmin's sign-in page, password, MFA code, and CAPTCHA remain inside the Garmin iframe.

Making this safe and reliable required more than adding a verification-code field. We first kept Garmin's official GAuth page inside a local iframe so the Garmin sign-in fields stayed on Garmin's origin, then worked through cross-origin messaging, missing vendor styles, browser CSP/Trusted Types, third-party-frame policy, MFA redirects, and exact ticket/service binding. Inspired by Zhitao's DailySync approach of completing Garmin SSO in a fresh browser tab, we added the system-browser loopback broker used by CLI and MCP clients. The tab returns only a short-lived, one-time service ticket; the Host immediately exchanges it for the longer-lived DI session and refresh credentials, verifies the Garmin profile, and writes an owner-only session. In other words, the ticket itself is not a one-year credential—the potentially long-lived artifact is the exchanged session/refresh credential, whose actual lifetime remains controlled by Garmin.

Garmin sends its short-lived service ticket only to the isolated loopback bridge. The bridge validates the expected region, message origin, iframe source, service, and ticket, then immediately hands it to the plugin Host for the region-bound DI token exchange. Garmin China may bind an MFA ticket to the exact current http://127.0.0.1:<port> bridge instead of the fixed Garmin embed URL; the plugin preserves that ticket/service pair unchanged and rejects every other loopback host, port, path, query, or region before contacting DI. It never rewrites or retries the one-time ticket with a fallback service. The Host probes the Garmin profile, shows a sanitized profile to the user, and asks them to confirm that it corresponds to the configured email. Only then does it atomically save an owner-only session bound to the configured account and region. The outer dsh page receives public login progress; plugin settings may display the account email after identity verification. The model context and AI-callable tool results never receive the ticket, DI token, password, MFA code, or CAPTCHA response.

After the Host verifies an account through password login, a profile-bound DI session, or a newly confirmed Web login, that account's status in plugin settings shows it as signed in. Merely loading an identity-unverified legacy OAuth token does not show this state, and the status endpoint never returns a ticket or token. The login dialog opens only when the user clicks that account's action in settings. A missing or expired session does not automatically open it.

Save the Garmin email in the matching account card before opening its dialog. GARMIN_SESSION_TOKEN_FILE is optional for this Web flow. The Host keeps each account in a separate owner-only session file, preserving the existing session path for a migrated account. After a confirmed write, the running plugin clears any earlier rejected-session state; the next tool call reads the new file without requiring a dsh restart.

This supported Web flow is intentionally limited to the loopback dsh Web UI. It is not a remote, hosted, or tunneled login endpoint. Browser third-party-cookie and iframe policies can prevent Garmin GAuth from completing. A real China-region MFA run passed the browser, DI exchange, profile confirmation, owner-only persistence, and read-only session-consumption chain locally on 2026-08-29. A real International-region MFA run also passed the system-browser challenge, DI exchange, profile confirmation, and owner-only session persistence. This does not turn the same-machine flow into a remote or indefinite session-recovery guarantee. Login, MFA, and profile confirmation must finish within the bridge's 10-minute lifetime.

See the target architecture for two-step verification for the complete trust boundary and data flow.

Local system-browser authentication

The recommended local MFA flow for CLI and MCP clients is the loopback broker. Choose the account alias and region explicitly. For this command, both flags are required and GARMIN_ACCOUNT/GARMIN_REGION are deliberately not used as defaults, preventing a two-account setup from writing the wrong session:

bash
# Installed executable
garmin-connect-auth serve --account personal --region global --open
garmin-connect-auth serve --account personal-cn --region cn --open

# Source checkout
npm run auth:serve -- --account personal --region global
npm run auth:serve -- --account personal-cn --region cn

serve starts a one-shot bridge on a random 127.0.0.1 port and opens it in the system's default browser. It does not create or manage an isolated Chrome/Playwright profile; the operating system may reuse an already-running browser or start the configured default browser. The CLI may read the configured account email, but the password, MFA code, and any CAPTCHA remain on Garmin's page; they cannot be supplied through flags, environment variables, MCP tool arguments, or model input. The bridge receives only the short-lived service ticket and hands it to the local runtime for the region-bound DI exchange. The page then displays a sanitized profile for confirmation before the runtime writes the owner-only session. Login, MFA, and profile confirmation must finish within 10 minutes; after that, start a new flow.

When GARMIN_SESSION_TOKEN_FILE is omitted, the output path is derived from GARMIN_ACCOUNT/--account: ~/.config/dsh-plugin-garmin-connect/accounts/<alias>.session.json on the usual POSIX configuration path (or the platform configuration root). The process can then use only the non-password configuration below:

dotenv
GARMIN_USERNAME=your-email@example.com
GARMIN_ACCOUNT=personal
GARMIN_REGION=global
GARMIN_FIT_DOWNLOAD_DIR=/absolute/path/to/garmin-fit-parent

This browser bootstrap is release-supported for same-machine authentication in both regions. Real China-region and International-region MFA runs passed locally on 2026-08-29. Real refresh-token rotation remains part of ongoing compatibility coverage rather than a limitation on MFA support.

Legacy browser diagnostics

garmin-connect-auth login --browser is retained only for development and diagnosis; it is not the recommended fallback for serve or MCP authentication. It launches an isolated Chrome context through Playwright and may encounter redirect interception failures. The non-persisting canary exercises the same legacy path:

bash
garmin-connect-auth login --browser --account personal --region global
garmin-connect-auth login --browser --account personal-cn --region cn
npm run auth:canary -- --region global
npm run auth:canary -- --region cn

The direct terminal-password attempt without --browser remains for compatibility. Leaving its password prompt blank opens the shared system-browser flow; positive MFA/CAPTCHA page evidence switches to that same flow without asking for a terminal MFA code. Ambiguous password, network, and no-ticket failures do not auto-open a browser. These diagnostics are separate from the supported system-browser MFA bootstrap.

DI v2 files bind the normalized username, region, and probed Garmin profile via one-way hashes, including profileIdHash; they do not duplicate the plaintext email in the binding. The runtime rejects username, region, or profile mismatch before publishing refreshed credentials. It refreshes access tokens before expiry, persists a rotated refresh token before using the new session, and may retry an authentication failure at most once for an idempotent GET. Workout and other write requests are never replayed automatically.

For backward compatibility, legacy session files containing only the two oauth1 and oauth2 fields are still accepted. They have no profile binding; the intended replacement is a browser-generated, validated DI v2 session with the mismatch guard. On POSIX, a legacy file must still pass the current owner-only file-permission check (normally mode 0600), complete safe ancestor-chain validation, and a private final-parent check (normally mode 0700).

On POSIX, the default account directory is prepared before Garmin authentication opens. To choose a different session file, add --output /absolute/private/path/personal.session.json. Preflight canonicalizes any safe existing link target, rejects unsafe/writable ancestors, requires the final parent to belong to the effective UID with owner write+execute and no group/other access (normally mode 0700), and creates missing components one at a time as 0700. The writer uses that canonical destination and rechecks the parent, existing destination, and no-follow temporary-file handle before the atomic replacement. On macOS, granting extended ACL entries are rejected on every checked ancestor, parent, existing file, and empty temporary file; a private-looking 0700/0600 mode does not override that result. If the normal configuration root or one of its ancestors is group/world-writable, preflight intentionally refuses to start authentication. Repair that directory's permissions yourself or set GARMIN_SESSION_TOKEN_FILE/--output to a fresh owner-private application directory; the plugin will not silently chmod a shared or broadly writable configuration tree.

On Windows, the implicit account path prefers the current user's local LOCALAPPDATA root over redirected roaming APPDATA. Keep any explicit destination beneath the current user's local OS profile/config root and use a fresh dedicated subtree; UNC/network destinations are not supported. From the longest matching Windows special-folder root down to the session parent, every component must have a protected DACL owned by the current SID with exactly one current-SID FullControl rule. Missing components are created atomically with that DACL; non-exact existing components and every reparse point are rejected rather than rewritten. The empty temporary file receives the same exact file DACL before credential bytes are written, and the entire directory chain plus file ACL is verified again when a session is read. Marker-only directories from earlier implementations are not trusted; migrate to a fresh dedicated subtree.

Multiple accounts in other coding agents

Harness supports up to five accounts in the same plugin, including multiple accounts in one region, with separate sessions. Standalone CLI/MCP integrations use one account and one independently initialized session per process. Give each Codex, Claude Code, or other MCP process its own GARMIN_USERNAME, GARMIN_REGION, and GARMIN_ACCOUNT (or an explicit GARMIN_SESSION_TOKEN_FILE). These integrations complete Garmin login in the system default browser. The real China-region account chain has been verified end to end.

Do not copy one session file to another process, and do not let simultaneous processes share one file. Garmin refresh tokens may rotate; concurrent writers can otherwise invalidate or overwrite each other's credentials. For example, use aliases such as personal-dsh, personal-codex, and personal-claude, with an independently initialized session for each one. Do not point another runtime at the same file through a symbolic link or a differently cased path alias.

The processes may share one GARMIN_FIT_DOWNLOAD_DIR parent: the plugin creates a separate account subdirectory from each configured region and email. This also keeps cn and global accounts with the same email from colliding. For one MCP entry, ordinary Garmin questions use that entry as the default. For two entries, name them garmin-cn and garmin-global; mention the server name only when the intended account is ambiguous.

This is process isolation, not an in-process account selector or a multi-tenant authorization system. Do not expose one shared MCP process to mutually untrusted users; per-user access control has not been implemented. Switching accounts inside one conversation and automatic cross-account sync remain on the roadmap.

FIT downloads

download_garmin_activity_fit accepts only an activity ID; the model cannot choose an arbitrary output path. Garmin's original activity ZIP is downloaded to a private temporary location, size-checked, and required to contain exactly one valid FIT file. Given a configured parent directory <base>, the result is written as <base>/GARMIN_FIT_<cn|global>_<normalized-email>/<activityId>.fit without overwriting an existing file. The cn or global component comes from GARMIN_REGION. Here <normalized-email> is derived safely from the configured email: a normal email address remains recognizable, while path separators, control characters, and other unsafe filename characters are normalized before the account directory is created. The user locates the file from the configured parent plus this rule. The tool returns only activityId, fileName, sizeBytes, and sha256; it does not return the parent, account directory, email, or full path. ZIP/FIT bytes never enter model context.

The parent directory has no default and must be chosen explicitly through GARMIN_FIT_DOWNLOAD_DIR. It is required only when using this tool; if unset, the tool fails before writing any file and all other Garmin tools remain available. Multiple account processes can safely share the same parent because their region-and-normalized-email subdirectories are isolated, including when the same email is used for both Garmin China and Garmin International. Existing GARMIN_FIT_<email> directories are not migrated automatically; new downloads use the region-prefixed directory while old files remain in place.

Garmin's “original” export is not guaranteed to be FIT. If the archive has no single valid FIT entry, the tool fails safely instead of renaming another format.

4. Run

bash
npx @deepseek-ai/dsh web

Open http://127.0.0.1:3080. The plugin is loaded when Settings → Plugins → Plugin list shows plugin-garmin-connect as mounted & enabled. Then try: "How was my sleep last night?" or "Show me my last 5 runs."

5. Integration Test (optional, source checkout only)

The integration script is a development aid and is not included in the npm tarball. From a source checkout with development dependencies installed, you can run it after configuring .env:

bash
npm run test:integration

The script checks read-only APIs and exits non-zero if any check fails. It does not create, update, or delete workouts or other Garmin data.

By default it hides the account identifier and prints only counts/status, not activity or health values. Set GARMIN_INTEGRATION_VERBOSE=true only when you explicitly want normalized details in your local terminal output.

🔌 Garmin Connect Integration Test
   Domain : garmin.com
   User   : configured (identifier hidden)
   Date   : 2026-08-18
   Scope  : read-only (workout creation/update/deletion is not tested)

── 1. Authentication ──
  ✅ Password login successful

── 2. Activities ──
  ✅ Got 3 activities

── 3. Sleep ──
  ✅ Sleep data loaded

── 4. Steps ──
  ✅ Step data loaded

── 5. Heart Rate ──
  ✅ Heart-rate data loaded

── 6. Weight / Body Composition ──
  ✅ Body-composition data loaded

── 7. Workout Library ──
  ✅ Got 5 workout templates

── 8. User Profile ──
  ✅ Profile loaded

🏁 Integration test complete: 8 passed, 0 failed.
   Write operations were intentionally not tested.

npm peer dependency troubleshooting

The npm default for legacy-peer-deps is false, so regular commands need no override. If an npx launch reports missing dependencies, check npm config get legacy-peer-deps. Only if it returns true, try npx --legacy-peer-deps=false @deepseek-ai/dsh web to restore normal peer resolution for that invocation. A missing-module error can have other causes; also check the named package and installation state.


Security

Credentials are used locally to authenticate directly with Garmin Connect and are never returned by an AI tool.

Credential Resolution Order

1. Plugin config values (saved through the local Garmin settings form, a profile patch, or a `--patch` overlay)
   ↓ fallback
2. Environment variables (.env / shell)
   ↓ fallback
3. Schema defaults

Best Practices

PracticeStatus
Environment-variable and secret-marked configuration are supported✅
.env is in .gitignore✅
Account identifier and credentials marked with role('secret') in Cordis schema✅
Local dsh Web MFA bridge✅ Supported; loopback only; real China-region MFA chain passed locally
CLI serve and MCP URL elicitation✅ Supported; same-machine shared runtime and owner-only session persistence
Legacy CLI login --browser / canary⚠️ Playwright diagnostics only; not an authentication fallback
DI v2 sessions bind username, region, and profileIdHash; legacy two-field sessions remain compatible✅
Independently initialized per-process session files support isolated multi-account setups✅
Access refresh is preemptive; idempotent GET replay is limited to once and writes are never replayed✅
Tool outputs never include raw credentials✅
FIT bytes and local/account paths stay on the host; the model receives only activity/file name/size/hash✅
In-memory cache reduces API calls (rate-limit protection)✅

Session Tokens

Session-token authentication remains supported, but tokens are credentials and must not appear in agent output or trajectory logs. For that reason this plugin does not expose authentication, MFA submission, or token export as AI-callable tools. If you already have a validated owner-only DI v2 or compatible legacy session file, dsh/MCP can read it through GARMIN_SESSION_TOKEN_FILE; the runtime does not need the account password. The DI file binds normalized username and region as well as profileIdHash; legacy unbound oauth1/oauth2 files remain readable for compatibility. Creating a new MFA session through the dsh Web bridge, serve, or MCP URL elicitation is a supported same-machine workflow. Because Garmin refresh tokens may rotate, never concurrently share or copy one session file across dsh, Codex, Claude Code, or other processes.


Use with Other AI Coding Agents (MCP)

This plugin also ships as a standalone MCP (Model Context Protocol) server, so you can use the same Garmin tools with OpenAI Codex, Claude Code, Claude Desktop, Cursor, Windsurf, WorkBuddy, ZCode, and any other MCP-compatible client — no DeepSeek Harness required.

Current availability: the standalone MCP entry point is included in npm 0.1.5 and later. A local checkout remains useful for development.

New in 0.1.17: agent workflow instructions on connection. MCP initialization sends instructions covering actual tool schemas, account verification before the first account-data query or after an account change, explicit dates, and separate handling of empty data, authentication failures and other request errors. Initialization only sends guidance; it performs no health queries, software updates or Garmin writes.

This requires a version containing the change, a restarted MCP process and a reloaded connector. Updating only the SDK or skill does not add tools to an old running connection. The client controls whether server instructions reach the model; the bundled garmin-connect skill remains available as a fallback. Guidance improves tool use but cannot guarantee data from Garmin.

Build the local server first:

bash
git clone https://github.com/Likenttt/garmin-connect-plugin-for-dsh.git
cd garmin-connect-plugin-for-dsh
npm install
npm run build

Replace /absolute/path/to/garmin-connect-plugin-for-dsh in the examples with the checkout's actual absolute path.

The MCP process needs an email, explicit region, and local account alias. A session-file path is optional: when omitted, the server derives an owner-only path from GARMIN_ACCOUNT. Make these values and any FIT parent directory available to the client process:

bash
export GARMIN_USERNAME='your@email.com'
export GARMIN_REGION='global'
export GARMIN_ACCOUNT='personal'
export GARMIN_FIT_DOWNLOAD_DIR='/absolute/path/to/garmin-fit-parent'
# Optional override; otherwise 

التثبيت

TypingMind
{
  "mcpServers": {
    "garmin-connect-plugin-for-dsh": {
      "command": "npx",
      "args": [
        "dsh-plugin-garmin-connect"
      ]
    }
  }
}

استخدم MCP الخاص بـ Garmin Connect Plugin For Dsh مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل Garmin Connect Plugin For Dsh، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يعمل تكامل MCP هذا محليًا عبر موصل MCP الخاص بـ TypingMind على جهازك.

دليل الإعداد لاستخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal والعملية التي تعمل فيها قيد التشغيل أثناء استخدام أدوات MCP.
3

أضف Garmin Connect Plugin For Dsh كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ Garmin Connect Plugin For Dsh.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "garmin-connect-plugin-for-dsh": {
      "command": "npx",
      "args": [
        "-y",
        "dsh-plugin-garmin-connect"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ Garmin Connect Plugin For Dsh، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ Garmin Connect Plugin For Dsh.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام Garmin Connect Plugin For Dsh لمساعدتي في هذه المهمة؟
Garmin Connect Plugin For Dsh
بالتأكيد. قرأته.
إليك ما وجدته باستخدام Garmin Connect Plugin For Dsh.

الأسئلة الشائعة

ما استخدامات خادم MCP Garmin Connect Plugin For Dsh؟

Garmin Connect Plugin For Dsh هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP Garmin Connect Plugin For Dsh مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام Garmin Connect Plugin For Dsh مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم موصل MCP Garmin Connect Plugin For Dsh مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل Garmin Connect Plugin For Dsh، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP Garmin Connect Plugin For Dsh بـ TypingMind؟

يعمل Garmin Connect Plugin For Dsh عبر موصل MCP المحلي في TypingMind. هذا هو الخيار الأنسب عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات سطح المكتب أو أدوات سطر الأوامر أو موارد خاصة على حاسوبك.

ما الأدوات التي يوفّرها خادم MCP Garmin Connect Plugin For Dsh في TypingMind؟

يتيح Garmin Connect Plugin For Dsh إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP Garmin Connect Plugin For Dsh؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويُبقي مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP تحت تحكمك. إذا كان Garmin Connect Plugin For Dsh يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇