Addressable Microscope And Detector Experiment Unified Scripting (AMADEUS) provides an MCP server for microscope automation workflows, plus client-side state management and image analysis utilities.
AMADEUS is split into two runtime components:
client/: runs on the control computer and exposes MCP tools for instrument control, state, mapping, planning, preferences, and analysis.dm_server/: runs in the microscope software Python environment and receives ZMQ commands from the client.
The two components communicate over ZMQ using JSON messages. Image-producing commands return JSON metadata plus raw NumPy array bytes.
Vendor documentation, local debugging notes, and instrument-specific reference material are intentionally not included in this repository.
AMADEUS separates agent-facing orchestration from microscope-side execution. The MCP server runs on the control computer, stores experiment state locally, and forwards hardware commands over ZMQ. The microscope-side server is intentionally stateless: it handles one command, calls the relevant helper, returns data or an image, and forgets the request.
AI agent / MCP client
|
| stdio MCP
v
client/server.py
FastMCP tool registry
|
+--> client/state/
| StateManager, image store, maps, plans, preferences
|
+--> client/analysis/
| FFT, segmentation, EDS SI analysis
|
+--> client/transport/zmq_client.py
JSON / multipart image messages over ZMQ
|
v
dm_server/server.py
stateless command dispatcher
|
v
dm_server/helpers/
microscope, stage, camera, STEM, SI, EDS, files
|
v
microscope software Python environment
Agent / control computer
------------------------
MCP client
amadeus-server
client state + analysis
|
| ZMQ over TCP
| tcp://<VM IP here>:9876
v
DM computer / microscope PC
---------------------------
microscope software Python environment
dm_server/server.py
dm_server/helpers/
|
| vendor microscope control APIs
v
Microscope hardware
-------------------
stage, beam, detectors, camera, spectroscopy
- Python 3.11 or newer (client)
uv(client)- Python 3.10 or newer (Digitalmicrograph)
- Network access or ethernet bridge cable to Gatan
uv pip install -e ".[dev]"For same-machine development or a local mock server:
amadeus-server --dm-address tcp://localhost:9876 --data-dir ./amadeus_dataFor a microscope VM or remote host:
amadeus-server --dm-address tcp://<VM IP here>:9876 --data-dir ./amadeus_dataIn Digitalmicrograph, open 'server.py'
exec(open(r"C:\path\to\AMADEUS\dm_server\server.py").read())The server listens on port 9876 by default.
dm_gui.py provides a local manual-control GUI for the microscope-side environment.
When launching it from a console where __file__ is unavailable, set AMADEUS_HOME to the checkout directory first so imports resolve correctly.
exec(open(r"C:\path\to\AMADEUS\dm_gui.py").read())Microscope control:
get_focuschange_focusset_focusautofocusget_magnificationset_magnificationget_microscope_stateset_beam_blankset_column_valvesget_beam_shiftset_beam_shiftget_beam_tiltset_beam_tiltget_stigmationset_stigmationexecute_dm_script
Stage:
get_stage_positionmove_stage_relativemove_stage_absolutesave_stage_locationgo_to_saved_locationlist_saved_locations
Imaging and detectors:
take_stem_imagetake_camera_imageget_stem_settingsget_detectorsmove_beam_toget_beam_positionlist_camerasget_camera_info
Spectrum imaging:
configure_sistart_sistop_siget_si_status
EDS:
eds_acquire_pointeds_acquire_mapeds_describe_sieds_extract_elemental_mapeds_extract_multiple_mapseds_quantify_si
File and image store:
list_remote_dm_filesfetch_dm_filelist_local_imagesinspect_image
Client-side analysis:
compute_fftextract_lattice_spacingssegment_imageconvert_pixel_to_stage
Map:
add_map_objectlist_map_objectsget_map_objectmark_object_examinedlink_image_to_object
Plan, preferences, and sample metadata:
get_experimental_planset_experimental_planget_operational_preferencesset_operational_preferencesget_sample_metadataset_sample_metadata
Admin:
shutdown_dm_server
uv run --with pytest --with pytest-asyncio pytestThe tests run offline using mocks; they do not require a live microscope connection.
Not affiliated with or endorsed by Gatan Inc. DigitalMicrograph is a trademark of Gatan Inc.
This software is provided "AS IS", without warranty of any kind, express or implied. Use at your own risk.