Skip to main content
Glama
health-mcp
by ojimpo

health-mcp

health.ojimpo.com(Cultural Health Dashboard)の健康・文化活動データを Claude から会話で扱えるようにする読み取り専用 MCP サーバーです。

背景・動機

health-ojimpo は、音楽・読書・運動・SNS などの日常の文化的活動を外部サービスから自動収集し、個人の基準値に対するスコアとして可視化することで、メンタルヘルスの変調を早期に察知するダッシュボードです。

ダッシュボードは「眺める」には良いのですが、「先月と比べて音楽が減ってるのはなぜ?」「この1年で読書が多かった月は?」のような問いかけにはAIとの対話のほうが向いています。そこでダッシュボードのデータをMCPツールとして公開し、claude.ai / Claude Code のどちらからでも自然言語で健康データを分析できるようにしました。

同じ構成の自作MCPサーバー otp-mcp(乗換案内)・cosense-mcp(Cosense)に続く3つ目で、足場(stdio/HTTP両対応のトランスポート層)はそれらから流用しています。

Related MCP server: Apple Health Shortcuts MCP

設計思想

  • 読み取り専用: データの取り込みや設定変更は載せない。MCP経由での誤操作リスクをゼロにし、認証なし運用(後述)を許容できるようにする

  • バックエンドに寄生しない: health-ojimpo の REST API を叩くだけの薄いクライアント。スコアリングロジックはバックエンド側の単一実装のまま

  • 出力サイズを制御: スコア履歴のカテゴリ列はオプトイン、生データは件数上限 + 週/月集計モードで、LLMのコンテキストを溢れさせない

  • stdio と Streamable HTTP の両対応: ローカルの Claude Code からは stdio、claude.ai からは Cloudflare Tunnel 経由の HTTP で同じサーバーに接続する

ツール

ツール

説明

get_current_status

現在の健康/文化スコア・ステータス、カテゴリ別の今週vs先週、コンディション(睡眠/Readiness/ストレス等)、トレンドコメント

get_score_history

スコアの時系列(1m/3m=日次、1y=週次)。カテゴリ列は必要な分だけ指定

get_recent_activities

直近の具体的なアクティビティ(聴いた曲、運動、観た映画など)

list_sources

設定済みデータソース一覧(カテゴリ・分類・基準値)。query_records の引数探索用

query_records

生の日次レコードを日付範囲で取得。source/categoryフィルタ、week/month集計対応

構成

claude.ai ──HTTPS──> Cloudflare Tunnel ──> localhost:4102 ──> health-mcp(Docker)
Claude Code ──stdio──> node build/index.js                        │ HTTP (docker network)
                                              health-ojimpo backend (FastAPI) <──┘
  • health-mcp コンテナは health-ojimpo の Docker ネットワーク(health-ojimpo_default)に相乗りし、http://backend:8000 でAPIに到達します

  • stdio モード(Claude Code)はホストの http://localhost:8400(backendのlocalhost公開ポート)を使います

セットアップ

ビルド

npm install
npm run build

CLI(動作確認用)

export HEALTH_API_BASE_URL=http://localhost:8400
node build/index.js status
node build/index.js history 3m music,sleep
node build/index.js recent 5
node build/index.js sources
node build/index.js records 2026-06-01 2026-06-30 lastfm '' week

Docker(HTTP モード)

docker compose up -d --build
curl http://localhost:4102/health   # {"status":"ok"}

※ health-ojimpo のスタックが先に起動している必要があります(externalネットワーク参照のため)。

Claude Code への登録(stdio)

claude mcp add --scope user health \
  --env HEALTH_API_BASE_URL=http://localhost:8400 \
  -- node /path/to/health-mcp/build/index.js

claude.ai への登録(リモートコネクタ)

  1. Cloudflare Tunnel の ingress に health-mcp.example.com → http://localhost:4102 を追加

  2. claude.ai → Settings → Connectors → Add custom connector → URL に https://health-mcp.example.com/mcp を指定

環境変数

変数

既定値

説明

HEALTH_API_BASE_URL

http://localhost:8400

health-ojimpo バックエンドのベースURL(Docker内は http://backend:8000)

TRANSPORT

stdio

http で Streamable HTTP サーバーとして起動

PORT

3000

HTTPモードのリッスンポート

MCP_AUTH_TOKEN

(空)

設定すると /mcp にBearer認証を要求。claude.aiカスタムコネクタは静的トークン未対応のため通常は空

将来の展望

  • 主観フィードバック(気分の記録)ツール — バックエンド側にエンドポイントができたら書き込み系として追加検討

  • スコア変動の要因分解ツール(どのソースがスコアを下げているかの内訳)

Available Tools

5 tools
get_current_statusA

Get the current snapshot of the personal health dashboard (health.ojimpo.com): overall health score/status (NORMAL/CAUTION/CRITICAL) and cultural activity score/status (RICH/MODERATE/LOW), per-category cards (this week vs previous week with change), condition state cards (sleep/readiness/stress/weight/outing/CTL), and trend comments. Scores are percentages of personal baselines (100 = baseline met). Use this first for any 'how am I doing' question.

Inputs: no named parameters.

get_recent_activitiesA

List the most recent concrete activities across all sources (e.g. tracks listened, workouts, movies watched, commits) as human-readable lines with relative time. The backend keeps the latest 8.

Inputs: limit.

get_score_historyA

Get the score time series: one row per date with overall health_score and cultural_score, plus optional per-category score columns. range 1m/3m = daily points, 1y = weekly points. Valid category names — activity: music, exercise, reading, movie, sns, coding, calendar, live, shopping, vitality, outing_activity, cd, podcast, game, like, study; state: sleep, readiness, stress, weight, outing, ctl. Add only the categories you need to keep output small.

Inputs: range, categories.

list_sourcesA

List all configured data sources with their category, display_type (activity/card_only/state), classification (baseline/event/health_only/both), status, and baseline (base_value per aggregation period). Use to discover valid 'source' and 'category' values for query_records.

Inputs: no named parameters.

query_recordsA

Query raw daily activity records (one row per date x source x category: minutes, raw_value, raw_unit). Requires a from/to date range (YYYY-MM-DD). Filter by source and/or category (see list_sources). For ranges over ~2 months prefer group_by week or month to keep output small; raw mode is capped by 'limit' and reports truncation.

Inputs: to (required), from (required), limit, source, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: snapshot status, recent activities, historical scores, source metadata, and raw data queries. No overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., get_current_status, list_sources, query_records), making the set predictable and easy to navigate.

    Tool Count5/5

    Five tools is an appropriate scope for a health dashboard, covering key operations without being too sparse or overly heavy.

    Completeness5/5

    The set provides a complete view of health data: current status, recent activities, historical trends, source configurations, and raw data access. No obvious gaps for a read-only dashboard.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers