Skip to content
Conduit

mcp server

testrelic-mcp-server

Official MCP server support for TestRelic AI - Build, Plan, Debug, Analyze with AI native intelligence

testrelic-ai/testrelic-mcp-servercommunitylistedunreviewednot running here yet

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • Node.js 20 or newer
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "testrelic-ai-testrelic-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@testrelic/mcp"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 14, 2026

testrelic-mcp-server

TestRelic Model Context Protocol (MCP) server — a production-grade MCP surface for AI coding assistants that delivers intelligent testing context for:

  1. Test creation (journey-backed tests, ≥95% user coverage, ≥95% test coverage, >60% fewer tokens than plain LLM prompting).
  2. Auto-healing of failing selectors, waits, and assertions.
  3. Coverage-gap detection over real Amplitude user journeys.
  4. Test impact / prioritisation for PR diffs.

For Cursor users

This repository is published as a plugin in the Cursor Marketplace. The plugin surface is intentionally tiny: a manifest (.cursor-plugin/plugin.json), an mcp.json that launches the bundled server from packages/mcp/dist/cli.js, a logo, and docs. No binaries, no remote-fetched scripts, no third-party credentials.

Note for plugin authors: the bundled mcp.json uses the vendored local dist/ build, which works immediately from a git clone or the Cursor local-plugin install. End users should not use that form — @testrelic/mcp is published to npm, so use the npx config in Install as an end user below. A config that points at a path inside a checkout or a global node_modules breaks as soon as that path moves (an npm update, a Node upgrade, a different machine).

Install from the marketplace

  1. Open Cursor and search Settings → Plugins for testrelic-mcp.
  2. Click Install. Cursor wires up the MCP server automatically.
  3. Open the agent and ask something like “list my TestRelic projects”.

That’s it. The marketplace default boots the server in mock mode so you can explore every tool — tr_list_repos, tr_coverage_report, tr_heal_run, tr_analyze_diff, etc. — without any account or token.

Manual install (equivalent mcp.json)

If you prefer to wire the server by hand from a local clone, add this to your Cursor MCP configuration — it is identical to what the plugin ships:

{
  "mcpServers": {
    "testrelic": {
      "command": "node",
      "args": [
        "packages/mcp/dist/cli.js",
        "--caps", "core,coverage,creation,healing,impact",
        "--mock-mode"
      ],
      "env": {}
    }
  }
}

Cursor runs this with the plugin directory as the working directory, so packages/mcp/dist/cli.js resolves relative to the install path. No npm package or internet access is required.

Install as an end user

Use one of these two forms. Neither depends on a path inside a checkout.

Local (stdio) — runs the server on your machine:

{
  "mcpServers": {
    "testrelic": {
      "command": "npx",
      "args": [
        "-y", "@testrelic/mcp",
        "--caps", "coverage,creation,healing,impact,triage,signals,devtools"
      ],
      "env": { "TESTRELIC_MCP_TOKEN": "tr_mcp_..." }
    }
  }
}

Hosted — no local install:

{
  "mcpServers": {
    "testrelic": {
      "type": "http",
      "url": "https://mcp.testrelic.ai/mcp",
      "headers": { "Authorization": "Bearer tr_mcp_..." }
    }
  }
}

