Install
The MCP server is an optional dependency. Install it alongside the base CLI:The
mcp extra installs the FastMCP transport layer. If you already have prescale installed without it, re-run either command above — it upgrades in place.Register with Claude Code
prescale mcp as a stdio-transport MCP server. Claude Code will start the process automatically when it needs to call a PreScale tool.
For other MCP-compatible agents (Cursor, Windsurf, etc.), register the server as a process command pointing to prescale mcp — consult your agent’s MCP configuration docs for the exact syntax.
Available MCP tools
Once registered, your agent can call any of the following tools:load_test
url up to max_users concurrent virtual users. Returns a compact verdict summary and a run_id you can pass to get_run for the full breakdown. Use this when you want a fast capacity check without deep diagnosis.
investigate
investigation block containing the bottleneck class, supporting evidence, and a plain-English fix recommendation. Use this when you want the agent to understand why something broke and act on it.
audit
list_runs
id, timestamp, host, and a one-line verdict. Use this to orient the agent to past results without re-testing.
get_run
Result envelope for a given run ID — per-level metrics, per-route breakdown, verdict, confidence band, and investigation block. Use this when the agent needs the raw numbers to reason about a result in depth.
Safety
PreScale’s MCP server is conservative about what it will load-test on the agent’s behalf. Local hosts are always allowed. Anything onlocalhost, 127.0.0.1, or ::1 can be tested freely — no extra configuration needed.
Non-local hosts are refused by default. If the agent tries to load-test a staging or production host without explicit permission, the server returns a HostNotAllowedError rather than sending traffic.
Hosts that restrict load testing are refused too. Even an allowed host on Vercel, Netlify or Cloudflare is refused unless the server was started with PRESCALE_HOST_PERMISSION=1, because those hosts only allow load tests by arrangement (host rules).
To allow a specific staging host, either set the PRESCALE_MCP_ALLOW environment variable when starting the server, or pass --allow on the prescale mcp command:
--allow flags are merged. To allow multiple hosts via the env var, use a comma-separated list:
Example agent workflow
Here is what a typical agent-assisted performance loop looks like once PreScale is registered:- Agent writes a new endpoint and spins up the local dev server on
http://localhost:8000. - Agent calls
load_test("http://localhost:8000/api/checkout")— PreScale ramps traffic and returns a verdict. The app breaks at 40 concurrent users. - Agent calls
investigate("http://localhost:8000/api/checkout")— the investigation block comes back:connection_poolbottleneck on/api/checkout, p95 latency jumps from 20 ms at 1 user to 3.2 s at 40 users, fix suggestion is to increase the DB connection pool size. - Agent edits the database config, restarts the server, and calls
load_testagain. - The new result clears 100 users — the agent moves on.