Skip to main content
Ask AI

Authentication

The CLI supports two independent auth paths. Interactive mode prefers your session; print mode prefers a personal access token (PAT).

HowSurface
Session (full parity)testrelic login — email/password via the encrypted challenge flow. Cookies persist in ~/.testrelic/cookies.json and auto-refresh./api/v1/ai/* — interactive confirmations, repo memory writes.
PATtestrelic login --token tr_mcp_… (or TESTRELIC_MCP_TOKEN, or ~/.testrelic/token)./api/v1/mcp/ai/* — confirmations auto-approve, uncapped tool results.

The PAT uses the same convention as @testrelic/mcp. Create a token at platform.testrelic.ai/settings/mcp-tokens.

Session login

testrelic login                 # prompts for email + password
  • Force the session path even in print mode with --session.
  • For non-interactive session login, set TESTRELIC_PASSWORD in the environment.

Token login

testrelic login --token tr_mcp_xxxxxxxx
# or, via environment:
export TESTRELIC_MCP_TOKEN=tr_mcp_xxxxxxxx
# or place the token in ~/.testrelic/token

Pointing at a different backend

The CLI defaults to production. Point it elsewhere for staging or self-hosted setups:

testrelic config set baseUrl https://stage.testrelic.ai/api/v1
# or per-invocation:
testrelic --base-url https://stage.testrelic.ai/api/v1
# or via environment:
export TESTRELIC_CLOUD_URL=https://stage.testrelic.ai/api/v1

Diagnostics

testrelic doctor      # checks auth, MCP servers, and terminal capabilities

Next steps

Quickstart · Configuration

Was this page helpful?
Last updated on by Srivishnu Ayyagari