Skip to main content

healthcloud-cli

hc is the HealthCloud MCP gateway CLI. It has exactly one subcommand per MCP tool -- 996 commands across 12 audiences (patient, fieldagent, ehr, vitals, diagnostics, appointments, graph, person, provider, tenantadmin, connectors, telehealth) -- generated dynamically at startup from a shared manifest. Nothing here is hand-written per tool: the same manifest also drives the sibling NPM CLI (@healthcloud CLI in packages/cli/npm), so command names match exactly between the two.

Install

pip install healthcloud-cli

This installs the hc console script plus its dependency, the healthcloud-sdk package, which does the actual HTTP/JSON-RPC work against the MCP gateway.

Local development

healthcloud-sdk is not yet published to PyPI, so for local development you must install it in editable mode from this repo before installing this package:

cd packages/cli/pip

# 1. Install the local SDK in editable mode (resolves `healthcloud-sdk` without PyPI)
pip install -e ../../pip

# 2. Install this CLI package (+ dev/test dependencies) in editable mode
pip install -e ".[dev]"

# 3. Run the test suite
python -m pytest

# 4. Try it
hc --help
hc mcp tools list --audience patient
hc mcp patient get-patient --help

The bundled tool manifest (healthcloud_cli/contracts/mcp-tools.manifest.json) is a copy of packages/cli/contracts/mcp-tools.manifest.json. Re-sync it after pulling manifest changes with:

python scripts/bundle_manifest.py

This also runs automatically as a hatchling build hook whenever you python -m build, so a built wheel/sdist is always self-contained and never depends on a relative path outside the installed package.

Authentication & configuration

Every command accepts these global options (place them before the mcp subcommand):

Flag Env var Meaning
--access-token HC_ACCESS_TOKEN Bearer token sent to the MCP gateway
--base-url HC_MCP_BASE_URL Override the MCP gateway base URL
--profile HC_PROFILE Named profile (see below)
--output -- pretty (default) | json | raw
--raw -- Shortcut for --output raw
--verbose -- Print request diagnostics to stderr

Precedence, highest wins: explicit CLI flag > environment variable > profile file value > built-in default (environment defaults to "dev"; accessToken/baseUrl default to unset). The resolved access token is never written to logs, generated files, or test snapshots.

Optional profile file

~/.healthcloud/cli/profiles.json:

{
  "dev-mia": {
    "baseUrl": "https://dev-api-mcp.health.cloud",
    "accessToken": "eyJ...",
    "environment": "dev"
  }
}

A missing profiles file is not an error -- profiles are entirely optional. If --profile/HC_PROFILE names a profile and the file (or that entry) is missing, hc exits with a clear usage error rather than silently ignoring it.

hc --profile dev-mia mcp patient get-patient --patient-id patient-123

Listing and inspecting tools

# Local (bundled manifest, no network call)
hc mcp tools list
hc mcp tools list --audience patient

# Live gateway (requires --audience)
hc mcp tools list --audience patient --remote

# Full manifest entry for one tool (description, inputSchema, method/path)
hc mcp tools show patient add_insurance --output json

Calling a tool

Every manifest tool is its own subcommand, grouped by audience:

hc mcp patient get-patient --patient-id patient-123
hc mcp appointments book-appointment --patient-id patient-123 --slot-id slot-456

Run --help on any generated command to see its real manifest description and arguments:

hc mcp patient get-patient --help

Argument flags

  • Primitive properties (string/number/integer/boolean) become a normal flag in kebab-case, e.g. patient_id -> --patient-id.

    • enum values are validated; invalid values are rejected before any network call.
    • minimum/maximum/exclusiveMinimum/exclusiveMaximum are enforced the same way.
    • Boolean properties are a tri-state flag pair: --flag/--no-flag. Passing neither leaves the value unset (falls back to the manifest default or an --input/--stdin value, if any); passing one sets it explicitly to true/false.
  • Object/array properties are never flattened. They get a single --<prop>-json flag that takes a raw JSON string, e.g.:

    hc mcp patient create-medication \
      --patient-id patient-123 \
      --name "Metformin" \
      --dosage-json '{"value":10,"unit":"mg","frequency":"once_daily"}'
    
  • Path parameters (from {placeholders} in the tool's HTTP path) are always required, in addition to whatever inputSchema.required lists.

Bulk input: --input / --stdin

hc mcp appointments book-appointment --input request.json
cat request.json | hc mcp appointments book-appointment --stdin

--input <file> and --stdin both supply a base JSON object of arguments. --input and --stdin cannot be combined. Merge precedence (highest wins): manifest defaults < --input/--stdin object < explicit flags -- i.e. an explicit flag you actually pass always overrides the same key coming from a file or stdin, which in turn overrides the schema default.

After merging, the final object is validated against the tool's inputSchema (required fields present, correct types, enum membership, numeric bounds). Any validation failure prints a clear message to stderr and exits 2, without making a network call.

hc mcp call -- generic escape hatch

hc mcp call dispatches to any MCP tool by its exact snake_case tool name -- including one not yet present in the bundled manifest (the tool name itself is never validated against the manifest, it's just forwarded):

hc mcp call patient get_patient --input '{"patient_id":"patient-123"}'
hc mcp call patient get_patient --input-file request.json
cat request.json | hc mcp call patient get_patient --stdin

Note the deliberate inconsistency versus named commands: here --input takes an inline JSON value, not a file path -- use --input-file for a file. Exactly one of --input / --input-file / --stdin may be given (or none, meaning {}).

Output modes

The MCP tool-call result is { content: [{type:"text", text: "..."}], is_error: bool } from the JSON-RPC response's .result, or the JSON-RPC .error object if the gateway returned one.

  • pretty (default): if content[0].text parses as JSON, pretty-prints the parsed value; otherwise prints the raw text. On a JSON-RPC error, prints error.message (and error.code with --verbose) to stderr.
  • json: prints the tool result's parsed JSON (or raw text if unparseable) to stdout, with no envelope.
  • raw: prints the complete JSON-RPC envelope (id, jsonrpc, result, error) as returned by the gateway.

Diagnostics and --verbose logs always go to stderr -- stdout stays pipeable in every mode.

Exit codes

Code Meaning
0 Success
2 Local input validation failure (bad JSON, missing required field, invalid enum/number, --input+--stdin both given, unknown option) -- no network call made
3 HTTP/network failure talking to the MCP gateway
4 JSON-RPC error response (.error is not None)
5 MCP tool result reported is_error: true

Building

pip install build
python -m build
python -m zipfile -l dist/*.whl   # confirm the bundled manifest is included

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

healthcloud_cli-0.1.0.tar.gz (63.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

healthcloud_cli-0.1.0-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file healthcloud_cli-0.1.0.tar.gz.

File metadata

  • Download URL: healthcloud_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 63.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for healthcloud_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 314bcd8d54334584f89dcb059ce3761d1e426b7b065edf1754d2b28303544619
MD5 7e5d25b17630ded273f1bf3c0716cc17
BLAKE2b-256 7471d5fff9c2db6cf5a4d7e04c6d8b261eabd593eb8e99966d1fe937700d348d

See more details on using hashes here.

File details

Details for the file healthcloud_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for healthcloud_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eb27355009c929240ff3030b02d6054c0b7fa821c4df3434b08a13014cc18bc
MD5 a1690f907e970844f9751d98622eac1d
BLAKE2b-256 bab1c43b402706e530d1655770e5a679d292bc0f956e77ef484c992a4cae1d20

See more details on using hashes here.

Release history Release notifications | RSS feed

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page