Skip to main content

TestRelic MCP server: Model Context Protocol for AI-assisted test engineering

· 5 min read
TestRelic Team
TestRelic Maintainers

Coding assistants are only as good as the context they see. Pasting stack traces into chat scales poorly; re-fetching structured run history from your org is better. The TestRelic MCP server implements the Model Context Protocol so compatible hosts—Cursor, Claude Desktop, VS Code MCP clients, and others—can call tools that read your TestRelic cloud projects, runs, coverage signals, and related data. The MCP overview positions MCP alongside the SDK reporters: reporters write run data from CI and laptops; MCP reads and acts on that data inside the IDE loop.

Architecture at a glance

The overview’s sequence diagram summarizes the trust boundary: your MCP host exchanges JSON-RPC with the MCP server over stdio (or streamable HTTP for hosted mode); the server then calls TestRelic cloud APIs with your credential. Integration backends (Jira, Amplitude, Grafana Loki, GitHub, TestMu AI, BrowserStack) are not duplicated inside MCP config—they are resolved from your organization in the cloud after the server authenticates, as stated in the overview and Authentication pages.

Production connection paths

The MCP quickstart is the step-by-step source for:

ModeWhen teams choose it
Hosted MCP (https://mcp.testrelic.ai/mcp)Streamable HTTP MCP without a local binary; align with your client’s credential mechanism for remote servers.
npx + @testrelic/mcpstdio for any MCP host; pin a version (e.g. 3.0.0) for reproducible installs as shown in the quickstart.
Cursor marketplace pluginFastest path for Cursor users; plugin bundles mcp.json wiring—see the quickstart for the GitHub reference repo.

Sandbox vs production: mock mode and local clones are documented as evaluation-only. For live org data, remove --mock-mode and supply a real token (quickstart + authentication).

Authentication: one token, clear storage rules

MCP authentication documents the full lifecycle:

  1. Create an MCP personal access token in the web app (tr_mcp_… prefix).
  2. Store it either with npx -y @testrelic/mcp@3.0.0 login (writes the default file) or via TESTRELIC_MCP_TOKEN / your client’s mcp.json env block—never commit secrets.
  3. Align API base using TESTRELIC_CLOUD_URL or --cloud-url if your reporters already use a non-default endpoint; match the same API base the SDK uses (Configuration, Appium configuration).
  4. Optionally set TESTRELIC_DEFAULT_REPO_ID or --default-repo-id when tools omit a project identifier.
  5. Disable mock mode when you are ready for outbound cloud calls.

That page reiterates: Jira, Amplitude, Loki, GitHub, TestMu AI, and BrowserStack credentials flow from cloud org settings, not from extra MCP secrets.

Capability bundles (--caps) for lean tool schemas

The Capabilities reference defines optional tool groups beyond always-on core:

CapabilityDocumented focus
coreProjects, recent runs, config, health, integration status
coverageUser journeys, test map, coverage gaps, reports, cached payloads
creationPlan → generate tests, templates, dry-run helpers
healingPatch proposals, locator suggestions, replay plans
impactDiff analysis, risk scoring, MUST/SHOULD/OPTIONAL test selection
triageRun diagnosis, flaky audit, RCA, Jira create/dedupe, failure search
signalsUser impact, production logs (Loki), affected sessions
devtoolsTrends, alerts, semantic code search, repo indexing

Suggested bundles on that page cover day-to-day authoring, on-call / failures, and repo-wide exploration. Passing only the caps you need keeps the MCP tool schema smaller—important for models with finite context windows.

Operational verification and next workflows

After wiring credentials, the quickstart recommends tr_health to confirm the server reaches TestRelic successfully. From there, Tools reference enumerates callable tools for your enabled caps, and Testing workflow explains how teams chain MCP-assisted steps with their existing TestRelic data habits.

How MCP complements Ask AI and the web UI

MCP is IDE- and agent-centric tool access. Ask AI (/ai/ask-ai) is a full-page product experience in the cloud with its own plan rules. Many organizations use both: humans triage in the UI while agents refactor tests with MCP-fed run context. Compare goals before standardizing on one surface.

FAQ: What is the fastest way to prove MCP connectivity?

Run tr_health after configuring your token, per MCP quickstart.

FAQ: Do I paste Jira or Loki secrets into mcp.json?

No. Authentication states integrations are loaded from your TestRelic organization after the MCP token validates.

FAQ: How do I limit which tools appear to my assistant?

Use --caps or TESTRELIC_MCP_CAPS with a comma-separated list from Capabilities.

FAQ: Where do hosted and stdio configs differ?

Compare the mcp.json fragments in MCP quickstart—hosted uses the https://mcp.testrelic.ai/mcp URL; stdio uses command/args with npx and optional env for TESTRELIC_MCP_TOKEN.