Google Health ChatGPT MCP
Provides tools to read and analyze personal health data from Google Health, including sleep, steps, heart rate, exercise, and more.
Click on "Install 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., "@Google Health ChatGPT MCPCompare my heart rate variability and sleep quality over the last two weeks."
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.
🩺 Google Health ChatGPT MCP
一个自托管、只读的 Google Health MCP 服务,让 ChatGPT 能够安全读取并分析个人健康数据。
✨ 功能
💤 睡眠与睡眠阶段分析
🚶 步数、距离和活动量统计
❤️ 心率与静息心率
🩸 血氧、呼吸率和 HRV
🏃 运动记录与训练趋势
⚖️ 体重等健康数据查询
📊 综合概览与周期对比
🔐 ChatGPT OAuth 2.1 + PKCE
🐳 Docker Compose 自托管部署
Related MCP server: google-health-mcp-server
🏗 工作方式
Google Health
│
▼
Google OAuth
│
▼
Google Health MCP
│
OAuth 2.1
│
▼
ChatGPT项目包含两套相互独立的 OAuth:
ChatGPT → MCP:本项目作为 OAuth 2.1 授权服务器,为 ChatGPT 签发访问令牌。MCP → Google Health:本项目作为 Google OAuth 客户端,读取个人健康数据。
ChatGPT 不会获得 Google refresh token,相关凭据仅保存在自建 PostgreSQL 中。
🧰 MCP 工具
get_profilelist_devicesquery_health_data_typeget_daily_rollupget_exercise_sessionsget_health_overviewcompare_health_periods
可查询的数据包括步数、睡眠、运动、心率、静息心率、HRV、血氧、呼吸率、睡眠温度变化、体重等。实际可用范围取决于账号、设备及 Google Health 中已有的数据。
🚀 快速部署
1. 准备 Google OAuth
在 Google Cloud 中启用 Health API,创建 Web OAuth 客户端,并配置回调地址:
https://你的域名/oauth/google/callback2. 配置环境变量
cp .env.example .env
openssl rand -base64 32 # TOKEN_ENCRYPTION_KEY
openssl rand -hex 32 # MCP_ACCESS_TOKEN
openssl rand -base64 24 # OAUTH_ADMIN_PASSWORD请确保 DATABASE_URL 中的数据库密码与 POSTGRES_PASSWORD 一致。
3. 初始化并启动
docker compose up -d postgres
docker compose build app
docker compose run --rm app npm run db:init
docker compose up -d --build --force-recreate app4. 完成 Google 授权
浏览器访问:
https://你的域名/oauth/google/start输入 OAUTH_ADMIN_USER 和 OAUTH_ADMIN_PASSWORD,完成 Google Health 授权。
5. 检查服务
curl https://你的域名/health🤖 添加到 ChatGPT
MCP 地址:
https://你的域名/mcp认证方式选择 OAuth。ChatGPT 将自动完成 OAuth 元数据发现、动态客户端注册、PKCE 授权及 MCP 工具扫描。
可直接提问:
昨晚睡眠情况如何?
最近是否出现血氧异常?
本周运动量与上周相比怎样?
分析最近 28 天的睡眠、运动和恢复趋势。
🌐 Nginx 反向代理
以下路径必须正常转发到应用,不能根据来源 IP、User-Agent、Referer 或空 Authorization 请求返回 444:
/mcp
/.well-known/
/oauth/示例配置:
location = /mcp {
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Authorization $http_authorization;
proxy_set_header Mcp-Session-Id $http_mcp_session_id;
proxy_set_header Last-Event-ID $http_last_event_id;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_cache off;
gzip off;
proxy_read_timeout 3600s;
}
location ^~ /.well-known/ {
proxy_pass http://127.0.0.1:8787;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ^~ /oauth/ {
proxy_pass http://127.0.0.1:8787;
proxy_set_header Host $host;
proxy_set_header Authorization $http_authorization;
proxy_set_header X-Forwarded-Proto $scheme;
}未携带令牌访问 /mcp 时,应返回 401,并在 WWW-Authenticate 中包含 resource_metadata。
🔄 更新部署
git pull
docker compose up -d postgres
docker compose build app
docker compose run --rm app npm run db:init
docker compose up -d --force-recreate app数据库初始化使用 CREATE TABLE IF NOT EXISTS,不会删除已有授权数据。
🔒 安全说明
服务仅提供只读工具。
仅通过 HTTPS 对外提供服务。
不要公开
.env、数据库端口、Google 凭据、MCP Token 或管理密码。Google refresh token 使用 AES-256-GCM 加密后存入 PostgreSQL。
建议对 OAuth 接口设置合理的访问频率限制,并对日志进行脱敏。
📦 技术栈
TypeScript
Hono
Model Context Protocol SDK
PostgreSQL
Docker Compose
Google Health API v4
📄 License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/RoyLaw/google-health-chatgpt-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server