← MeasureGPT · Architecture

Institutional · Behind the firewall

On-prem deployment

The MeasureGPT hospital package contains a Docker image, a streamable HTTP MCP server at /mcp, and two auth modes. These auth modes do not use the Clerk OAuth of the public demo. Thus CHOIR and the approved internal systems can call the service inside the perimeter.

Docker · HTTP /mcp · token or network · no public data-collection path

The public site on this host is an educational demo. It has accounts, rate limits, and OAuth on /mcp. The on-prem installation is a different profile of the same codebase. It has the same corpus and the same tools. Hospital programmers can install it behind the firewall. They do not need to clone the research monorepo. They do not need to open the service to the internet.

Rights

License and CHOIR relationship

Copyright (c) 2026 Ming-Chih Kao. All rights reserved.

MeasureGPT was developed to support CHOIR. It also supports the approved institutional workflows that operate with CHOIR behind the firewall. The software is closed source. It is not part of the CHOIR open-source project or the CHOIR license.

TopicPosition
What this isProprietary software with curated psychometric metadata: cutoffs, norms, bands, citations, and provenance
CHOIRThe software integrates with CHOIR and SHC systems. It does not have a second license as CHOIR. You cannot redistribute it under the CHOIR terms.
Institutional usePermitted only under a separate written agreement with the copyright holder
Not grantedPublic redistribution, sublicensing, and use of the package as CHOIR open source
Not in the packageThe closed-access paper PDFs in papers/. The service does not need them at runtime.

More detail for the operator is in LICENSE, NOTICE.md, and docs/INSTALL-HOSPITAL.md. These files are in the source tree and in the offline bundle.

This is an educational interpretation service. It is not a diagnostic device. Each output has caveats. Use an output as decision support. Do not use it as a diagnosis.

Problem

Why a separate on-prem profile

FirewallOften a clinical workflow cannot call a public SaaS MCP server. The service must run inside the institutional network. Scoring must not need an outbound connection.
Not the public demoThe public /mcp endpoint uses Clerk OAuth, user tiers, and protection against automatic data collection. A hospital needs perimeter authentication and, optionally, a shared secret. A hospital does not need controls against the creation of many accounts.
What the operator receivesThe hospital IT department should receive a Docker image with a version and an installation document. It should not receive the full git history of the research, the spot checks, and the closed-access PDFs.
Same contractCHOIR continues to use streamable HTTP at /mcp. The tools are the same as the tools of this site: list_measures, interpret_score, the profile tools, and the optional analysis recipes.
Institutional network: internet to CHOIR, CHOIR to private MeasureGPT, no direct MeasureGPT internet path
The institutional placement. Public traffic goes to CHOIR. CHOIR and the approved systems call MeasureGPT inside the firewall. MeasureGPT does not need a public internet endpoint.

Package

What the package contains (same repository, optional profile)

There is no second git repository in the working tree. Development stays in this monorepo. The distribution is an offline bundle with a version tag. npm run package:hospital builds it.

ArtifactRole
measuregpt-hospital:<ver>The Docker image with Node, R, and Python. It gives the web UI and the streamable HTTP /mcp endpoint.
docker-compose.hospital.ymlStarts the service with one command. It reads the environment from .env.hospital only.
MCP_AUTH_MODEUse token (recommended) or network. Do not use the public oauth mode.
hospital-smoke.shChecks the health profile. It also checks the MCP endpoint for a 401 response and for bearer authentication.
mcp-contract/The pinned tool schemas and example envelopes for the CHOIR developers
samples/choir-interpret-score-phq9.jsonOne PHQ-9 request and response example
k8s/A short example of a ClusterIP Deployment, a Service, and a NetworkPolicy
THIRD-PARTY-NOTICES.md and sbom.cdx.jsonThe license inventory of the production npm packages, and an SBOM that uses a CycloneDX-style format

The related source files are src/lib/mcp-auth-mode.ts, src/mastra/http.ts, docs/INSTALL-HOSPITAL.md, docs/hospital/, scripts/package-hospital-image.sh.

Security

Auth modes for /mcp

ModeWhenClient requirement
oauthFor the public demo. This is the default when the variable is not set.A Clerk OAuth bearer token. Do not use this mode in an isolated hospital network.
tokenRecommended on-premAuthorization: Bearer <MCP_SERVICE_TOKEN>
networkTrust from the perimeter only, such as a VPN or a private subnetNone. The service trusts every host that can connect to the port.

Runbook

Install (offline image)

  1. Load the image

    gunzip -c measuregpt-hospital-1.0.0-image.tgz | docker load
    # → measuregpt-hospital:1.0.0
    If you use more than one node, or if you use Kubernetes, you can add a tag and push the image to a private registry. This step is optional. The image is the same as the image in the tar file.
  2. Configure

    cp .env.hospital.example .env.hospital
    # For token mode (the default), set MCP_SERVICE_TOKEN.
    # For network mode, set MCP_AUTH_MODE=network and leave the service token empty.
    # MEASUREGPT_VERSION=1.0.0
  3. Start

    docker compose -f docker-compose.hospital.yml --env-file .env.hospital up -d
    # The application and the MCP server are at http://localhost:3583/mcp
    Compose reads .env.hospital into the container. It does not use the public-demo .env file of a developer.
  4. Test the installation

    curl -fsS http://127.0.0.1:3583/api/health
    # The result must have deployment.profile == "hospital" and protections.ready == true
    
    bash hospital-smoke.sh
    # In token mode, run: MCP_SERVICE_TOKEN=… bash hospital-smoke.sh

The full operator guide is docs/INSTALL-HOSPITAL.md. A maintainer builds the bundle with npm run package:hospital.

Integration

Point CHOIR at /mcp

The endpoint uses streamable HTTP MCP. It has the same tools as the MeasureGPT web UI. Token mode is the recommended mode.

Token mode (recommended)

MEASUREGPT_MCP_URL=https://measuregpt.your-hospital.internal/mcp
MEASUREGPT_MCP_AUTHORIZATION="Bearer ${MCP_SERVICE_TOKEN}"
{
  "mcpServers": {
    "measuregpt": {
      "url": "https://measuregpt.your-hospital.internal/mcp",
      "headers": {
        "Authorization": "Bearer REPLACE_WITH_MCP_SERVICE_TOKEN"
      }
    }
  }
}

Network mode

MEASUREGPT_MCP_URL=https://measuregpt.your-hospital.internal/mcp
# no Authorization header

Tools CHOIR can call

ToolPurpose
list_measures and get_measureGive the catalog and the full rubric
interpret_scoreConverts a measure and a score to a severity and norm interpretation
get_validation_studiesGives the cited validation literature
list_profiles and interpret_profileGive the multi-score batteries
list_analysis_recipes, submit_analysis, and get_analysis_jobRun the optional R and Python recipes on the same host

The same host also has two optional REST routes: GET /api/measures and POST /api/interpret. For offline development, use the contract snapshots in mcp-contract/ and the PHQ-9 example in samples/.

Operations

Operations notes

Short checklist before you start the service

Related: Architecture · Home · source docs/INSTALL-HOSPITAL.md