google-health-chatgpt-selfhost
by paceaitian
README.md
# Google Health ChatGPT Self-host
An unofficial, single-user reference implementation for reading a narrowly bounded set of Google Health data from ordinary ChatGPT conversations through a private MCP connection.
This repository is source code and a deployment guide. It does **not** publish or expose anyone's existing MCP service, ChatGPT app, tunnel, Google Cloud project, credentials, or health data. Each deployer creates and owns an independent Google Cloud project, OAuth grant, OpenAI tunnel, host, and ChatGPT Developer Mode app.
## What it provides
- A Node.js stdio MCP server with exactly four read-only tools.
- Four fixed Google Health read-only OAuth scopes.
- Fixed data-type allowlists: 32 reconcile types, 18 rollup types, and IRN history.
- Server-generated Google filters, closed-open range validation, page-size limits, and privacy-preserving field masks.
- A 90,000-byte upstream response limit enforced while the response is streamed, before the full body is buffered.
- Query-routing metadata embedded in MCP instructions, tool descriptions, and schemas so web ChatGPT can choose the correct operation without a separate private baseline.
- A local Skill and query catalog for development, review, and evaluation. Developer Mode does not automatically import this Skill into web ChatGPT.
- Google Cloud OAuth, Linux/systemd, OpenAI Secure MCP Tunnel, ChatGPT, Scheduled task, privacy, and troubleshooting guides.
## Deliberate boundaries
This project is for a private, single-user deployment. It has no write operation, public MCP endpoint, database, response cache, analytics pipeline, multi-user authentication, public Plugin Directory package, or medical-diagnosis feature. It is not a medical device.
When a tool runs, the requested health response travels from Google Health through the self-hosted process and OpenAI's tunnel to the ChatGPT conversation. The application code does not persist that response, but the deployer must separately understand and disclose the policies and retention behavior of Google, OpenAI, the hosting platform, and any infrastructure logs.
## Architecture
```text
ChatGPT conversation or Scheduled task
|
private Developer Mode app
|
OpenAI Secure MCP Tunnel
outbound HTTPS only
|
tunnel-client host
|
stdio Node.js MCP
|
Google OAuth refresh on demand
|
health.googleapis.com
```
Secure MCP Tunnel keeps the MCP server off the public internet, but it is a private development connection and is not a path to public plugin submission.
## Read-only contract
The OAuth grant is pinned to these scopes:
```text
https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly
https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly
https://www.googleapis.com/auth/googlehealth.irn.readonly
https://www.googleapis.com/auth/googlehealth.sleep.readonly
```
The MCP server exposes:
| Tool | Intended result |
|---|---|
| `google_health_daily_rollup` | Calendar-day totals and day-by-day trends |
| `google_health_physical_rollup` | 5-minute, 15-minute, 1-hour, 6-hour, or 24-hour buckets |
| `google_health_reconcile` | Daily, sample, interval, sleep-session, or exercise-session records |
| `google_health_irn_list` | Irregular-rhythm notification records |
The full type-to-method matrix is in [`skills/google-health-readonly/references/query-catalog.md`](skills/google-health-readonly/references/query-catalog.md).
## Deployment path
1. Read [`docs/architecture-and-scope.md`](docs/architecture-and-scope.md) and [`docs/privacy-and-security.md`](docs/privacy-and-security.md).
2. Configure an independent Google Cloud project and OAuth client with [`docs/google-cloud-oauth.md`](docs/google-cloud-oauth.md).
3. Obtain the single-user offline grant with [`docs/local-offline-grant.md`](docs/local-offline-grant.md).
4. Build and install the MCP server with [`docs/deploy-linux-systemd.md`](docs/deploy-linux-systemd.md).
5. Create and run the private tunnel with [`docs/openai-secure-mcp-tunnel.md`](docs/openai-secure-mcp-tunnel.md).
6. Add and validate the Developer Mode app with [`docs/chatgpt-developer-mode.md`](docs/chatgpt-developer-mode.md).
7. Only after interactive acceptance, configure a recurring task with [`docs/scheduled-task.md`](docs/scheduled-task.md).
Do not place credentials in this repository, chat messages, issue reports, command-line arguments, screenshots, or CI variables. The setup uses file paths in environment variables; the files themselves must be owner-only.
## Development
Requirements: Node.js 22 or newer, npm, and Python 3 only if you want to run the optional Codex Skill validator.
```bash
npm ci
npm run check
npm run audit:discovery
npm audit
```
The discovery audit contacts only Google's public API discovery document; it does not authenticate or query health data. The test suite uses synthetic fixtures.
If the Codex Skill validator is installed locally:
```bash
python3 /path/to/skill-creator/scripts/quick_validate.py skills/google-health-readonly
```
See [`CONTRIBUTING.md`](CONTRIBUTING.md) before submitting changes. Never include real health data, query results, account identifiers, OAuth values, tunnel IDs, or screenshots from private control planes in an issue or pull request.
## Upstream policy and product availability
Google Health API access, verification, scopes, and token behavior are governed by Google. Developer Mode and Secure MCP Tunnel availability and permissions are governed by OpenAI and may vary by account or workspace. Always re-check the linked official documentation during deployment.
## License
Apache License 2.0. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues