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

# DevTools

> Call tools and render views locally, without a host

![DevTools](https://docs.skybridge.tech/images/devtools.webp)

Testing through a real host means exposing a public URL, registering a connector, starting a conversation, and prompting the model until it calls the right [tool](https://docs.skybridge.tech/build/tools.md). DevTools cuts that loop down to a file save: it runs locally, emulates the host runtime, and lets you call tools directly, no model or host involved.

## Start the Emulator

DevTools ships with the dev server. In a [scaffolded](https://docs.skybridge.tech/get-started/quickstart.md#scaffold-your-project) project, start it from the project root:

```bash npm theme={null}
npm run dev
```

```bash pnpm theme={null}
pnpm dev
```

```bash yarn theme={null}
yarn dev
```

```bash bun theme={null}
bun dev
```

```bash deno theme={null}
deno task dev
```

Two routes come up:

* `http://localhost:3000/mcp`: your MCP server
* `http://localhost:3000/`: the DevTools

Every [tool](https://docs.skybridge.tech/build/tools.md) registered on the server appears in the sidebar automatically, and edits to the server or the [views](https://docs.skybridge.tech/build/view.md) reload the preview on save.

## Explore the Features

Select a tool in the sidebar and DevTools gives you the full exchange:

![DevTools Illustration](https://mintcdn.com/skybridge-alpic/RtZa8OS665SGx8s1/images/devtools-screenshot.png?fit=max\&auto=format\&n=RtZa8OS665SGx8s1\&q=85\&s=49dcfe6f0787c47c298a460d31497220)

The DevTools interface

* **Tool controls**: generated from the tool's [input schema](https://docs.skybridge.tech/api-reference/register-tool.md#inputschema-outputschema). Inputs can be saved and re-run from the tool header.
* **Tool output**: the raw server [response](https://docs.skybridge.tech/api-reference/register-tool.md#return) (`content`, `structuredContent`, `_meta`), with status, latency, and payload size.
* **State inspector**: the view [state](https://docs.skybridge.tech/build/state.md) as a JSON tree, updated as the view mutates it.
* **View preview**: the rendered [View](https://docs.skybridge.tech/build/view.md), with live controls to switch theme, locale, and device type; the preview updates immediately. The [display mode](https://docs.skybridge.tech/api-reference/use-display-mode.md#displaymode) is shown as a badge rather than a control, because only the view changes it, through [`setDisplayMode`](https://docs.skybridge.tech/api-reference/use-display-mode#setdisplaymode).
* **Context warnings**: a badge on the tool output and the view state when either grows large enough to crowd the model's context, at 5,000 estimated tokens for tool output and 20,000 for view state. The same warning prints in the browser and dev server consoles. Nothing is blocked or truncated, and the full payload stays inspectable.
* **Call logs**: every runtime API call the view makes (`setViewState`, `callTool`, `requestDisplayMode`) with its arguments and responses.

## Preview in a Host Conversation

The panel tells you whether a view works. It does not tell you how the view looks once a host puts it in a conversation, next to a sidebar and under a thread of messages, which is where most layout surprises come from.

Click **preview** in the toolbar and the panel becomes a mock conversation with your real view inside it. Everything around the view is a skeleton: sidebar, message thread, and a composer that does nothing.

![DevTools Preview Illustration](https://mintcdn.com/skybridge-alpic/U1A9GlMPGIpaOM5o/images/devtools-preview-screenshot.png?fit=max\&auto=format\&n=U1A9GlMPGIpaOM5o\&q=85\&s=95a26869c13035af2afa6bd52512fb81)

A view previewed in the ChatGPT conversation shell

* **Switch client** between ChatGPT and Claude. Each shell is measured against the real app, in light and dark, and the mode resets to inline when you switch.
* **Toggle device** to render the shell inside a 390 x 844 phone frame, with the mobile layout that client uses.
* **Display modes** follow what the selected client supports. Inline and fullscreen work everywhere, pip only on ChatGPT desktop, where it renders as a floating card. A `pip` request becomes fullscreen on ChatGPT mobile, and Claude keeps the current mode.- **Quit preview** returns to the panel with your tool state intact.

While preview is active, the `ui/initialize` handshake carries that client's own style variables, container dimensions, and available display modes, so a view that reads the host's [theme tokens](https://docs.skybridge.tech/api-reference/use-mcp-app-context.md) themes itself the way it will in production.

The preview client is not persisted: reloading DevTools brings you back to the panel.

## Drive DevTools from a Coding Agent

DevTools exposes its actions as [WebMCP](https://github.com/webmachinelearning/webmcp) tools, so a coding agent that drives your browser runs them directly. The agent connects through [chrome-devtools-mcp](https://github.com/ChromeDevTools/chrome-devtools-mcp), an MCP server that discovers and calls a page's WebMCP tools. On the DevTools page it can:

* **Run any registered tool** and render its view in the preview.
* **Read the rendered view** by screenshotting the preview, then drive it as a real page.
* **Switch the preview controls**: theme, locale, and device. The display mode is not among them, since the view owns it.

### Set It Up

**1. Add chrome-devtools-mcp to your agent**

Register the MCP server with the WebMCP flag, forwarding the browser feature flag to the Chrome it launches.

> [tab] Claude Code
>
> ```bash theme={null}
> claude mcp add chrome-devtools --scope user -- \
>   npx chrome-devtools-mcp@latest \
>   --categoryExperimentalWebmcp=true \
>   --chrome-arg=--enable-features=WebMCP,DevToolsWebMCPSupport
> ```

> [tab] Codex
>
> ```bash theme={null}
> codex mcp add chrome-devtools -- \
>   npx chrome-devtools-mcp@latest \
>   --categoryExperimentalWebmcp=true \
>   --chrome-arg=--enable-features=WebMCP,DevToolsWebMCPSupport
> ```

> [tab] Cursor
>
> [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=chrome-devtools\&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImNocm9tZS1kZXZ0b29scy1tY3BAbGF0ZXN0IiwiLS1jYXRlZ29yeUV4cGVyaW1lbnRhbFdlYm1jcD10cnVlIiwiLS1jaHJvbWUtYXJnPS0tZW5hYmxlLWZlYXR1cmVzPVdlYk1DUCxEZXZUb29sc1dlYk1DUFN1cHBvcnQiXX0=)

> [tab] Others
>
> See the [client configuration guide](https://github.com/ChromeDevTools/chrome-devtools-mcp#mcp-client-configuration), or add this to your MCP config:
>
> ```json mcp.json theme={null}
> {
>   "mcpServers": {
>     "chrome-devtools": {
>       "command": "npx",
>       "args": [
>         "-y",
>         "chrome-devtools-mcp@latest",
>         "--categoryExperimentalWebmcp=true",
>         "--chrome-arg=--enable-features=WebMCP,DevToolsWebMCPSupport"
>       ]
>     }
>   }
> }
> ```

**2. Start DevTools**

Run `npm run dev` and open the DevTools URL printed in the terminal.

**3. Prompt your agent**

`Open my app in DevTools, run a tool, and check the view renders`

Open the app in DevTools with chrome-devtools-mcp, list its WebMCP tools, call one with sample input, and screenshot the preview to check the view renders.

Your agent now closes its own loop: it edits a view, runs the tool, reads the rendered result, and fixes what is wrong.

> [!NOTE]
>
> WebMCP is experimental and supported Chrome version 149 or newer.

## Authenticated Servers

When your server [requires OAuth](https://docs.skybridge.tech/build/auth.md), DevTools registers itself through Dynamic Client Registration on first connect and walks the full PKCE flow as a public client. A server that needs a pre-registered client or a different grant type won't connect from DevTools.

DevTools caches the authorization within the browser, so later sessions reconnect without prompting. To clear a cached registration, click **Sign out** in the header.

## Limitations

DevTools emulates, and three gaps separate the emulation from production:

* **No model**: you pick the [tool](https://docs.skybridge.tech/build/tools.md) and type the arguments yourself. Tool selection, the prompt surface (names, descriptions, schemas), and follow-up messages are never exercised.
* **Mocked runtimes**: DevTools mocks the [MCP Apps](https://docs.skybridge.tech/resources/chatgpt-and-mcp-apps.md#mcp-apps) runtime and also injects a `window.openai` shim for [ChatGPT](https://docs.skybridge.tech/resources/chatgpt-and-mcp-apps.md), so a `window.openai` call that works here can still be host-specific in production. Host behaviour outside those mocks is not reproduced, and the conversation around a preview is a skeleton, not a working client.
* **Loose [CSP](https://docs.skybridge.tech/guides/csp.md)**: external resources blocked by hosts in production may load locally.

> [!NOTE]
>
> To test your app against a real LLM, use the [playground](https://docs.skybridge.tech/test/playground.md) or connect your server to ChatGPT or Claude using the [tunnel](https://docs.skybridge.tech/test/tunnel.md).

## Go Further

> [card] [Tunnel](https://docs.skybridge.tech/test/tunnel.md)
>
> Expose your local server to real hosts

> [card] [Playground](https://docs.skybridge.tech/test/playground.md)
>
> Chat with a real model running your app

> [card] [Audit](https://docs.skybridge.tech/test/audit.md)
>
> Catch spec and platform issues before submission


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