# Getting started

Phantom is a local-first security research workstation. It brings an
intercepting proxy, a manual HTTP workspace (Repeater, Intruder, Comparer,
Decoder), signature scans, research notes, findings and reports into one
workspace organised around **vaults**: one vault per program or
engagement, with scope enforced by the backend for every interface. People
and AI agents work in the same context, because the web interface, the
REST API and the built-in MCP server share one service layer.

Everything runs on your machine and listens on `127.0.0.1` only. This page
gets Phantom running and connects your first agent. For the ideas behind
it, read [Concepts](./concepts.md).

> **Authorized testing only**
>
> Phantom is built for security professionals working on systems they own or
> are explicitly allowed to test. Respect program rules and scope, and
> practise responsible disclosure.

> **Alpha**
>
> Phantom is in active development. The pages of this site mark what is
> available, what is backend only and what is still in design; the
> [status page](./roadmap/status.md) lists it in one place.

## Requirements

| Tool | Version | Needed for |
|---|---|---|
| Docker with Compose | recent | the one-command setup |
| Python | 3.12 or newer | the backend and its tests |
| Node.js | 20.19+ or 22.12+ | the interface in local development |

## Run with Docker

From the repository root:

```bash
docker compose up --build
```

Open `http://127.0.0.1:3000`. The compose file starts PostgreSQL, the
backend and an nginx frontend. Only the interface and the intercepting
proxy are published, and only on the loopback interface. Ports and the
database password can be overridden in a `.env` file next to
`docker-compose.yml`.

## Run locally

Install the backend's dependencies:

```bash
pip install -r backend/requirements.txt
```

Then start everything:

```bash
python run.py
```

`run.py` applies database migrations, starts the API on port 8000 and the
interface on port 5173, installs frontend packages when needed, and stops
every child process when it exits. It works on Windows, macOS, Linux and
WSL. To change ports or start only one side:

```bash
python run.py --help
```

Local development uses SQLite in `backend/phantom.db` unless
`DATABASE_URL` says otherwise.

## First run

The first time the interface opens on a workstation that has never been
set up, it shows a short full-screen setup before anything else:

1. **Language**: English or Russian. The interface switches at once.
2. **Theme**: Dark, Light, or System, which follows your operating system.
3. **First vault**: the program's name, platform and target domain, with
   an optional program URL and scope rules. This step is required while
   the workstation has no vault.
4. **Connect an agent**: the MCP switch, then Claude Code, Codex or
   another MCP client, its permissions and expiry. The token is shown
   once, together with the steps for that client (for Claude Code the
   live channel commands of this machine, with a Windows or WSL choice
   when the backend runs in WSL). You can skip this step and do it later
   in **Settings → AI & Agents**.
5. **Done**: a summary, and **Open Phantom** takes you to the new vault.

Enter continues and Escape goes one step back. Language and theme are
preferences of this browser; the vault and the token are created on the
backend only when you press Create. A workstation that already holds
vaults counts as set up, so upgrading never shows this flow. To walk
through it again, open **Settings → Appearance → Run setup again**.

## Explore a sample

To look around before testing anything, choose **Explore a sample vault**
on the empty Vaults page, or **Create the sample lab vault** in the
command palette (Ctrl K). It builds a vault scoped to this machine's lab
names only (`lab.localhost`, `127.0.0.1`) with a target, three findings
of different severities, a note that links them and a report draft.
Start with its note, **Start here**. It is ordinary data marked as a
sample: delete the vault when you are done. Nothing is sent anywhere.

## Your first session

1. Open the interface and create a vault on the **Vaults** page (or keep
   the one from the first run). Write its
   scope rules: the hosts you are allowed to test, and the ones you are
   not ([Vaults and scope](./guides/vaults.md)).
2. Open **Proxy** and press **Start**. Download the CA from the proxy
   settings, trust it in a dedicated browser profile, and set that
   browser's proxy to `127.0.0.1:8080` ([Proxy](./guides/proxy/index.md)).
3. Browse the application. Requests appear in the history as they are
   captured, flagged in or out of scope.
4. Send interesting requests to [Repeater](./guides/repeater.md) or
   [Intruder](./guides/intruder.md), keep notes, and record
   [findings](./guides/findings.md) with their evidence.

## Connect an agent over MCP

The backend serves an MCP endpoint whose tools do what the interface does,
on the same live workstation: proxy, intercept, history, Repeater,
Intruder, scans, findings, notes, reports and vaults.

Every request needs a personal access token. In **Settings → AI &
Agents**, choose **Add connection** → **Bridge**, pick the client (Claude
Code is recommended), a grant preset and an expiry; the token reaches
every vault. The token is shown once. Then register the server
with your MCP client; for example, with Claude Code:

```bash
claude mcp add --transport http phantom http://127.0.0.1:8000/mcp --header "Authorization: Bearer phm_pat_…"
```

Replace `phm_pat_…` with your token. With Docker, use
`http://127.0.0.1:3000/api/v1/mcp` as the URL. For clients that can only
launch a command, `backend/mcp_server.py` is a stdio bridge to the same
endpoint. The [MCP server](./agents/mcp.md) page lists the tools and the
safety model; [Agent permissions](./agents/permissions.md) explains grants.

## Connect a model

Phantom can call a model itself. In **Settings → AI & Agents**, choose
**Add connection** → **Standard AI**: a cloud preset (OpenAI, Anthropic,
DeepSeek, Gemini, any OpenAI-compatible endpoint) with its API key, or a
model on your machine (Ollama at `http://127.0.0.1:11434/v1`, LM Studio
at `http://127.0.0.1:1234/v1`), where you allow the exact host and port.
Its models are listed as soon as the address and key are valid, and
the first one is preselected. The provider then appears in the Agent
picker; before a message that attaches captured traffic or files,
Phantom shows what it will receive.
It starts read only; anything beyond reading waits for your approval.
See [Model providers](./agents/model-providers.md).

## Run the tests

Backend, from `backend/`:

```bash
pip install -r requirements-dev.txt
```

```bash
python -m pytest
```

The tests use a fresh SQLite database each. To run them against
PostgreSQL, which the Docker Compose setup uses, set `PHANTOM_TEST_POSTGRES` to a
server URL whose role may create databases; every test then gets its own
database there:

```bash
PHANTOM_TEST_POSTGRES=postgresql+asyncpg://phantom:phantom@127.0.0.1:5432/postgres python -m pytest
```

Interface, from `frontend/`:

```bash
npm test
```

```bash
npm run type-check
```

Continuous integration runs the same commands, plus the migration round
trip, the documentation build and the GUI / REST / MCP parity check
(`python -m scripts.parity --check` from `backend/`).

## Where to go next

- [Concepts](./concepts.md): vaults, scope, research objects, evidence
  and how a session flows end to end.
- [Architecture](./architecture.md): how the backend, the proxy, realtime
  events and agents fit together.
- [Research notes](./guides/notes.md) and [Report Studio](./guides/reports.md).
- [Status](./roadmap/status.md): what is built and what is not.
