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

# OpenCode

> Connect OpenCode to Mobilerun phones through the Model Context Protocol.

OpenCode is an open-source coding agent. Connect Mobilerun so its agent can inspect a phone and run mobile tasks.

## Setup

1. [Set up a phone](https://docs.mobilerun.ai/devices.md) and install OpenCode.

2. Register the remote MCP server from your project directory using OpenCode v2:

   ```bash theme={null}
   opencode mcp add mobilerun --url https://cloud.mobilerun.ai/api/mcp
   ```

   Alternatively, merge this into `opencode.json`:

   ```json opencode.json theme={null}
   {
     "mcp": {
       "servers": {
         "mobilerun": {
           "type": "remote",
           "url": "https://cloud.mobilerun.ai/api/mcp"
         }
       }
     }
   }
   ```

3. Run `opencode mcp auth mobilerun` and complete sign-in. Configuration differs in older versions.

Alternatively, use the [mobile-harness skill](https://docs.mobilerun.ai/skills/mobile-harness.md) for Python-based device control.

## First task

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

Review tool permissions before approving actions. See [MCP Server](https://docs.mobilerun.ai/mcp-server.md) for available tools and authentication.

See the [OpenCode v2 MCP documentation](https://dev.opencode.ai/v2/docs/mcp-servers).


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