Skip to main content

MCPClient

Inherits from: object MCP-compliant client for robot communication. Provides structured tool access and AI agent integration through the Model Context Protocol (MCP). Ideal for Claude/GPT integration and tool-based workflows.

init

MCPClient.__init__(robot_ip: str, port: int = 4774, enable_heartbeat: bool = True, heartbeat_interval: float = 2.0) -> None
Initialize MCP client.
Arguments
robot_ip (str)
str
required
IP address of the robot
port (int)
int
Port number (default 4774)
enable_heartbeat (bool)
bool
Enable automatic heartbeat monitoring for safety
heartbeat_interval (float)
float
Heartbeat interval in seconds (default 2.0)
Returns
returns
None
Raises
ImportError
If requests library is not installed
ConnectionError
If MCP session initialization fails

call_tool

MCPClient.call_tool(tool_name: str, arguments: Optional[Dict] = None) -> Any
Call an MCP tool with automatic retry for ‘get’ operations
Arguments
tool_name (str)
str
required
No description provided.
arguments (Optional[Dict])
Optional[Dict]
No description provided.
Returns
returns
Any

list_tools

MCPClient.list_tools() -> List[Dict[str, Any]]
List available MCP tools.
Returns
returns
List[Dict[str, Any]]

is_connected

MCPClient.is_connected() -> bool
Check if MCP client is connected.
Returns
bool
bool
True if client is initialized and connection is active

disconnect

MCPClient.disconnect() -> None
Disconnect MCP client and stop heartbeat monitoring. Stops the heartbeat monitoring thread and marks the client as disconnected.
Returns
returns
None