mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
Expose four read-only relational tools and one prompt over the MCP wire,
each a thin re-export of an existing server-authoritative engine — no new
statistics, no new business logic:
- get_correlation: the FDR-controlled, lag-aware association between two
named metrics, selected out of the existing correlation discovery the
Coach and the insight route already run. Descriptive, never causal.
- compare_metric: two metrics over the same trailing window, or one metric
across two trailing windows, computed over the WMY rollup readers with a
delta only when both sides share a unit.
- get_metric_baseline: where today's reading sits against the user's own
usual range (median ± robust deviation) plus the strongest lagged driver,
reusing the metric-page baseline builder. Honest-null below the learning
floor — never a fabricated range.
- detect_changepoints: level shifts over the rollup tier via a small in-repo
CUSUM binary segmentation with a high firing bar.
- doctor_visit_summary prompt: a structured, grounded visit-prep summary
assembled from the doctor-report data path so the numbers match the
exported PDF, with the grounding framing injected once — data and context
only, no diagnosis or verdict.
Every tool returns values, units, reference bands and provenance, declares
read-only / non-destructive / closed-world annotations plus an output schema,
and reports { present: false } for absence. All reads stay session-narrowed
and read-only; the existing security posture is unchanged.
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* HealthLog MCP server — barrel.
|
|
*
|
|
* A read-only-by-default Model Context Protocol surface that re-exports
|
|
* HealthLog's existing server-authoritative read paths over the MCP wire, so a
|
|
* user can query their own health data from any MCP-capable assistant. The tool
|
|
* / resource layer here is transport-agnostic; transports (stdio now, remote
|
|
* `/mcp` later) attach to `createMcpServer(ctx)`.
|
|
*/
|
|
export { createMcpServer, MCP_SERVER_NAME, MCP_SERVER_VERSION } from "./server";
|
|
export { resolveMcpAuthContext, type McpAuthContext } from "./auth";
|
|
export { MCP_TOOLS, MCP_TOOL_NAMES, type McpToolDefinition } from "./tools";
|
|
export {
|
|
MCP_RESOURCES,
|
|
MCP_RESOURCE_URIS,
|
|
type McpResourceDefinition,
|
|
} from "./resources";
|
|
export {
|
|
MCP_PROMPTS,
|
|
MCP_PROMPT_NAMES,
|
|
type McpPromptDefinition,
|
|
type McpPromptResult,
|
|
type McpPromptMessage,
|
|
} from "./prompts";
|
|
export {
|
|
getCorrelation,
|
|
compareMetric,
|
|
getMetricBaseline,
|
|
detectChangepoints,
|
|
resolveRichMetric,
|
|
type RichMetric,
|
|
} from "./rich-reads";
|
|
export {
|
|
SCOPE_HEALTH_READ,
|
|
SCOPE_HEALTH_WRITE,
|
|
SCOPE_WILDCARD,
|
|
tokenAllowsRead,
|
|
tokenAllowsWrite,
|
|
sessionBinding,
|
|
} from "./scopes";
|