MCP quickstart
Connect to production TestRelic MCP via the hosted URL or stdio with the published npm package, wire mcp.json, set your MCP token, and verify with tr_health.
Pick how you reach the server in production: hosted MCP at mcp.testrelic.ai (streamable HTTP, no local binary), npx with the published @testrelic/mcp package (stdio, any MCP client), or the Cursor marketplace plugin if you use Cursor. Optional sandbox paths (mock mode or a local git clone) are for evaluation and development only.
Purpose
Install or connect the TestRelic MCP server so your MCP host can use it (hosted URL or stdio), set a production MCP personal access token, then verify with tr_health.
Concept: stdio wiring
Install path vs typical setup depth
Comparing how many discrete steps teams often budget before tr_health succeeds — illustrative counts for planning, not a guarantee. Assumes production (hosted URL or npx with a token), not local sandbox builds.
Cursor — marketplace
- Open Cursor and search Settings → Plugins for
testrelic-mcp. - Click Install. Cursor wires up the MCP server automatically from the bundled config; see the plugin's
mcp.jsonin testrelic-mcp-server for the exact wiring shipped to the marketplace. - Open the agent and ask something like "list my TestRelic projects" (or call
tr_health).
The marketplace default boots in mock mode so you can explore every tool without an account or token.
For live org data in production, connect real data: create a personal access token (tr_mcp_*) at platform.testrelic.ai/settings/mcp-tokens, run npx @testrelic/mcp login (or set TESTRELIC_MCP_TOKEN=tr_mcp_…), and drop --mock-mode. See Authentication for details.
Manual mcp.json
Add a server entry to your client's MCP configuration. Prefer hosted or npx + token for production.
Streamable HTTP MCP served at the production hostname (same pattern as mcp.json in the testrelic-mcp-server repo and the local preview scripts, with the production host):
{
"mcpServers": {
"testrelic": {
"url": "https://mcp.testrelic.ai/mcp"
}
}
}Use your MCP client's documented way to attach credentials if it requires a header or env for remote servers. Otherwise use the stdio tab so the process can read TESTRELIC_MCP_TOKEN or ~/.testrelic/token from Authentication.
Restart the MCP host app after saving. Run tr_health in the agent to confirm the server responds.
Mock mode vs production cloud
| Mode | Use when |
|---|---|
--mock-mode | Sandboxes only: learning the tool surface, demos, or CI smoke of the MCP binary. No outbound calls to TestRelic production APIs. |
| Production (token set, no mock flag) | Real repos, runs, journeys, and integrations resolved from your org in the TestRelic cloud. |
Mock mode is the default for the zero-config / marketplace install. To connect real data:
- Create a personal access token (
tr_mcp_*) atplatform.testrelic.ai/settings/mcp-tokens. - Run
npx @testrelic/mcp login(or setTESTRELIC_MCP_TOKEN=tr_mcp_…in your client'senv). - Drop
--mock-modefrom your MCP server args.
See Authentication for creating and storing tr_mcp_… tokens.
Troubleshooting
| Symptom | What to try |
|---|---|
| MCP host does not see the server | Restart the host after editing mcp.json; confirm you used the hosted URL, npx args, or contributor local paths consistently. |
tr_health fails | Run from the agent after the server binary is reachable; check stderr from the MCP process in host logs. |
Optional: local mock API (contributors)
For development in testrelic-mcp-server, you can run a local mock HTTP API (npm run mock) and point the MCP at it with --mock-mode. Production users rely on the hosted endpoint or stdio against the real cloud instead.
Next steps
TestRelic MCP overview
Model Context Protocol server that gives AI assistants TestRelic context—repos, runs, coverage gaps, test creation, healing, and impact analysis tied to your cloud data.
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.