> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MCPClient

## 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**

```python theme={null}
MCPClient.__init__(robot_ip: str, port: int = 4774, enable_heartbeat: bool = True, heartbeat_interval: float = 2.0) -> None
```

Initialize MCP client.

<ResponseField name="Arguments">
  <ParamField query="robot_ip (str)" type="str" required>
    IP address of the robot
  </ParamField>

  <ParamField query="port (int)" type="int">
    Port number (default 4774)
  </ParamField>

  <ParamField query="enable_heartbeat (bool)" type="bool">
    Enable automatic heartbeat monitoring for safety
  </ParamField>

  <ParamField query="heartbeat_interval (float)" type="float">
    Heartbeat interval in seconds (default 2.0)
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="ImportError" type="">
    If requests library is not installed
  </ParamField>

  <ParamField query="ConnectionError" type="">
    If MCP session initialization fails
  </ParamField>
</ResponseField>

### call\_tool

```python theme={null}
MCPClient.call_tool(tool_name: str, arguments: Optional[Dict] = None) -> Any
```

Call an MCP tool with automatic retry for 'get' operations

<ResponseField name="Arguments">
  <ParamField query="tool_name (str)" type="str" required>
    *No description provided.*
  </ParamField>

  <ParamField query="arguments (Optional[Dict])" type="Optional[Dict]">
    *No description provided.*
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Any" />
</ResponseField>

### list\_tools

```python theme={null}
MCPClient.list_tools() -> List[Dict[str, Any]]
```

List available MCP tools.

<ResponseField name="Returns">
  <ResponseField name="returns" type="List[Dict[str, Any]]" />
</ResponseField>

### is\_connected

```python theme={null}
MCPClient.is_connected() -> bool
```

Check if MCP client is connected.

<ResponseField name="Returns">
  <ResponseField name="bool" type="bool">
    True if client is initialized and connection is active
  </ResponseField>
</ResponseField>

### disconnect

```python theme={null}
MCPClient.disconnect() -> None
```

Disconnect MCP client and stop heartbeat monitoring.

Stops the heartbeat monitoring thread and marks the client
as disconnected.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>
