dexcom-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dexcom-mcpWhat's my current glucose and how much time have I been in range today?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dexcom-agent-tools
An MCP server and an agent skill that let an AI agent read and analyze your Dexcom CGM data.
MCP server (
dexcom-mcp, stdio) exposes these tools:get_current_glucose: the latest reading, its trend arrow, and its age in minutesget_glucose(start, end): readings between two ISO 8601 timestamps, within the last 24 hoursget_glucose_stats(start, end, target_low_mg_dl, target_high_mg_dl): mean, SD, CV, GMI, min/max, and the percentage of time in, below, and above range (TIR/TBR/TAR). Defaults to a 70–180 mg/dL range.
Skill
skills/analyze-glucose-patterns: tells an agent how to call these tools and explain your patterns in plain language.
The backend is Dexcom Share, which updates in near real time, through pydexcom. It supports the US, outside-US (ous), and Japan (jp) regions, and reports in mg/dL (the default) or mmol/L.
⚠️ Disclaimer. This is not a medical device. The Dexcom Share API is unofficial and undocumented, and it can change or break without notice. Data can be delayed, missing, or wrong. Don't make treatment or dosing decisions from this. Use your receiver, the Dexcom app, or a fingerstick. Dexcom's official OAuth API is about 1 hour delayed in the US and isn't supported in v1.
Prerequisites
In the Dexcom app, turn on Share and invite at least one follower. If nobody follows you, the Share API returns no data.
Use your own Dexcom account username (or email) and password. A follower's own login doesn't work.
Install Python 3.10+ and uv. Plain pip also works.
Related MCP server: Dexcom G7 MCP Server
Setup
cd ~/Projects/dexcom-agent-tools
cp .env.example .env # then fill in DEXCOM_USERNAME / DEXCOM_PASSWORD
uv sync --extra dev # or: python -m venv .venv && . .venv/bin/activate && pip install -e '.[dev]'Environment variables
Credentials are read only from the environment. The server doesn't load .env itself. Export the variables, or pass them through your MCP client config.
Variable | Default | Notes |
| (required) | Dexcom account username, email, or phone ( |
| (none) | Optional. Use this instead of the username. |
| (required) | |
|
|
|
|
|
|
|
| Stats range, always in mg/dL |
|
| Set to |
Run
# Check the config without starting the server (exits 2 with a clear message if credentials are missing)
set -a; . ./.env; set +a
uv run dexcom-mcp --check
# Try it with fake data
DEXCOM_DRY_RUN=1 uv run dexcom-mcp --check
# Run the MCP server on stdio (normally your MCP client starts it)
uv run dexcom-mcp # or: uv run python -m dexcom_agent_tools
# Tests (no network)
uv run pytest -q
# Interactive inspector (optional)
npx @modelcontextprotocol/inspector uv --directory ~/Projects/dexcom-agent-tools run dexcom-mcpAdd to an MCP client
Cursor: put this in ~/.cursor/mcp.json (global) or in .cursor/mcp.json inside a project. Claude Desktop: put it in ~/Library/Application Support/Claude/claude_desktop_config.json.
{
"mcpServers": {
"dexcom": {
"command": "uv",
"args": ["--directory", "/Users/YOU/Projects/dexcom-agent-tools", "run", "dexcom-mcp"],
"env": {
"DEXCOM_USERNAME": "you@example.com",
"DEXCOM_PASSWORD": "…",
"DEXCOM_REGION": "us",
"DEXCOM_UNITS": "mg/dL"
}
}
}
}The JSON file holds your password in plain text, so keep it out of git. Or skip the env block and point command at a small wrapper script that loads the secrets from your keychain.
Claude Code:
claude mcp add dexcom -e DEXCOM_USERNAME=... -e DEXCOM_PASSWORD=... -- \
uv --directory ~/Projects/dexcom-agent-tools run dexcom-mcpInstall the skill
The skill is a plain SKILL.md file with no secrets in it. Copy or symlink it into your agent's skills folder:
# Claude Code (personal skills)
mkdir -p ~/.claude/skills && ln -s ~/Projects/dexcom-agent-tools/skills/analyze-glucose-patterns ~/.claude/skills/
# Cursor / other agents: add skills/analyze-glucose-patterns/SKILL.md as a rule or skillThen ask your agent something like "analyze my glucose patterns from the last 24h" or "how was my overnight?"
Tool details
Times are ISO 8601. A timestamp with no timezone is read as the server's local time. Output times use local time with the UTC offset included.
Share only keeps the last 24 hours at 5-minute intervals (up to 288 readings). A window that reaches back further gets trimmed to 24 hours. A window that ends more than 24 hours ago returns an error.
get_current_glucosefalls back to the newest reading in the last 24 hours. Checkage_minutesto see how stale it is.Stats percentages count readings.
coverage_percentshows how much of the window actually has data.If you need history beyond 24 hours, log the readings locally or add the official API later (open item for v2).
Layout
src/dexcom_agent_tools/
config.py # env settings, unit conversion
source.py # Dexcom Share client (pydexcom) + synthetic dry-run source
stats.py # TIR/TBR/TAR, mean, SD, CV, GMI
server.py # MCP tools + CLI (--check)
skills/analyze-glucose-patterns/SKILL.md
tests/License
MIT
Available Tools
3 toolsget_current_glucoseA
Latest CGM glucose reading with trend arrow and how old it is (minutes).
units: "mg/dL" or "mmol/L" (defaults to DEXCOM_UNITS, else mg/dL).
| Name | Required | Description | Default |
|---|---|---|---|
| units | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description carries the full burden. It does useful work by disclosing the return shape (reading, trend arrow, staleness in minutes) and the units default chain, but says nothing about what happens with no recent sensor data, data freshness limits, or auth requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two tight, front-loaded segments: the capability first, then the units contract. Slightly hurt by the dangling quote and the stray leading newline in the units line, but no wasted sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter read tool with no output schema, the description covers payload contents and units adequately. It stops short of describing behavior when the sensor has no recent reading, which is the main failure mode an agent would need to anticipate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the schema only declares an untyped nullable string, so the description must compensate — and it does, giving both allowed values ('mg/dL' or 'mmol/L') and the exact default resolution order (DEXCOM_UNITS, else mg/dL). Only minor gap is that it doesn't say whether an invalid value errors or falls back.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Latest CGM glucose reading') and names the payload ('trend arrow and how old it is'), so the agent knows exactly what comes back. It is clearly narrower than get_glucose and get_glucose_stats via the word 'Latest', but never names those siblings explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
'Latest' and the age-in-minutes output imply the tool is for current-state questions rather than historical ranges, which is usable context. However, there is no explicit when-to-use statement and no routing to get_glucose or get_glucose_stats for history or aggregates.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_glucoseA
CGM readings (every ~5 min, oldest first) between start and end.
start/end: ISO 8601 timestamps; default is the last 3 hours. Dexcom Share only serves the last 24 hours, so the window is clipped to that. units: "mg/dL" or "mmol/L".
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ||
| start | No | ||
| units | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well: it discloses sampling cadence, sort order, default window, and—importantly—that the upstream source silently clips windows beyond 24 hours, a behavior an agent could otherwise get wrong. It stops short of stating auth/permission requirements or what an empty window returns.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three compact statements, front-loaded with what is returned, followed by per-parameter notes. No filler; every clause conveys a constraint or default the agent needs.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a parameterless-required read tool with no output schema, the key risks are covered: time window semantics, clipping, cadence, and ordering. It lacks only return-value detail (per-reading fields) and empty-result behavior, which are secondary given no output schema exists to imply shape.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must document all three params, and it does: start/end are ISO 8601 with a documented default, units accepts mg/dL or mmol/L. Minor gap: it doesn't say which unit is used when units is null/omitted, leaving the default unresolved.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific resource and scope: CGM readings in a time window, returned oldest first at ~5-minute cadence. The name plus 'CGM readings' makes the difference from get_current_glucose and get_glucose_stats inferable, but the description never explicitly contrasts itself with those siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives useful defaults (last 3 hours) and a hard availability ceiling (Dexcom Share only retains 24 hours, so requests are clipped), which is real usage guidance. However, it never says when to prefer this over get_current_glucose or get_glucose_stats; the agent must infer that from names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_glucose_statsA
Summary stats for a window: mean, SD, CV, GMI, min/max, and % time in/below/above range.
start/end: ISO 8601 (default last 24 hours, the Share maximum). Target range defaults to DEXCOM_TARGET_LOW/HIGH (70-180 mg/dL). Thresholds are in mg/dL. Also reports very low (<54) and very high (>250). Percentages are by reading count.
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ||
| start | No | ||
| units | No | ||
| target_low_mg_dl | No | ||
| target_high_mg_dl | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does real work: it discloses the default lookback window and the Share maximum on span, that target thresholds come from DEXCOM_TARGET_LOW/HIGH with 70-180 mg/dL fallbacks, and that percentages are weighted by reading count rather than time. It stops short of stating read-only semantics or behavior on empty/insufficient data, which is reasonable for an obviously read-only aggregation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with what the tool returns, then short parameter notes in descending order of importance; almost no filler. The line-broken style is terse to the point of being slightly fragmented, but nothing repeats the schema verbatim.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema and no annotations, so the description must enumerate results — and it does list the full return payload plus defaults and units. Missing pieces are the `units` parameter's effect and edge-case behavior (no data, window exceeding 24h), which keep it from being fully self-contained.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% with five parameters, so the description has to compensate and mostly does: start/end are pinned to ISO 8601 with a stated default and maximum span, and target_low_mg_dl/target_high_mg_dl get units, defaults, and an environment-variable source. The `units` parameter is left completely unexplained, a notable gap given the description insists thresholds are in mg/dL.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
It names a specific resource (glucose) and enumerates exactly what is computed: mean, SD, CV, GMI, min/max, and time-in/below/above range. That is far more than a restatement of the name, though it never explicitly distinguishes itself from the siblings get_glucose and get_current_glucose (aggregate vs. raw/instantaneous readings is only implied).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is only implied: the 'last 24 hours, the Share maximum' default and the target-range defaults tell the agent what typical calls look like, but there is no explicit statement of when to choose this over get_glucose or get_current_glucose, and no exclusions or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
get_current_glucose - First observed
get_glucose - First observed
get_glucose_stats
TDQS
Scored across 3 tools
The three tools target clearly distinct outputs: latest single reading, a range of readings, and aggregate statistics. Defaults and parameters are described well enough to avoid confusion between current and historical data.
All tools use a consistent snake_case get_ prefix followed by glucose-related nouns. The pattern is predictable and readable.
Three tools are well-scoped for a read-only CGM data server, with each tool covering a distinct retrieval need. No unnecessary tools are present.
The core read-only surface is covered: current reading, historical range, and summary statistics. Minor gaps exist around connection/account status or target-range introspection, but agents can work around them via environment defaults.
Maintenance
Related MCP Connectors
- NightscoutOAuthai.b77
Your Nightscout glucose data, conversational.
Your Apple Health data, food diary and lifts, for ChatGPT, Claude and Gemini. Approved on iPhone.
Your own SLATE health data in your AI assistant: read, trend, plan and log. Never suggests a dose.
Glucose readings from your LibreLink Up sensor: graph, logbook, stats and summaries (read-only). Sec
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to query glucose data from health storage APIs, providing natural language access to glucose readings, trends, and statistics for diabetes management and health monitoring.3MIT
- FlicenseNot gradedqualityDmaintenanceProvides access to Dexcom G7 continuous glucose monitor data, enabling AI assistants to retrieve current glucose readings and historical data.14-
- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to Nightscout for real-time glucose monitoring, analysis, and treatment logging, enabling natural language interaction with CGM data.7MIT
- FlicenseNot gradedqualityDmaintenanceEnables reading real-time continuous glucose monitor data from Dexcom sensors via the Share API, allowing Claude to access glucose levels, trends, and statistics.-