Skip to main content
Session files capture complete MCP request/response sequences for evidence, debugging, and replay.

Session file format

A session file is a JSON document containing a ProxySession with ordered ProxyMessage entries:
{
  "id": "session-uuid",
  "started_at": "2026-03-04T10:00:00+00:00",
  "ended_at": null,
  "transport": "stdio",
  "server_command": "python my_server.py",
  "server_url": null,
  "messages": [
    {
      "proxy_id": "msg-uuid",
      "sequence": 0,
      "timestamp": "2026-03-04T10:00:01+00:00",
      "direction": "client_to_server",
      "transport": "stdio",
      "jsonrpc_id": 1,
      "method": "initialize",
      "correlated_id": null,
      "modified": false,
      "payload": { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {} }
    }
  ],
  "metadata": {}
}

Message fields

FieldDescription
proxy_idUnique proxy-assigned UUID for this message
sequenceMonotonic sequence number within the session
timestampWhen the proxy received the message
directionclient_to_server or server_to_client
transportTransport type (stdio, sse, or streamable_http)
jsonrpc_idJSON-RPC id field (null for notifications)
methodJSON-RPC method (null for responses)
correlated_idProxy ID of the request this response correlates to
modifiedtrue if user modified the message before forwarding
payloadThe raw JSON-RPC message content
original_payloadPre-modification snapshot (present only when modified is true)

Saving sessions

Use --session-file on proxy start to auto-save the session:
qai proxy start \
  --transport stdio \
  --target-command "python my_server.py" \
  --session-file session.json
You can also press s in the TUI to save the session at any time.

proxy export

Export a saved session to a new JSON file:
qai proxy export [OPTIONS]
OptionRequiredDescription
--session-fileYesPath to a saved session file
--outputYesOutput file path
--output-formatNoExport format (default: json)
qai proxy export \
  --session-file session.json \
  --output report.json

proxy inspect

Print session contents to stdout for quick review:
qai proxy inspect [OPTIONS]
OptionRequiredDescription
--session-fileYesPath to a saved session file
--verbose / -vNoShow full JSON payloads
qai proxy inspect --session-file session.json
Output shows session metadata followed by each message with direction, method, JSON-RPC id, and correlation:
Session: abc-123
Transport: stdio
Server command: python my_server.py
Messages: 12
---
  #000 > initialize id=1
  #001 < (response) id=1 corr=abc...
  #002 > notifications/initialized
  #003 > tools/call id=2
Add -v to include full JSON payloads for each message:
qai proxy inspect --session-file session.json -v

Evidence use

Session files capture the complete request/response sequence for:
  • Finding reproduction — replay the exact message sequence that triggered a vulnerability
  • Bug reports — attach the session file showing the failing interaction
  • Audit evidence — provide the full traffic capture alongside scan results
Use proxy inspect for a quick human-readable summary. Use proxy export when you need a clean JSON file for tooling or sharing.