
OpenEHR
STDIOServer for interfacing with openEHR REST APIs to manage health record compositions and templates.
Server for interfacing with openEHR REST APIs to manage health record compositions and templates.
An MCP (Model Context Protocol) server designed to interface with openEHR REST APIs, specifically the EHRbase implementation. This server enables MCP clients like Claude Desktop to create compositions for openEHR templates and submit them to a server. For production grade EHR integrations you must use an AI Model where you can ensure data privacy.
See https://modelcontextprotocol.io/introduction for more information about MCP.
Current version: 0.1.0
This project follows semantic versioning. For details on our versioning strategy, see VERSIONING.md.
Not yet implemented
The easiest way to get started is to use the pre-built Docker image available on Docker Hub.
Ensure you have a running EHRbase server. For running one locally, see below.
Edit your Claude Desktop configuration file (claude_desktop_config.json) and add an "openEHR" configuration block inside the "mcpServers" section.
This file can usually be found in the following locations:
{ "mcpServers": { "openEHR": { "command": "docker", "args": [ "run", "-i", "--rm", "--network=host", "-e","EHRBASE_URL=http://localhost:8080/ehrbase/rest", "-e","EHRBASE_JSON_FORMAT=wt_flat", "ctodeakai/openehr-mcp-server:latest" ] } } }
You can point EHRBASE_URL to your own EHRbase server or use the provided docker-compose setup.
The MCP server supports different JSON serialization formats for interacting with the EHRbase API. You can configure the format using the optional EHRBASE_JSON_FORMAT
environment variable:
"-e", "EHRBASE_JSON_FORMAT=wt_flat"
Available format options:
For more information on how to set up Claude Desktop with MCP servers, see https://modelcontextprotocol.io/quickstart/user.
For this MCP server to work, you currently require
pip install -r requirements.txt
Navigate to the docker-compose directory:
cd docker-compose
Start the EHRbase server in detached mode:
docker compose up -d
Check the logs to verify the server is running properly:
docker compose logs -f
The EHRbase server will be available at http://localhost:8080/ehrbase/
The EHRBase API documentation should be here: http://localhost:8080/ehrbase/swagger-ui/index.html
After setting up the EHRbase server and your Python environment, you can upload the vital signs template:
python scripts/upload_template.py
You can also specify a custom template or EHRbase URL:
python scripts/upload_template.py --template path/to/template.opt --ehrbase-url http://custom-url:8080/ehrbase/rest
You should see output confirming the successful upload of the template to the EHRbase server.
After uploading the template, you need to create an Electronic Health Record (EHR) to store compositions:
python scripts/create_ehr.py
This will create an EHR with a randomly generated subject ID. You can also specify a custom subject ID:
python scripts/create_ehr.py --subject-id "patient_12345"
The script will output the EHR ID, which you'll need when creating compositions or using the MCP server.
To run the tests, you'll need to install the test dependencies first:
pip install -r requirements-test.txt
After installing the test dependencies and uploading the template, you can run the tests with:
python -m pytest tests/test_*.py -v
This will run all the tests in the tests
directory.
Build the Docker image from the project root:
docker build -t openehr-mcp-server .
docker run -i --rm --network=host openehr-mcp-server