MCP and DexSim session API#

See MCP to connect a client and EmbodiChain MCP for the tool request and response.

Server lifecycle#

create_server(session, *[, catalog])

Register read-only tools and optional discovery on a caller-owned session.

serve(session_id, *[, directory, catalog])

Run the stdio server and release any borrowed connection on exit.

embodichain.mcp.server.create_server(session, *, catalog=False)[source]#

Register read-only tools and optional discovery on a caller-owned session.

Parameters:
  • session (Session | None) – Borrowed DexSim session, or None for a standalone catalog.

  • catalog (bool) – Include service discovery, catalog tools and resources.

Return type:

MCPServer

Returns:

The configured MCP server.

embodichain.mcp.server.serve(session_id, *, directory=None, catalog=False)[source]#

Run the stdio server and release any borrowed connection on exit.

Parameters:
  • session_id (str | None) – Existing DexSim Session ID, or None for offline discovery.

  • directory (str | None) – Optional directory containing the selected session record.

  • catalog (bool) – Include service discovery, catalog tools and resources.

Return type:

None

The command-line adapter is embodichain.cli.mcp.main().

embodichain.cli.mcp.main(argv=None)[source]#

Start the local EmbodiChain MCP server.

Return type:

None

Host measurements#

A control-part observation contains aligned joint names, measured positions, measured velocities, and position units. A DexSim Session result adds object identity, topology-specific DOF indices, and the available clock to those same fields.

class embodichain.lab.observations.joints.ControlPartJointState[source]#

Measured scalar positions and velocities aligned with joint_names.

All lists have one entry per selected joint, in configured order. Units describe position (rad or m); velocity uses the same unit per second.

Methods:

__init__(*args, **kwargs)

__new__(**kwargs)

__init__(*args, **kwargs)#
__new__(**kwargs)#
class embodichain.lab.observations.joints.SessionJointState[source]#

A control-part measurement with the native object, layout and clock.

Each DOF index belongs to this scene topology. Clock fields are null when the backend does not expose a physical clock.

Methods:

__init__(*args, **kwargs)

__new__(**kwargs)

__init__(*args, **kwargs)#
__new__(**kwargs)#

read_robot_state(context, *, object_ref, ...)

Read measured scalar joint positions and velocities on the existing World's owner thread.

run(context, *, object_ref, robot_cfg, ...)

DexSim Session.invoke entry point for a registered robot ID and variant.

embodichain.lab.sim.dexsim_session.robot_state.read_robot_state(context, *, object_ref, robot_cfg, control_part)[source]#

Read measured scalar joint positions and velocities on the existing World’s owner thread.

Parameters:
  • context (SessionContext) – Borrowed DexSim host context supplied by Session.invoke.

  • object_ref (str) – Path of the articulation in the finalized scene.

  • robot_cfg (RobotCfg) – Resolved configuration declaring the required control parts.

  • control_part (str) – Configured group whose selectors specify output order.

Return type:

SessionJointState

Returns:

Current joint positions, velocities and their public DOF indices. Clock fields are null on backends without a public simulation clock.

embodichain.lab.sim.dexsim_session.robot_state.run(context, *, object_ref, robot_cfg, control_part, variant=None)[source]#

DexSim Session.invoke entry point for a registered robot ID and variant.

Return type:

SessionJointState

The package-level aliases embodichain.lab.sim.dexsim_session.read_robot_state() and embodichain.lab.sim.dexsim_session.run() preserve the original Python and Runtime invocation paths.

read_robot_state(context, *, object_ref, ...)

Read measured scalar joint positions and velocities on the existing World's owner thread.

run(context, *, object_ref, robot_cfg, ...)

DexSim Session.invoke entry point for a registered robot ID and variant.