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

# Claude Agent SDK

> Use Mobilerun phones with the Claude Agent SDK through MCP.

The Claude Agent SDK builds agents with Claude. Connect the Mobilerun MCP server to give an agent phone tools.

## Setup

1. [Set up a phone](https://docs.mobilerun.ai/devices.md), install the Claude Agent SDK, and create a Mobilerun [API key](https://docs.mobilerun.ai/api-keys.md).

   ```bash TypeScript theme={null}
   npm install @anthropic-ai/claude-agent-sdk
   ```

   ```bash Python theme={null}
   pip install claude-agent-sdk
   ```

2. Add the Mobilerun server to your SDK options:

```typescript TypeScript theme={null}
const options = {
  mcpServers: {
    mobilerun: {
      type: 'http' as const,
      url: 'https://cloud.mobilerun.ai/api/mcp',
      headers: { Authorization: `Bearer ${process.env.MOBILERUN_API_KEY}` },
    },
  },
  allowedTools: ['mcp__mobilerun__*'],
};
```

```python Python theme={null}
import os
from claude_agent_sdk import ClaudeAgentOptions

options = ClaudeAgentOptions(
    mcp_servers={"mobilerun": {
        "type": "http",
        "url": "https://cloud.mobilerun.ai/api/mcp",
        "headers": {"Authorization": f"Bearer {os.environ['MOBILERUN_API_KEY']}"},
    }},
    allowed_tools=["mcp__mobilerun__*"],
)
```

3. Set `MOBILERUN_API_KEY` and your model credentials in the process environment. Pass these options to your SDK query and handle permissions according to your application. Do not expose the key in client-side code.

## First task

> List my Mobilerun devices and take a screenshot of the ready device.

See [MCP Server](https://docs.mobilerun.ai/mcp-server.md) for tool availability and access controls.

See the [Claude Agent SDK MCP documentation](https://platform.claude.com/docs/en/agent-sdk/mcp).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.