This document describes the integration of MCPX and the docktor command in DHTI.
DHTI uses MCPX (Model Context Protocol Gateway) to aggregate multiple Model Context Protocol (MCP) servers. This allows agentic tools to interact with various inference pipelines through a single gateway.
The docktor command manages these inference pipelines, which are packaged as Docker images. Each pipeline exposes its functionality as an MCP server.
- MCPX Container: The gateway that manages and exposes tools from connected MCP servers.
- Inference Pipelines: Docker containers running MCP servers (e.g., for skin cancer classification).
- Docktor CLI: A command-line tool to add, remove, and list inference pipelines in the MCPX configuration.
- DHTI CLI installed.
- Docker running.
Enable Docktor in your DHTI setup:
dhti-cli compose add -m docktor
dhti-cli docker -uTo add a new pipeline, use the docktor install command:
dhti-cli docktor install my-pipeline --image my-image:latest --model-path ./path/to/models
dhti-cli docktor install sequential-thinking --image mcp/sequentialthinking --model-path ~/temp -e DEBUG=trueinstall: The operation to perform.my-pipeline: A unique name for the server.--image: The Docker image containing the MCP server.--model-path: (Optional) Local path to a directory containing models. This will be mounted to/modelinside the container.
{
"servers": {
"mcpx": {
"transport": "http",
"url": "http://0.0.0.0:9000/mcp",
}
}
}
To remove a pipeline:
dhti-cli docktor remove my-pipelineTo list all installed pipelines:
dhti-cli docktor listTo create a compatible inference pipeline, follow these recommendations:
- Base Image: Use a lightweight Python image (e.g.,
python:3.9-slim). - MCP Sdk: Install the
mcppython package. - Server Logic: Implement an MCP server that exposes your inference functions as tools.
- Model Loading: Load models from the
/modeldirectory. - Data Handling: Data can be obtained from the FHIR server or added as filename statrting with patientId in the /model directory. The input to all mcp tools should include the patientId whenever possible.
- Entrypoint: Set the container entrypoint to run your server script.
- See /docktor directory for complete examples.