Perfonext Profiler MCP
v0.7.3MCP server for analyzing V8/Chrome CPU profiles with line-level tick attribution.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
load_profile Load CPU Profile
Parse and load a V8/Chrome CPU profile from disk. Supports both .cpuprofile files and Chrome DevTools Trace JSON exports. Returns a profile ID for use with other tools.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | Absolute or relative path to the .cpuprofile or Chrome trace .json file |
get_hotspots Get Hotspots
Returns the top N functions by self-time (CPU time spent directly in the function, not its callees). Use this to find performance bottlenecks.
| Parameter | Type | Description |
|---|---|---|
profileId * | string | Profile ID returned by load_profile |
limit | number | Number of hotspots to return (default: 10) |
explain_function Explain Function
Returns detailed timing info for a specific function: self-time, total-time, callers, and callees. Use this to understand why a function is slow.
| Parameter | Type | Description |
|---|---|---|
functionName * | string | Exact function name to look up |
profileId * | string | Profile ID returned by load_profile |
contextLines | integer | Only used with includeSource: minimum lines of padding around the declaration and hot lines (default: 10) |
includeSource | boolean | When true, include annotated source code lines with per-line tick counts (default: false) |
compare_profiles Compare Profiles
Compare two loaded CPU profiles side-by-side. Shows functions that got slower/faster and new/removed hotspots.
| Parameter | Type | Description |
|---|---|---|
baseProfileId * | string | Profile ID of the baseline (before) |
compareProfileId * | string | Profile ID to compare (after) |
limit | number | Number of top changes to show |
suggest_optimizations Suggest Optimizations
Analyzes the profile and returns structured optimization suggestions for the hottest functions. Detects high fan-in, recursion, dominant callers, V8-specific patterns, always reports CPU self-time cost for expensive functions, and deduplicates functions split across multiple call sites.
| Parameter | Type | Description |
|---|---|---|
profileId * | string | Profile ID returned by load_profile |
limit | number | Number of functions to analyze (default: 5) |
get_profile_summary Get Profile Summary
Returns an overview of a loaded profile: duration, sample count, top-level call tree (filtered to functions >0.1% of total time), and idle time percentage. For large profiles, the call tree is limited to depth 2 and top 20 children per node to keep output manageable. Also lists all loaded profiles if no ID is given.
| Parameter | Type | Description |
|---|---|---|
profileId | string | Profile ID. If omitted, lists all loaded profiles. |
treeDepth | number | Depth of call tree to include (default: 2, max: 5) |
read_source_context Read Source Context
Read the actual source code for a hot function and annotate each line with sampled tick counts from positionTicks. The returned window is sized to cover the function's actual hot lines, not just the area around its declaration; if any ticks still fall outside it, a `warning` field reports how many and suggests a larger contextLines. Only reads files within the project root.
| Parameter | Type | Description |
|---|---|---|
functionName * | string | Exact function name to look up |
profileId * | string | Profile ID returned by load_profile |
contextLines | integer | Minimum lines of padding around the function declaration and its hot lines (default: 10) |
get_package_costs Get Package Costs
Aggregate CPU self-time by npm package. Identifies which third-party dependencies are consuming the most CPU, by parsing node_modules paths from the profile. Useful for deciding which packages to replace, lazy-load, or avoid. Scoped packages (e.g. @babel/core) are handled correctly.
| Parameter | Type | Description |
|---|---|---|
profileId * | string | Profile ID returned by load_profile |
limit | integer | Maximum number of packages to return, sorted by self-time (default: 10) |
how_to_collect How To Collect a CPU Profile
Returns a ready-to-run command and step-by-step recipe for capturing a V8 CPU profile, then loading it with load_profile. Use this when you do not yet have a .cpuprofile file. Choose the scenario that matches how the code runs.
| Parameter | Type | Description |
|---|---|---|
scenario | string | How the code under test runs. "next-server" (default) profiles a Next.js production server; "script" profiles a Next.js standalone server.js (or another Node entry). |