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

# CLI Usage

> Run the MCP Inspector from the command line

The MCP Inspector can be run directly from the command line using `npx`, making it easy to quickly inspect and debug MCP servers without installing anything globally.

## Quick Start

Run the inspector with a single command:

```bash theme={null}
npx @mcp-use/inspector
```

This will:

* Start the inspector server on an available port (default: 8080)
* Automatically open your browser to the inspector interface
* Display the URL in the terminal

## Command Options

### `--url <url>`

Auto-connect to an MCP server when the inspector starts.

```bash theme={null}
npx @mcp-use/inspector --url http://localhost:3000/mcp
```

### `--port <port>`

Specify the starting port number. The inspector will find the next available port if the specified port is already in use.

```bash theme={null}
npx @mcp-use/inspector --port 9000
```

**Default:** `8080`

**Port Range:** Must be between 1 and 65535

### `--no-open`

Prevent the inspector from automatically opening a browser tab when it starts. Useful in CI/CD pipelines, headless environments, or when you prefer to open the URL manually.

```bash theme={null}
npx @mcp-use/inspector --no-open
```

You can combine it with other flags:

```bash theme={null}
npx @mcp-use/inspector --url http://localhost:3000/mcp --port 9000 --no-open
```

### `--help, -h`

Display help information and available options.

```bash theme={null}
npx @mcp-use/inspector --help
```

## Environment Variables

### `MCP_INSPECTOR_FRAME_ANCESTORS`

Configure which origins can embed the inspector widget in iframes. This is useful when embedding the inspector into your own application or when testing widgets from different domains.

**Default behavior:**

* **Development mode**: `*` (allows all origins for easier development)
* **Production mode**: `'self'` (same-origin only for security)

**Format:** Space-separated list of origins or `*` for all origins

**Examples:**

```bash theme={null}
# Allow embedding from specific domains
MCP_INSPECTOR_FRAME_ANCESTORS="https://app.example.com https://dev.example.com" npx @mcp-use/inspector

# Allow embedding from any domain (useful for development)
MCP_INSPECTOR_FRAME_ANCESTORS="*" npx @mcp-use/inspector

# Multiple origins with wildcards
MCP_INSPECTOR_FRAME_ANCESTORS="https://*.example.com http://localhost:*" npx @mcp-use/inspector
```

<Note>
  In production deployments, it's recommended to explicitly list allowed origins rather than using `*` to prevent unauthorized embedding.
</Note>

<Tip>
  When running in development mode (`npm run dev`), the inspector automatically allows all origins by default, so you don't need to set this variable unless you want to test production CSP policies.
</Tip>

### `MCP_URL`

Set the external base URL for your MCP server. This is useful when running behind a reverse proxy (ngrok, E2B sandboxes, Cloudflare tunnels) where the public URL differs from `localhost`.

When set, the CLI will use this URL for widget asset URLs and Vite HMR WebSocket connections, ensuring everything works correctly through the proxy.

**Default behavior:**

* If not set, the CLI generates a `localhost` URL automatically
* If set, the CLI preserves your value and does not overwrite it

**Examples:**

```bash theme={null}
# ngrok tunnel
MCP_URL=https://abc123.ngrok.io npx @mcp-use/cli dev

# E2B sandbox
MCP_URL=https://3000-abc123.e2b.app npx @mcp-use/cli dev

# Cloudflare tunnel
MCP_URL=https://my-tunnel.trycloudflare.com npx @mcp-use/cli dev
```

<Tip>
  When using a reverse proxy, set `MCP_URL` to the public-facing URL. This ensures widget hot-reload (HMR) and asset loading work correctly through the proxy.
</Tip>

## Related Documentation

* [Getting Started](/inspector/index) - Overview of the inspector
* [Connection Settings](/inspector/connection-settings) - Advanced connection configuration
* [Mount the Inspector](/inspector/integration) - Serve the Inspector from an app
