
perf-engineer
io.github.perf-engineer/perf-engineer
Diagnose slow web pages, LCP, and Core Web Vitals with Lighthouse and Chrome evidence.
Documentation
Perf Engineer
English | 简体中文
A read-only MCP server for diagnosing initial page-load performance in AI coding clients such as Antigravity, Cursor, Claude Code, Codex, and VS Code. It combines repeated measurements from real Chrome and Lighthouse 12 with source-code analysis to produce a diagnostic report (report.md) and an optimization task list (perf-tasks.md) for developers or AI assistants to work through.
Features
- Repeated Chrome and Lighthouse 12 measurements, using median values to identify resource, image, script, and API bottlenecks that affect initial loading
- Read-only diagnostic tools that do not modify application source code or run builds, dependency installation, or Git commands
- Checks linking deployed artifacts to local source code, with separate tasks for production operations, deployment, and local code changes when versions differ
- A built-in diagnostic guide covering six areas of initial page-load performance, with support for team-specific guidance
- Retests using the same device, network, and login conditions after changes are deployed, with before-and-after metric comparisons
Requirements
- Node.js
>= 22.13.0 - Chrome or Chromium installed locally
Quick start
Add the following configuration to an MCP-compatible client. You do not need to clone the repository:
{
"mcpServers": {
"perf-engineer": {
"command": "npx",
"args": ["-y", "@perf-engineer/web"]
}
}
}
You can also use the built-in installers to add client configuration and, where supported, read-only rules:
Antigravity (includes a hook to prevent accidental writes)
npx -y @perf-engineer/web install antigravity
The installer writes the plugin to ~/.gemini/config/plugins/perf-engineer. Restart or reload the Antigravity plugin to apply it.
Cursor
Run this command from the root of the project you want to diagnose:
npx -y @perf-engineer/web install cursor
The installer merges the MCP configuration into .cursor/mcp.json, preserving existing settings, and writes .cursor/rules/perf-engineer.mdc. Add --global to install the MCP configuration in ~/.cursor/mcp.json.
Claude Code
Use the Claude CLI to add the MCP server:
claude mcp add perf-engineer -- npx -y @perf-engineer/web
Alternatively, run npx -y @perf-engineer/web install claude-code from the project root to generate .mcp.json.
Codex
Run this command from the project root:
npx -y @perf-engineer/web install codex
For a global configuration in ~/.codex/config.toml, add:
[mcp_servers.perf-engineer]
command = "npx"
args = ["-y", "@perf-engineer/web"]
VS Code
Run this command from the project root:
npx -y @perf-engineer/web install vscode
Or configure .vscode/mcp.json manually:
{
"servers": {
"perf-engineer": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@perf-engineer/web"]
}
}
}
Usage
Diagnose a public page
Use perf-engineer to diagnose
https://shop.example.com/. The local repository is at/path/to/storefront. No login is required.
Diagnose a page that requires login
Use perf-engineer to diagnose
https://app.example.com/dashboard. The local repository is at/path/to/app. Login is required.
At the login step, Perf Engineer opens an isolated Chrome window for you to sign in manually, including QR codes, verification codes, or two-factor authentication. Once you are signed in, ask the AI assistant to continue measuring. The diagnostic tools do not read or record passwords, cookies, local storage, or tokens.
Work through the task list
When diagnosis finishes, Perf Engineer returns the path to perf-tasks.md. You can work through the tasks in priority order or pass the file to an AI assistant:
Complete the optimizations in this
perf-tasks.mdone at a time. Run each task's acceptance checks after completing it.
Retest after deployment
After deploying the changes, repeat the measurements under the same conditions and compare the results:
Use perf-engineer to retest
https://shop.example.com/and compare it with the previous diagnosis.
Output files
Each run writes its results to ~/.perf-engineer/data/runs/<run-id>/:
~/.perf-engineer/data/runs/<run-id>/
├── report.md # Findings, measurements, production/local issues, and analysis coverage
├── perf-tasks.md # Change scope, implementation steps, acceptance checks, and rollback guidance
├── manifest.json # Run metadata
└── evidence/ # Initial viewport screenshot, network requests, and Lighthouse diagnostics
The following results come from a real storefront homepage diagnosis, with identifying details removed. The full report and task list are available in examples/:
| Metric | Measured median | Reference threshold | Status |
|---|---|---|---|
| Performance score | 42 | ≥ 85 | ❌ Low |
| First Contentful Paint (FCP) | 1.5 s | ≤ 1.8 s | ✅ Within threshold |
| Largest Contentful Paint (LCP) | 12.2 s | ≤ 2.5 s | ❌ Slow |
| Speed Index | 9.8 s | ≤ 3.4 s | ❌ Very slow |
| Total Blocking Time (TBT) | 429 ms | ≤ 200 ms | ⚠️ High |
| Cumulative Layout Shift (CLS) | 0.01 | ≤ 0.10 | ✅ Within threshold |
Diagnostic coverage and customization
The built-in guide covers six areas of initial page-load performance and does not require an external skill library:
| Area | What the guide covers |
|---|---|
| Bundle size and code splitting | On-demand UI and utility imports, moving heavy dependencies out of the initial bundle, duplicate libraries, and legacy polyfills |
| Network resource scheduling | Critical cross-origin preconnect and dns-prefetch, incorrect preload or prefetch usage, and duplicate downloads |
| Images | CDN resizing and WebP/AVIF conversion, loading="lazy" for below-the-fold images and inactive carousel slides, and compression of large local images |
| Rendering and execution timing | Eagerly mounted hidden dialogs, lazy loading lower sections of long pages, deferred analytics and payment SDKs, and animations that delay initial content visibility |
| Caching and delivery | Long-lived caching for hashed assets, cache revalidation for entry HTML, br/gzip/zstd compression, and HTTP/2 |
| API waterfalls and main-thread work | Duplicate startup requests, sequential API chains, request fan-out, and excessive DOM size |
To add team-specific guidance, edit the initial page-load diagnostic guide and rebuild the package.
Security and scope
- Diagnostic tools do not modify files in the target repository or run build, installation, or Git commands against it.
- They do not read, record, or request browser cookies,
localStorage/sessionStorage, passwords, or tokens. - An initial read-only diagnosis does not claim that performance has improved. Before-and-after comparisons require a subsequent retest under the same conditions after changes are deployed.
Local development
git clone https://github.com/perf-engineer/perf-engineer.git
cd perf-engineer
npm install
npm run build
npm run build:web
npm run check
npm test
Documentation and license
- Architecture (Chinese)
- Contributing
- Security policy
- Released under the MIT License
@perf-engineer/webnpm install @perf-engineer/web