TestRelic AI
Go to App
MCP

MCP authentication

Create a TestRelic MCP personal access token, store it with the login CLI or TESTRELIC_MCP_TOKEN, and align TESTRELIC_CLOUD_URL with your cloud API base when needed.

The MCP server needs one credential: a TestRelic MCP personal access token (values start with tr_mcp_). Integration settings for Jira, Amplitude, Grafana Loki, GitHub, TestMu AI, and BrowserStack are loaded from your organization in the TestRelic cloud after the MCP authenticates—you do not put those secrets in MCP config.

You create tr mcp token
Store locally or CLI
MCP server startup
TestRelic cloud validates token

Mock mode is the default

The zero-config / marketplace install runs in --mock-mode with no network calls and no token, so you can explore the tools first. Follow the steps below only when you want to connect real org data.

1. Create a token

  1. Sign in to the TestRelic web app (same place you use for dashboards), e.g. platform.testrelic.ai.
  2. Open Settings → MCP tokens at platform.testrelic.ai/settings/mcp-tokens (or your admin-provided equivalent).
  3. Create a token and copy the tr_mcp_… value once; store it in a password manager.

2. Store the token

Option A — CLI (writes a file)

Save token to the default file
npx -y @testrelic/mcp@3.0.0 login

Paste the token when prompted. This stores the token for the MCP process to read on startup.

Option B — Environment variable

Set TESTRELIC_MCP_TOKEN to your tr_mcp_… value in your shell profile, CI secrets, or your MCP client's env block in mcp.json. Do not commit token values to git.

3. Cloud API base URL

If your SDK already uses a custom API endpoint, point the MCP at the same API base (including /api/v1 if that is part of your URL):

  • Environment variable: TESTRELIC_CLOUD_URL
  • Or flag: --cloud-url on the CLI (see package docs)

If unsure, use the same hostname your reporter uses for uploads (see the Configuration and Appium configuration guides once the SDK section migrates).

4. Default repository (optional)

If your tools omit a project id, set a default:

  • TESTRELIC_DEFAULT_REPO_ID, or
  • --default-repo-id on the CLI

5. Enable cloud mode in the client

To connect real data: create the tr_mcp_* token (above), run npx @testrelic/mcp login (or set TESTRELIC_MCP_TOKEN=tr_mcp_…), then remove --mock-mode from your MCP server args. Keep mock mode until a token is configured if you want zero outbound calls.

6. Public host allow-list (self-hosted / hosted deployments only)

This applies if you run the MCP server (streamable HTTP) behind a proxy or CDN — not to clients connecting to mcp.testrelic.ai. The server's DNS-rebinding protection allow-lists the Host header using only its bind address (loopbacks + --host) by default. Behind a fronting proxy that forwards the public hostname (e.g. CloudFront → nginx with proxy_set_header Host $host), every real client request presents that public hostname, matches nothing, and gets rejected with 403 Invalid Host header.

List the public hostname(s) your proxy forwards so they're allowed alongside the bind address:

  • Environment variable: TESTRELIC_MCP_PUBLIC_HOSTS (comma-separated, e.g. mcp.testrelic.ai,mcp-stage.testrelic.ai)
  • Or flag: --public-hosts on the CLI

Hostnames are matched bare (a :443 proxy forwards no port) and on the server's own port; arbitrary hosts are still rejected. The server logs the resolved allow-list at startup so a misconfiguration is diagnosable from container logs.

Next steps

Capabilities · Testing workflow

Was this page helpful?

On this page