resmed-data-mcp 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -23
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# ResMed-Data-MCP
|
|
2
2
|
|
|
3
3
|
Archives raw data from a ResMed AirSense CPAP's SD card — read over Wi-Fi via
|
|
4
|
-
a Toshiba FlashAir card — into a local SQLite database on a Mac
|
|
5
|
-
serves it read-only to any MCP client (Claude, Codex,
|
|
6
|
-
LAN via Streamable HTTP.
|
|
4
|
+
a Toshiba FlashAir card — into a local SQLite database on a Mac, and
|
|
5
|
+
serves it read-only to any MCP client (Claude, Codex, and others) over the
|
|
6
|
+
LAN via bearer-token-authenticated Streamable HTTP.
|
|
7
7
|
|
|
8
8
|
This is a personal quantified-self data plane, not a clinical tool: it
|
|
9
9
|
archives every field the device reports (AHI, leak rate, pressure, usage
|
|
@@ -28,13 +28,14 @@ works on future firmware and other ResMed models without changes.
|
|
|
28
28
|
| Process | Role |
|
|
29
29
|
| --- | --- |
|
|
30
30
|
| **Indexer** (`resmed-data-mcp indexer`) | Always-on host. Polls the FlashAir on an interval (default 5m), downloads STR.edf and any new/changed DATALOG files, parses them, and writes to SQLite. |
|
|
31
|
-
| **MCP server** (`resmed-data-mcp serve`, default) | Always-on read-only MCP server over Streamable HTTP. Opens the same SQLite file read-only (WAL mode lets it read while the indexer writes). |
|
|
31
|
+
| **MCP server** (`resmed-data-mcp serve`, default) | Always-on read-only MCP server over Streamable HTTP, bearer token required. Opens the same SQLite file read-only (WAL mode lets it read while the indexer writes). |
|
|
32
32
|
|
|
33
33
|
Both run as separate LaunchAgents (see `examples/`) so a slow FlashAir sync
|
|
34
34
|
never blocks queries and a client bug never touches the data. The MCP server
|
|
35
35
|
listens on `0.0.0.0:8420` by default, so it's reachable identically whether
|
|
36
36
|
a client is on the same Mac or elsewhere on the LAN — every client just
|
|
37
|
-
points at `http://<host>:8420/mcp
|
|
37
|
+
points at `http://<host>:8420/mcp` and sends `Authorization: Bearer <token>`
|
|
38
|
+
(see [Security](#security)).
|
|
38
39
|
|
|
39
40
|
## Data model
|
|
40
41
|
|
|
@@ -51,7 +52,7 @@ points at `http://<host>:8420/mcp`.
|
|
|
51
52
|
- **`source_files`, `sync_runs`, `devices`** — provenance and operational
|
|
52
53
|
history: what file came from where, when, and whether syncing is healthy.
|
|
53
54
|
|
|
54
|
-
Event files are decoded into `session_events`. Each apnea or hypopnea row includes the pressure and leak at that minute and whether pressure rose over the next two minutes. `minute_stats` is one row per minute of pressure, leak, flow limitation, tidal volume, respiratory rate, snore, oxygen, and event counts. `night_therapy` rolls those minutes up against the night's minimum and maximum pressure.
|
|
55
|
+
Event files (the EDF+ annotation channel in `DATALOG` `_EVE` / `_CSL` files) are decoded into `session_events`. Each apnea or hypopnea row includes the pressure and leak at that minute and whether pressure rose over the next two minutes. `minute_stats` is one row per minute of pressure, leak, flow limitation, tidal volume, respiratory rate, snore, oxygen, and event counts. `night_therapy` rolls those minutes up against the night's minimum and maximum pressure.
|
|
55
56
|
|
|
56
57
|
No vector database: this data is fully structured and numeric (nightly
|
|
57
58
|
metrics, calibrated signal samples), which SQL aggregation handles better
|
|
@@ -117,12 +118,13 @@ relocates the whole `~/.resmed-data-mcp/` directory (test/dev only).
|
|
|
117
118
|
|
|
118
119
|
```bash
|
|
119
120
|
resmed-data-mcp backfill # one-shot: pulls everything currently on the card
|
|
121
|
+
resmed-data-mcp http-token # creates the HTTP bearer token on first use and prints it
|
|
120
122
|
```
|
|
121
123
|
|
|
122
124
|
Copy `examples/com.resmed-data-mcp.indexer.plist` and
|
|
123
125
|
`examples/com.resmed-data-mcp.server.plist` into `~/Library/LaunchAgents/`,
|
|
124
126
|
replacing `REPLACE_ME_WITH_NPM_BIN_DIR` and
|
|
125
|
-
`REPLACE_ME` (your username) with real values, then:
|
|
127
|
+
`REPLACE_ME` (your macOS username) with real values, then:
|
|
126
128
|
|
|
127
129
|
```bash
|
|
128
130
|
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.resmed-data-mcp.indexer.plist
|
|
@@ -132,11 +134,18 @@ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.resmed-data-mcp.serv
|
|
|
132
134
|
### Point clients at it
|
|
133
135
|
|
|
134
136
|
See `examples/mcp-client.json`. Any MCP client that supports an HTTP server
|
|
135
|
-
entry
|
|
136
|
-
the
|
|
137
|
+
entry with headers connects the same way whether it runs on the Mac that hosts
|
|
138
|
+
the server or another machine on the same LAN:
|
|
137
139
|
|
|
138
140
|
```json
|
|
139
|
-
{
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"resmed-data": {
|
|
144
|
+
"url": "http://<host>:8420/mcp",
|
|
145
|
+
"headers": { "Authorization": "Bearer <token from resmed-data-mcp http-token>" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
140
149
|
```
|
|
141
150
|
|
|
142
151
|
## Paths
|
|
@@ -151,19 +160,15 @@ All under `~/.resmed-data-mcp/` (config cannot override this directory):
|
|
|
151
160
|
|
|
152
161
|
## Security
|
|
153
162
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
Every HTTP request, including `/health`, needs `Authorization: Bearer <token>`;
|
|
164
|
+
anything else gets `401`. The token is a random secret created on first use and
|
|
165
|
+
kept in the login Keychain (service `resmed-data-mcp-http`, account
|
|
166
|
+
`http-auth-token`), never in config or logs. `resmed-data-mcp http-token`
|
|
167
|
+
prints it. It is still meant for a trusted home LAN: don't expose port 8420 to
|
|
168
|
+
the internet (no port forwarding, no tunnel). The MCP server's database
|
|
169
|
+
connection is read-only at the SQLite level, so even a buggy or malicious
|
|
170
|
+
client can't write through it.
|
|
158
171
|
|
|
159
|
-
## Known limitations
|
|
160
|
-
|
|
161
|
-
- **EDF+ annotation signals** (the "EDF Annotations" channel, used for event
|
|
162
|
-
timestamps in some DATALOG detail files) are archived as raw bytes but not
|
|
163
|
-
decoded into structured events yet — there was no real annotation-bearing
|
|
164
|
-
file available to validate a decoder against when this was built. Decoding
|
|
165
|
-
can be added once DATALOG detail files with real annotations exist on a
|
|
166
|
-
card.
|
|
167
172
|
## License
|
|
168
173
|
|
|
169
174
|
MIT
|
|
@@ -184,7 +189,10 @@ gitleaks git --log-opts=--all --config .gitleaks.toml --redact=100 --no-banner .
|
|
|
184
189
|
npm run build && npm run scan:package
|
|
185
190
|
```
|
|
186
191
|
|
|
187
|
-
|
|
192
|
+
Before a pull request is merged, `python3 .security/local-gate.py <PR number>`
|
|
193
|
+
runs Gitleaks, the production `npm audit`, offline Semgrep and the tests on the
|
|
194
|
+
exact PR head and records the result as the `local-gate` status. Push and
|
|
195
|
+
pull-request CI also scans full fetched history and package contents.
|
|
188
196
|
The prepublishOnly lifecycle rebuilds and scans the exact npm file list.
|
|
189
197
|
After a history rewrite, discard old clones and re-clone; merging old history
|
|
190
198
|
can restore removed data. Releases use GitHub Release → npm OIDC.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resmed-data-mcp",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "Indexer and read-only MCP server for ResMed AirSense CPAP data: reads the SD card over Wi-Fi through a Toshiba FlashAir card, archives every EDF signal (nightly summary, per-minute therapy detail, events) in a local SQLite database, and serves it to any MCP client over bearer-token HTTP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
7
7
|
"bin": {
|