Notes:

  • core is always enabled and does not need to be listed. The capabilities above are the full set the hosted service advertises; omitting one only hides its tools.
  • Get a tr_mcp_* token from https://platform.testrelic.ai/settings/mcp-tokens, or run npx @testrelic/mcp login to write ~/.testrelic/token and drop the env block entirely.
  • --cloud-url overrides the cloud-platform-app API base URL (default https://platform.testrelic.ai/api/v1). It is not the MCP host, and it is not validated — a value with no scheme, or with stray whitespace, is passed through to the HTTP client and makes every upstream call fail. Do not set it unless you are pointing at a non-default platform deployment.

Mock mode by default — no secrets required

In mock mode the MCP makes zero outbound network calls. Everything resolves from the local fixtures shipped with the plugin, so a reviewer or first-time user can audit the full tool surface safely.

Connect real data

When you are ready to point the plugin at your TestRelic cloud:

  1. Visit https://platform.testrelic.ai/settings/mcp-tokens and create a tr_mcp_* personal access token.
  2. Store it with either approach:
    • Run npx @testrelic/mcp login (writes ~/.testrelic/token), or
    • Export TESTRELIC_MCP_TOKEN=tr_mcp_… in your shell / CI.
  3. Remove --mock-mode from the args array (or override it in your Cursor MCP config).

Every outbound call then goes to your configured TESTRELIC_CLOUD_URL (default https://platform.testrelic.ai/api/v1) with Authorization: Bearer <token> — and nowhere else. Per-service credentials (Amplitude, Jira, Grafana Loki, GitHub) never live on your machine; they are resolved inside the TestRelic cloud platform.

Preview the plugin locally

Reviewers and plugin authors can preview this repository as a Cursor plugin without publishing anything:

# macOS / Linux
./scripts/link-local-plugin.sh

# Windows (PowerShell)
powershell -ExecutionPolicy Bypass -File scripts/link-local-plugin.ps1

Each script creates a symlink at ~/.cursor/plugins/local/testrelic-mcp pointing at this repo. Restart Cursor, open Settings → Features → Model Context Protocol, and confirm the testrelic server is listed. In the agent, run tr_health — it must succeed in mock mode with no environment variables set.

Security

See SECURITY.md for the disclosure policy, supported versions, and the full plugin threat model. Vulnerabilities go to security@testrelic.ai.


For maintainers

This is a monorepo with two packages:

PackageDescription
packages/mcpThe MCP server (@testrelic/mcp). CLI binary: mcp-server-testrelic.
packages/extensionVSCode/Cursor extension that hosts the server in the editor process.

Quick start

# 1. Install workspace deps
npm install

# 2. Start the mock server (fixtures for journeys, coverage, runs, Loki, Jira, etc.)
npm run mock

# 3. Start the MCP server against the mock
npm run dev -- --caps core,coverage,creation,healing,impact --mock-mode

In another terminal point an MCP-aware client (Claude Desktop, Cursor, VS Code Copilot Chat, OpenAI MCP bridge, etc.) at:

{
  "mcpServers": {
    "testrelic": {
      "command": "node",
      "args": [
        "packages/mcp/dist/cli.js",
        "--caps", "core,coverage,creation,healing,impact",
        "--mock-mode"
      ],
      "cwd": "/absolute/path/to/testrelic-mcp-server"
    }
  }
}

Workspace scripts

CommandPurpose
npm run buildBuild every package.
npm run typecheckTypecheck every package.
npm run devRun @testrelic/mcp via tsx (stdio).
npm run dev:httpRun @testrelic/mcp on HTTP (port 3000).
npm run dev:mockRun the mock server and the MCP server concurrently.
npm run mockStart the mock server at http://localhost:4000.
npm run rollcopy-config then update-readme.
npm run testRun all vitest suites.
npm run ctestContract tests only.
npm run ttestToken-budget baselines only.
npm run dtestDocker-mode tests (MCP_IN_DOCKER=1).

Intelligence surface

Capabilities map 1:1 to tool groups. core is always on; everything else is gated behind --caps:

  • core — projects, recent runs, resolved config, health.
  • coverage — user journeys, test map, coverage gaps, coverage report.
  • creation — planner → generator → dry-run → assertion helper.
  • healing — patch proposals, locator suggestions, replay plans.
  • impact — diff analysis, risk score, MUST/SHOULD/OPTIONAL test selection.
  • triage — v1 migration (diagnose, flaky audit, compare runs, AI RCA, Jira dedupe, dismiss flakiness).
  • signals — Amplitude user impact + Loki production signal.
  • devtools — project trends, active alerts, semantic code search, cache stats.

Every new tool is prefixed tr_*. Existing v1 flat names (testrelic_*) are registered as deprecated aliases to avoid breaking older integrations.

Configuration precedence

CLI flags > environment (TESTRELIC_MCP_*) > --config file > defaults

See packages/mcp/src/config.d.ts for the full schema. The Zod schema in packages/mcp/src/config.ts is the runtime source of truth; copy-config keeps the two in sync.

Token-efficiency architecture

LayerStorageNotes
L1lru-cache in-process60 s TTL, sized by count.
L2better-sqlite3 (fallback: in-memory map)1 h–24 h TTL, namespace invalidation.
L3hnswlib-node + @xenova/transformers BGE-small embeddings (fallback: linear scan with hash-based embedder)Semantic search over the code map.
L4Filesystem blob store keyed by SHA256Large payloads referenced by cache_key.

On top of caching, the server uses:

  • Capability gating to cut the tool schema by ~4×.
  • Per-tool token budget with automatic truncation + cache_key pointer.
  • 3-state reads (full / unchanged / diff) via SimHash.
  • Sampling bridge → client-side LLM for code synthesis (no server-side LLM key).
  • Elicitation for structured follow-up questions.

Deployment

Deployment is out of scope for this repo — the MCP server is intended to be installed client-side via npx -y @testrelic/mcp, hosted in the IDE via the extension, or dropped into Kubernetes via the provided Dockerfile.

Don't commit credentials. The mock server runs locally with zero secrets.

↑↓ navigate openesc close