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

# sunpeak inspect

> Inspect any MCP server in the inspector.

## Overview

The `sunpeak inspect` command connects to any MCP server and launches the inspector — no sunpeak project required. Use it to test and debug MCP servers built with any language or framework.

```bash theme={null}
sunpeak inspect --server <url-or-command>
```

## Options

| Option | Short | Description |
| - | - | - |
| `--server <url\|cmd>` | `-s` | MCP server URL (HTTP/SSE) or stdio command (required) |
| `--simulations <dir>` | | Directory of simulation JSON fixtures (optional) |
| `--port <number>` | `-p` | Inspector port (default: 3000) |
| `--name <string>` | | App name displayed in inspector chrome |
| `--env <KEY=VALUE>` | | Environment variable for stdio servers (repeatable) |
| `--cwd <path>` | | Working directory for stdio servers |
| `--header <Name: value>` | `-H` | HTTP header for HTTP MCP servers (repeatable) |

## Examples

```bash theme={null}
# Connect to an HTTP MCP server
sunpeak inspect --server http://localhost:8000/mcp

# Pass an Authorization header to an HTTP MCP server
sunpeak inspect --server http://localhost:8000/mcp -H "Authorization: Bearer $TOKEN"

# Connect to a stdio MCP server
sunpeak inspect --server "python my_server.py"

# Pass env vars and a working directory to a stdio server
sunpeak inspect --server "python server.py" --env API_KEY=sk-123 --cwd ./backend

# With simulation fixtures for mock data
sunpeak inspect --server http://localhost:8000/mcp --simulations tests/simulations
```

## How It Works

1. Connects to the MCP server via HTTP/SSE or stdio transport
2. Discovers tools and resources via MCP protocol (`tools/list`, `resources/list`)
3. Builds simulations from discovered tools, optionally merging JSON fixtures from `--simulations`
4. Launches the multi-host inspector UI (Vite dev server)
5. Proxies tool calls and resource reads through to the connected server

## Transport Support

* **HTTP/SSE**: URLs starting with `http://` or `https://` connect via Streamable HTTP transport
* **Stdio**: Any other string is parsed as a shell command and connects via stdio transport (e.g., `"python my_server.py"`, `"node server.js"`)

For HTTP servers, redirects may change the path on the same origin or upgrade that host from HTTP
to HTTPS. If the endpoint redirects to another origin, pass the destination URL to `--server`
directly so authorization headers are never forwarded through an unexpected redirect.

## Authentication

sunpeak auto-negotiates MCP OAuth when the server returns 401 Unauthorized and publishes standard MCP OAuth metadata. If you already have a token, pass it as an HTTP header:

```bash theme={null}
sunpeak inspect --server http://localhost:8000/mcp -H "Authorization: Bearer $TOKEN"
```

You can repeat `--header` for other HTTP auth schemes or tenant headers.

## Combining with Simulations

Use `--simulations` to overlay mock data on discovered tools. This lets you test specific states without modifying your server:

```bash theme={null}
sunpeak inspect --server http://localhost:8000/mcp --simulations ./fixtures
```

Simulation JSON files in the directory are matched to tools by filename. See [Simulation API Reference](/docs/testing/simulations) for the JSON schema.

## Related Commands

<CardGroup cols={2}>
  <Card horizontal title="sunpeak dev" icon="code" href="/docs/app-framework/cli/dev">
    Full dev server with built-in inspector for sunpeak projects.
  </Card>

  <Card horizontal title="Inspector" icon="desktop" href="/docs/mcp-apps-inspector">
    Inspector concepts and features.
  </Card>
</CardGroup>


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