EPICS Channel Access

v0.1.2
io.github.K-Dense-AI/labmcp-epics Checked 15 hours ago Published 2 months ago

MCP server for EPICS Channel Access: read, monitor and guarded writes of process variables.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_connection_info Get Connection Info

Report which instrument is connected (identity, address, simulated or real), whether the server is read-only, and the active safety limits. Call this first.

get_command_log Get Command Log

Return the most recent raw commands sent to / replies received from the instrument (newest last). Useful for debugging and for recording what was done.

ParameterTypeDescription
limitinteger

reconnect Reconnect

Close and re-open the connection to the instrument (e.g. after it was power cycled or a cable was re-plugged).

get_pv Get Pv

Read one PV with its metadata: value, units, precision, alarm severity/status, IOC timestamp and age, display/alarm/warning/control limits and enum state names. Waveforms come back downsampled with min/max/mean statistics.

ParameterTypeDescription
name *stringPV name, e.g. 'BL7:MTR1.RBV'
max_elementsintegerArrays longer than this are downsampled

get_pvs Get Pvs

Read many PVs at once (e.g. all motors or vacuum gauges of a beamline). PVs that cannot be reached are listed in `errors` instead of failing the whole call.

ParameterTypeDescription
names *arrayPV names
max_elementsintegerArrays longer than this are downsampled

pv_info Pv Info

Connection details of a PV: serving IOC host:port, native type, element count, and whether this client has read/write access (EPICS access security) and passes the put allow-list.

ParameterTypeDescription
name *stringPV name, e.g. 'BL7:MTR1.RBV'

monitor_pv Monitor Pv

Subscribe to a PV and collect every value change for `duration_s` seconds (or until `max_updates`), then return statistics (min/max/mean/std, drift rate) and the updates.

ParameterTypeDescription
name *stringPV name, e.g. 'BL7:MTR1.RBV'
duration_snumberHow long to collect updates
max_pointsintegerUpdates to include in the reply (evenly thinned)
max_updatesintegerStop after this many updates

put_pv Put Pv

Write a PV. This can move motors, open shutters, change magnet or high-voltage setpoints and heat or cool samples: tell the user exactly what will change first. The write is refused unless the PV matches the put allow-list, the IOC grants write access, and the value has the right type and lies within the PV's control limits (DRVL/DRVH). Returns the read-back value.

ParameterTypeDescription
name *stringPV name, e.g. 'BL7:MTR1.RBV'
value *New value: number, enum state name or index, string, or array for waveforms
timeout_snumberMax seconds to wait for completion
waitbooleanWait for the IOC's put-completion (put-callback)

put_pvs Put Pvs

Write several PVs in order (e.g. set both slit blades). Every write is validated first (allow- list, access rights, type, control limits); if any is invalid nothing is written. Writing stops at the first failure and the rest are reported as not written. The whole batch must finish within an hour: writes that would start later are not sent.

ParameterTypeDescription
writes *arrayPV writes, applied in order
timeout_snumberMax seconds to wait per write
waitbooleanWait for each put-completion before the next write

apply_safe_state Apply Safe State

Emergency action: write the scientist-configured safe-state PVs (--option safe_state, e.g. motor STOP fields, shutter close, HV off), all of them even if one fails. Available in read-only mode. It does not replace the facility's own interlocks and stop buttons.