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

# CLI reference

> All Apie CLI commands and flags for TypeScript and Python.

The Apie CLI handles onboarding, diagnostics, capability management, guardrail templates, reports, and MCP proxy.

| Language   | Install                    | Invoke     |
| ---------- | -------------------------- | ---------- |
| TypeScript | `npm install -D @apie/cli` | `npx apie` |
| Python     | `pip install apie-sdk`     | `apie`     |

## init

Initialize Apie in your project. Creates config file and `.env.example`.

```bash theme={null}
npx apie init   # TypeScript
apie init       # Python
```

## send-test-event

Send a smoke test event and print session replay URL.

```bash theme={null}
npx apie send-test-event [--mode pipeline|single|proof]
apie send-test-event [--mode pipeline|single|proof]
```

| Flag     | Default    | Description                                                                        |
| -------- | ---------- | ---------------------------------------------------------------------------------- |
| `--mode` | `pipeline` | `pipeline` (full session), `single` (one tool call), or `proof` (activation proof) |

## doctor

Run connectivity and queue diagnostics.

```bash theme={null}
npx apie doctor [--send-test] [--mcp] [--mcp-config apie.mcp.json]
apie doctor [--send-test] [--mcp] [--mcp-config apie.mcp.json]
```

| Flag           | Description                                   |
| -------------- | --------------------------------------------- |
| `--send-test`  | Send a test event after checks                |
| `--mcp`        | Validate MCP proxy config                     |
| `--mcp-config` | Path to MCP config (default: `apie.mcp.json`) |

## capabilities declare

Declare capabilities from your config file.

```bash theme={null}
npx apie capabilities declare
apie capabilities declare
```

## guardrails enable

Enable a guardrail template by key.

```bash theme={null}
npx apie guardrails enable <key> [--mode monitor|enforce]
apie guardrails enable <key> [--mode monitor|enforce]
```

## report create

Generate a boundary report.

```bash theme={null}
npx apie report create [--last 24h|7d|30d] [--environment <env>] [--title <title>]
apie report create [--last 24h|7d|30d] [--environment <env>] [--title <title>]
```

| Flag            | Default | Description           |
| --------------- | ------- | --------------------- |
| `--last`        | `7d`    | Time window           |
| `--environment` | —       | Filter by environment |
| `--title`       | —       | Report title          |

## mcp proxy

Run the Apie MCP proxy in front of an upstream MCP server.

```bash theme={null}
npx apie mcp proxy [options]
apie mcp proxy [options]
```

| Flag                 | Default         | Description                       |
| -------------------- | --------------- | --------------------------------- |
| `--config`           | `apie.mcp.json` | MCP config file path              |
| `--server`           | —               | Server name (multi-server config) |
| `--transport`        | `stdio`         | `stdio` or `sse`                  |
| `--port`             | `3100`          | SSE listen port                   |
| `--mode`             | from config     | `monitor` or `enforce`            |
| `--approval-timeout` | from config     | e.g. `10m`                        |
| `--upstream-command` | from config     | Upstream MCP command              |
| `--upstream-arg`     | from config     | Upstream MCP arg (repeatable)     |
| `--run-id`           | —               | Apie run ID for emitted events    |

Python requires `pip install "apie-sdk[mcp-proxy]"` for the proxy command.

## Environment variables

```env theme={null}
APIE_API_KEY=apie_sk_test_...
APIE_BASE_URL=https://api.apie.sh
```
