Perfonext Build MCP
v0.6.2MCP server for Next.js build stats, chunk attribution, and bundle optimization advice.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
load_build_stats Load Build Stats
Parse a Next.js .next directory and load route and chunk footprint data for later analysis.
| Parameter | Type | Description |
|---|---|---|
buildDir * | string | Absolute or relative path to the project .next build directory, not .next/standalone |
buildOutputPath | string | Optional path to captured next build terminal output for deriving build duration |
get_largest_routes Get Largest Routes
Rank the heaviest user-facing routes in a loaded Next.js build by emitted chunk bytes.
| Parameter | Type | Description |
|---|---|---|
buildId | string | Build ID returned from load_build_stats. Omit to list loaded builds. |
limit | integer | How many routes to include. Defaults to 10. |
compare_builds Compare Builds
Compare two loaded Next.js builds and show which routes and chunks grew or shrank the most.
| Parameter | Type | Description |
|---|---|---|
baselineBuildId | string | Baseline build ID from load_build_stats. Omit to list loaded builds. |
currentBuildId | string | Current build ID from load_build_stats. Omit to list loaded builds. |
limit | integer | How many route and chunk deltas to include. Defaults to 10. |
explain_growth Explain Growth
Identify which routes and chunks are responsible for bundle size growth between two loaded builds. Returns severity-ranked route findings, the top growing chunks, and an overall regression summary.
| Parameter | Type | Description |
|---|---|---|
baselineBuildId | string | Baseline build ID from load_build_stats. Omit to list loaded builds. |
currentBuildId | string | Current build ID from load_build_stats. Omit to list loaded builds. |
limit | integer | Max route findings and top growing chunks to return. Defaults to 10. |
how_to_collect_stats How To Collect Webpack Stats
Explain how to generate the webpack stats file (.next/stats.json) required by the bundle attribution tools. Choose manual (a recipe you apply yourself) or automatic (an action plan Copilot executes).
| Parameter | Type | Description |
|---|---|---|
method * | string | manual: return a recipe to apply yourself. automatic: return an action plan for Copilot to execute. |
scenario | string | Collection context. Defaults to webpack. Use turbopack if the app builds with --turbopack. |
load_webpack_stats Load Webpack Stats
Parse the webpack module stats file (.next/stats.json) and link it to a build loaded with load_build_stats. Unlocks the stats-powered tools: suggest_optimizations (enriched), find_duplicates, explain_shared_chunks, and trace_import.
| Parameter | Type | Description |
|---|---|---|
buildId * | string | Build ID returned by load_build_stats; the stats.json is read from that build directory |
trace_import Trace Import
Explain why a module is bundled by tracing its import chain from an entry point to the module. moduleSizeBytes is the unminified webpack module size, not emitted chunk size. Requires load_webpack_stats first.
| Parameter | Type | Description |
|---|---|---|
buildId * | string | Build ID returned by load_build_stats |
moduleName * | string | Module or package name to search for (case-insensitive substring), e.g. "lodash" |
limit | integer | Maximum matching modules to trace. Defaults to 10. |
find_duplicates Find Duplicate Packages
Find npm packages whose code is bundled into more than one chunk, wasting bytes, ranked by wasted bytes. Requires load_webpack_stats first.
| Parameter | Type | Description |
|---|---|---|
buildId * | string | Build ID returned by load_build_stats |
limit | integer | Maximum duplicate packages to return. Defaults to 20. |
suggest_optimizations Suggest Optimizations
Aggregate route, chunk, and (when loaded) webpack-stats evidence into severity-ranked, evidence-backed bundle optimizations tied to concrete Next.js actions. Every suggestion is sized in emitted on-disk bytes. Works on manifests alone; load_webpack_stats first for dedupe, shared-chunk, and package-import suggestions.
| Parameter | Type | Description |
|---|---|---|
buildId * | string | Build ID returned by load_build_stats |
limit | integer | Maximum suggestions to return. Defaults to 15. |