# How do I give Cursor, Codex or VS Code an Android phone?

One remote MCP server for all three: the exact Cursor mcp.json, Codex config.toml and VS Code mcp.json entries, with the key read from your environment.

Guides2 min read

In this article

Add the Mobilebox MCP server, https://mobilebox.dev/mcp, to the client’s MCP config with your API key in an `Authorization: Bearer` header read from the environment. After a restart the agent has the phone tools: create a phone, read its screen, tap, type, install apps, watch it live, park it.

Client documentation reviewed on November 8, 2026: [Cursor MCP](https://cursor.com/docs/context/mcp), [Codex MCP](https://learn.chatgpt.com/docs/extend/mcp?surface=cli) and [VS Code MCP configuration](https://code.visualstudio.com/docs/agents/reference/mcp-configuration). Claude Code has [its own guide](https://mobilebox.dev/blog/android-agent-mcp), and so do [Gemini CLI](https://mobilebox.dev/blog/gemini-cli-android-mcp), [Windsurf](https://mobilebox.dev/blog/windsurf-android-mcp), [Cline](https://mobilebox.dev/blog/cline-android-mcp) and [GitHub Copilot](https://mobilebox.dev/blog/github-copilot-android-mcp).

## The shortest way: let the agent do it

Paste this into the agent: "Set up Mobilebox for me: read https://mobilebox.dev/setup.md and follow it." It asks for your email, gets a key at once, stores it without printing it, and adds the server for the client it runs in; the 6-digit code from your inbox keeps the workspace.

## The key

Sign up at [mobilebox.dev/signup](https://mobilebox.dev/signup) and create a key in the dashboard, or let the agent get one through setup.md. Put it in your shell profile as `MOBILESANDBOX_API_KEY` and open a new terminal, so the client inherits it. Never paste the key into a chat or a committed file.

## Cursor

`~/.cursor/mcp.json` for every project, or `.cursor/mcp.json` in one repository:

```
{ "mcpServers": { "mobilebox": { "url": "https://mobilebox.dev/mcp", "headers": { "Authorization": "Bearer ${env:MOBILESANDBOX_API_KEY}" } } } }
```

Cursor also signs in to MCP servers over OAuth: add the entry with the url alone and it opens a browser where you sign in and click Allow.

## Codex

`~/.codex/config.toml`:

```
[mcp_servers.mobilebox]
url = "https://mobilebox.dev/mcp"
bearer_token_env_var = "MOBILESANDBOX_API_KEY"
```

Codex sends the variable’s value as the bearer token. The CLI and the IDE extension read the same file.

## VS Code

`.vscode/mcp.json` in the workspace, or `MCP: Open User Configuration` for all of them. VS Code’s format uses `servers` and a `type`:

```
{ "servers": { "mobilebox": { "type": "http", "url": "https://mobilebox.dev/mcp", "headers": { "Authorization": "Bearer ${env:MOBILESANDBOX_API_KEY}" } } } }
```

Copilot’s agent mode then lists the Mobilebox tools; the [GitHub Copilot guide](https://mobilebox.dev/blog/github-copilot-android-mcp) has the one-click install and the newer `~/.copilot/mcp-config.json` file. To be asked for the key instead, use `${input:mobilebox-key}` and an `inputs` entry with `"password": true`.

## Check it

Ask the agent: "Create a Mobilebox phone, open Settings and tell me the Android version, then park the phone." It calls `create_phone`, `observe` and `act`, and `watch_phone` gives you a link to watch it live. The [agent guide](https://mobilebox.dev/docs/agents) covers the observe, act, verify loop.

## Try it in your agent in 60 seconds

Paste this into Claude Code, Cursor, Codex or any agent that can read a web page. It asks for your email, gets its own key at once and adds the phone tools; the 6-digit code from your inbox keeps the workspace.

```
Set up Mobilebox for me: read https://mobilebox.dev/setup.md?via=android-mcp-cursor-codex-vscode and follow it.
```

[What your agent reads](https://mobilebox.dev/setup.md?via=android-mcp-cursor-codex-vscode)

In this article

[All articles](https://mobilebox.dev/blog)

## Next questions

- [Does my agent stay logged in between runs?](https://mobilebox.dev/blog/park-resume-android?via=next-logins)

- [Can I watch my agent work live?](https://mobilebox.dev/live-view?via=next-live)

- [What does it cost for a team?](https://mobilebox.dev/blog/mobilebox-pricing-for-teams?via=next-team)

- [How fast do cloud phones start, measured?](https://mobilebox.dev/benchmarks?via=next-benchmarks)

- [Is there a Python package?](https://mobilebox.dev/blog/android-phone-for-python-ai-agent?via=next-python)

- [Mobilebox or Firebase Test Lab?](https://mobilebox.dev/blog/mobilebox-vs-firebase-test-lab?via=next-firebase)

- [Mobilebox or BrowserStack?](https://mobilebox.dev/blog/mobilebox-vs-browserstack?via=next-browserstack)

- [Cloud phone or a local emulator?](https://mobilebox.dev/blog/mobilebox-vs-local-emulator?via=next-emulator)
