- Explore MCP Servers
- dexcom_mcp
Dexcom Mcp
What is Dexcom Mcp
dexcom_mcp is a Model Context Protocol (MCP) server implementation for Dexcom’s Continuous Glucose Monitoring (CGM) solution, enabling users to connect Large Language Models (LLMs) to Dexcom’s API for querying glucose data in natural language.
Use cases
Use cases for dexcom_mcp include integrating glucose monitoring data into health applications, providing insights for diabetes management, and enabling conversational interfaces for users to query their glucose levels.
How to use
To use dexcom_mcp, install dependencies with ‘npm install’, build all servers using ‘npm run build:all’, and start the recommended SSE web server with ‘npm run start:sse’. Authenticate with the Dexcom API using OAuth2 by registering an application and configuring your server with the provided credentials.
Key features
Key features of dexcom_mcp include three different server implementations (stdio, SSE, and streamableHttp), natural language querying of glucose data, and support for OAuth2 authentication.
Where to use
dexcom_mcp can be used in healthcare applications, research environments, and personal health monitoring systems where glucose data needs to be accessed and analyzed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Dexcom Mcp
dexcom_mcp is a Model Context Protocol (MCP) server implementation for Dexcom’s Continuous Glucose Monitoring (CGM) solution, enabling users to connect Large Language Models (LLMs) to Dexcom’s API for querying glucose data in natural language.
Use cases
Use cases for dexcom_mcp include integrating glucose monitoring data into health applications, providing insights for diabetes management, and enabling conversational interfaces for users to query their glucose levels.
How to use
To use dexcom_mcp, install dependencies with ‘npm install’, build all servers using ‘npm run build:all’, and start the recommended SSE web server with ‘npm run start:sse’. Authenticate with the Dexcom API using OAuth2 by registering an application and configuring your server with the provided credentials.
Key features
Key features of dexcom_mcp include three different server implementations (stdio, SSE, and streamableHttp), natural language querying of glucose data, and support for OAuth2 authentication.
Where to use
dexcom_mcp can be used in healthcare applications, research environments, and personal health monitoring systems where glucose data needs to be accessed and analyzed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
Dexcom API MCP Servers
This repository contains three different MCP (Model Context Protocol) server implementations for the Dexcom API:
- stdio - Command-line based server using stdio transport
- SSE - Web-based server using Server-Sent Events transport
- streamableHttp - Web-based server using StreamableHTTP transport
Each server provides the same Dexcom API tools but with different transport mechanisms.
Quick Start
The easiest way to get started is to use the unified commands from the root directory:
# Install all dependencies
npm install
# Build all servers
npm run build:all
# Start the SSE web server (recommended for first-time users)
npm run start:sse
Then open http://localhost:3000 in your browser and follow the authentication flow.
Authentication
All servers require authentication with the Dexcom API using OAuth2. You’ll need to:
- Register an application with Dexcom to get client credentials
- Configure your server with these credentials
- Authenticate with Dexcom to get an access token
Registering with Dexcom
- Visit the Dexcom Developer Portal
- Create an account and register a new application
- Note your Client ID and Client Secret
Configuration
Each server uses a .env
file for configuration. When you first run a server, it will automatically create a .env
file from the .env.example
template if one doesn’t exist.
Edit the .env
file in the server directory you want to use and add your Dexcom credentials:
OAUTH_CLIENT_ID_BEARERAUTH=your_client_id_here OAUTH_CLIENT_SECRET_BEARERAUTH=your_client_secret_here OAUTH_REDIRECT_URI=http://localhost:3000/auth/callback
Using ngrok for Local Development
When developing locally, you’ll need a publicly accessible URL for the OAuth callback. You can use ngrok to create a secure tunnel to your local server:
- Download and install ngrok
- Start your server (e.g.,
npm run start:sse
) - In a separate terminal, start ngrok:
ngrok http 3000
- Copy the HTTPS URL provided by ngrok (e.g.,
https://a1b2c3d4.ngrok.io
) - Update your
.env
file with the ngrok URL:
OAUTH_REDIRECT_URI=https://a1b2c3d4.ngrok.io/auth/callback
- Update your application in the Dexcom Developer Portal to include this redirect URI
- Restart your server to apply the changes
This allows Dexcom to redirect back to your local development server after authentication.
Server-Specific Usage
stdio Server
The stdio server runs in the command line and uses a CLI-based OAuth flow:
# Run the authentication flow
npm run auth:stdio
# Start the server
npm run start:stdio
# For development with auto-reload
npm run dev:stdio
SSE Server
The SSE server provides a web interface with built-in OAuth flow:
# Start the server
npm run start:sse
# For development with auto-reload
npm run dev:sse
Open http://localhost:3000 in your browser, click “Login with Dexcom” and follow the authentication flow.
StreamableHTTP Server
The StreamableHTTP server also provides a web interface with built-in OAuth flow:
# Start the server
npm run start:http
# For development with auto-reload
npm run dev:http
Open http://localhost:3000 in your browser, click “Login with Dexcom” and follow the authentication flow.
Available Tools
All servers provide the following Dexcom API tools:
getdatarange
- Get the available data rangeuserauthorization
- Get user authorizationexchangeauthorizationcode
- Exchange authorization code for tokengetalerts
- Get alertsgetcalibrations
- Get calibrationsgetestimatedglucosevalues
- Get estimated glucose values
Using the Tools
Web Interface (SSE and StreamableHTTP)
- Log in with Dexcom using the “Login with Dexcom” button
- Enter commands in the format:
toolName param1=value1 param2=value2
Example:
getdatarange
getestimatedglucosevalues startDate=2023-01-01T00:00:00Z endDate=2023-01-02T00:00:00Z
Command Line (stdio)
After starting the stdio server, enter commands in the same format:
getdatarange
Token Management
OAuth tokens are automatically cached and refreshed when needed. The tokens are stored in:
- stdio:
stdio/data/token.json
- SSE:
sse/data/token.json
- StreamableHTTP:
streamableHttp/data/token.json
Development
This project uses a workspace structure to manage the three server implementations. Common code is shared in the shared
directory.
Project Structure
dexcom-api-mcp-servers/ ├── shared/ # Shared utilities and configuration ├── stdio/ # Command-line server ├── sse/ # Server-Sent Events web server ├── streamableHttp/ # StreamableHTTP web server └── package.json # Root workspace configuration
Development Workflow
- Make changes to the code
- Run the appropriate dev script for auto-reloading:
npm run dev:stdio
for stdio servernpm run dev:sse
for SSE servernpm run dev:http
for StreamableHTTP server
Building
To build all servers:
npm run build:all
Troubleshooting
Authentication Issues
- Ensure your Dexcom Client ID and Secret are correct in the
.env
file - Check that your redirect URI matches what’s registered in the Dexcom Developer Portal
- If tokens expire, the servers will automatically refresh them if possible
- When using ngrok, make sure to update both your
.env
file and the Dexcom Developer Portal with the new ngrok URL each time you restart ngrok
Connection Issues
- For web servers, ensure port 3000 is available (or change PORT in .env)
- For stdio server, check the console output for any error messages
Data Issues
- Verify the date ranges you’re requesting contain data
- Ensure your Dexcom account has access to the requested data
Attributions
Dexcom OpenAPI spec Thanks to rockybranches!
OpenAPI to MCP generator Thanks to harsha-iiiv for a quick and easy solution!
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.