armguard-mcp

v0.1.1
io.github.Lynn-hh/armguard-mcp Checked 4 days ago Published 1 month ago

Safety-first MCP server for ROS 2 robot arms: server-side safety envelope, human approval, audit

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

get_robot_state

Current joint positions [rad], TCP pose [m, quaternion xyzw] in the robot base frame, estimated external wrench [N, N*m], gripper state and safety status. Read-only.

get_safety_envelope

The limits the server enforces (joint limits, workspace box, keep-out zones, speed/step caps, force thresholds, gripper limits, approval mode). Read this before planning and stay inside it: violations are rejected server-side and cannot be overridden.

lookup_transform

Pose of source_frame expressed in target_frame (tf2 semantics), e.g. target_frame='fr3_link0', source_frame='fr3_hand_tcp'. Position in metres, orientation as a quaternion (x, y, z, w).

ParameterTypeDescription
source_frame *string
target_frame *string

list_controllers

ros2_control controllers with their type and state, plus which ones the policy lets you switch.

list_ros_graph

ROS 2 nodes, topics, services and actions visible to the server. Read-only; you cannot publish or call arbitrary services through this server.

get_audit_tail

The last n audit-log events (tool calls, approvals, denials, e-stops). Images are redacted.

ParameterTypeDescription
ninteger

camera_snapshot

Grab the latest image from an allowlisted camera topic (see get_safety_envelope.camera_topics). Returns the image plus JSON metadata (width, height, stamp). Images wider than the policy's max_image_width are downscaled (or refused if Pillow is not installed).

ParameterTypeDescription
topic *string

plan_to_joints

Plan (do NOT move) a joint-space motion from the current state to joint_positions [rad]. Returns a plan summary validated against the safety envelope; if status is not 'rejected', pass plan_id to execute_plan. Scaling above the policy cap is clamped.

ParameterTypeDescription
joint_positions *arrayTarget joint positions [rad], one per joint in the order ['fr3_joint1', 'fr3_joint2', 'fr3_joint3', 'fr3_joint4', 'fr3_joint5', 'fr3_joint6', 'fr3_joint7']
acceleration_scalingFraction of max joint accel (0, 1]
velocity_scalingFraction of max joint speed (0, 1]

plan_to_pose

Plan (do NOT move) a motion that brings the TCP to a pose. Uses inverse kinematics; the path is a joint-space interpolation (the TCP does not move in a straight line - use plan_cartesian_path for that). Returns a plan summary validated against the safety envelope.

ParameterTypeDescription
position *Target TCP position [m]
acceleration_scalingFraction of max joint accel (0, 1]
frame_idFrame of the target; default = robot base frame
orientationTarget TCP orientation (x, y, z, w); omit to keep current
velocity_scalingFraction of max joint speed (0, 1]

plan_cartesian_path

Plan (do NOT move) a straight-line TCP path through the waypoints [m]. Total TCP path length is capped by the policy (max_cartesian_step_m). Returns a plan summary validated against the envelope.

ParameterTypeDescription
waypoints *arrayTCP waypoints, in order
acceleration_scalingFraction of max joint accel (0, 1]
frame_idFrame of the waypoints; default = base frame
velocity_scalingFraction of max joint speed (0, 1]

execute_plan

EXECUTE a previously planned motion on the robot. The server re-validates the plan against the safety envelope, rejects stale/expired/used plans, may ask a human to approve (depending on policy), monitors contact force while moving (aborting and latching an e-stop above the limit), and streams progress. Plan handles are single-use and one plan executes at a time. Refused if the robot provides no force estimate (unless the policy allows it). Cancelling the call stops the robot. In dry-run mode nothing moves.

ParameterTypeDescription
plan_id *stringplan_id returned by a plan_* tool

get_motion_status

Whether a plan is executing, its progress (0..1) and the result of the last execution.

gripper_move

Move the gripper fingers to an opening width [m] without applying grasp force.

ParameterTypeDescription
width_m *numberTarget finger opening [m], within the policy range
speed_mpsFinger speed [m/s]; default = policy max

gripper_grasp

Close the gripper on an object of about width_m [m] with force_n [N]. Succeeds (ok=true) only if the fingers stop within [width - epsilon_inner, width + epsilon_outer]. Forces above the policy maximum are rejected, not clamped.

ParameterTypeDescription
force_n *numberGrasp force [N]; must not exceed the policy maximum
width_m *numberExpected object width [m]
epsilon_inner_mnumberTolerance [m]: the grasp succeeds down to width_m - epsilon_inner_m
epsilon_outer_mnumberTolerance [m]: the grasp succeeds up to width_m + epsilon_outer_m
speed_mpsFinger speed [m/s]; default = policy max

gripper_home

Home (fully open and calibrate) the gripper.

switch_controllers

Activate/deactivate ros2_control controllers. Only controllers in the policy allowlist may be switched; a human may need to approve.

ParameterTypeDescription
activatearrayControllers to activate (must be allowlisted)
deactivatearrayControllers to deactivate (must be allowlisted)

set_collision_thresholds

Set the robot's collision (reflex) thresholds. Values above the policy maxima are rejected.

ParameterTypeDescription
force_n *numberCollision force threshold [N]; <= policy max_contact_force_n
torque_nm *numberCollision torque threshold [N*m]; <= policy max_contact_torque_nm

stop_motion

Stop the current motion immediately: the arm trajectory and any gripper action. Always available, never rate limited, never needs approval. Does not latch; use estop to also block further motion.

estop

SOFTWARE E-STOP: stop all motion (arm and gripper), invalidate every plan and refuse motion/gripper/control tools until a human approves reset_estop. Always available, never rate limited, never needs approval, accepts any reason. This is not a substitute for the hardware e-stop.

ParameterTypeDescription
reasonOptional short reason, shown to the human who resets the e-stop

reset_estop

Release the software e-stop (and any latched force violation). ALWAYS requires human approval via the MCP client, regardless of the approval mode. An approval only releases the e-stop event it was shown for; if another e-stop is latched while the prompt is open, call reset_estop again.

error_recovery

Clear the robot's error/reflex state (e.g. after a collision reflex). May require human approval. Refused while the software e-stop is active (reset it first).

get_safety_status

E-stop state, latched force violation, dry-run flag and the last envelope violation. Never rate limited.