HomeCare Cohort MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
conda create -n homecare-mcp python=3.11 -y
conda activate homecare-mcp
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add homecare-cohort-mcp -- node "<FULL_PATH_TO_HOMECARE_COHORT_MCP>/dist/index.js"

Replace <FULL_PATH_TO_HOMECARE_COHORT_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Identifies high-risk patient cohorts and generates care gap closure plans.

HomeCare Cohort MCP (Step 1)

FastMCP server that powers the TopGun HomeCare demo Step 1 agents. It exposes tools to surface the high‑risk cohort and produce the Step 1b care gap closure plan from the synthetic OMOP-like dataset.

Prerequisites

  • macOS / Linux shell
  • Conda (recommended) or Python 3.11
  • Repo cloned at /Users/mdnasir/Documents/proj/TopGun/code/homecare-cohort-mcp

Environment Setup

conda create -n homecare-mcp python=3.11 -y
conda activate homecare-mcp
pip install -r requirements.txt

Build DuckDB Dataset

The synthetic CSVs live in ../synthetic_data. Rebuild the DuckDB file whenever the CSVs change:

cd /Users/mdnasir/Documents/proj/TopGun/code/homecare-cohort-mcp
python -c "from db import ensure_database; ensure_database(force_rebuild=True)"

This creates/overwrites data/homecare.duckdb and materializes helper views (latest_sbp, latest_eye_exam, etc.).

Run the MCP Server Locally

cd /Users/mdnasir/Documents/proj/TopGun/code/homecare-cohort-mcp
uvicorn server:app --reload --port 8010

The Streamable HTTP transport is available at http://127.0.0.1:8010/mcp.

Example Tool Calls

Using the MCP CLI (from the same conda env):

# Identify Step 1a cohort
mcp run server.py:mcp --call get_highrisk_cohort --data '{"limit": 6}'

# Build Step 1b care gap plan
mcp run server.py:mcp \
  --call care_gap_closure_plan \
  --data '{"patient_ids": ["PAT-00042", "PAT-00058"]}'

Or use MCP Inspector (mcp dev server.py:mcp) to interactively inspect Markdown and structured JSON.

Smoke Test

python smoke_test.py

(Ensures both Step 1 tools execute and return non-empty results.)

Deployment Notes

  • Optional build step (if rebuilding DB on deploy):
    python -c "from db import ensure_database; ensure_database()"
    
  • Configure MCP_ALLOWED_HOSTS / MCP_ALLOWED_ORIGINS and future API keys (CMS, HDI, Medical Research).

Repository Structure

homecare-cohort-mcp/
├── api/index.py          # Vercel entrypoint
├── data/homecare.duckdb  # Generated DuckDB file (ignored by default)
├── db.py                 # DuckDB loader + helper views
├── requirements.txt
├── server.py             # FastMCP server with Step 1 tools
├── smoke_test.py         # Regression script
└── vercel.json

Tools (2)

get_highrisk_cohortIdentifies a cohort of high-risk patients from the synthetic dataset.
care_gap_closure_planGenerates a care gap closure plan for specified patient IDs.

Environment Variables

MCP_ALLOWED_HOSTSList of allowed hosts for the MCP server
MCP_ALLOWED_ORIGINSList of allowed origins for the MCP server

Configuration

claude_desktop_config.json
{"mcpServers": {"homecare-cohort": {"command": "uvicorn", "args": ["server:app", "--port", "8010"]}}}

Try it

Identify the top 10 high-risk patients from the database.
Create a care gap closure plan for patient PAT-00042.
Generate a care gap closure plan for patients PAT-00042 and PAT-00058.

Frequently Asked Questions

What are the key features of HomeCare Cohort MCP?

Surfaces high-risk patient cohorts from synthetic OMOP-like data. Generates structured care gap closure plans. Powered by a DuckDB-backed FastMCP server. Includes helper views for clinical metrics like latest blood pressure and eye exams.

What can I use HomeCare Cohort MCP for?

Clinical decision support for homecare management teams. Automated identification of patients requiring immediate care intervention. Streamlining the creation of care gap closure documentation for healthcare providers.

How do I install HomeCare Cohort MCP?

Install HomeCare Cohort MCP by running: conda create -n homecare-mcp python=3.11 -y && conda activate homecare-mcp && pip install -r requirements.txt

What MCP clients work with HomeCare Cohort MCP?

HomeCare Cohort MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep HomeCare Cohort MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare