thesharque avatar

javaperf

thesharque/mcp-jperf

Wraps the JDK's command-line profiling toolkit (jcmd, jfr, jps) so you can diagnose Java performance issues through an LLM conversation instead of jumping to the terminal. You get tools to list running JVMs, start and stop JFR recordings with configurable presets, parse flamegraphs and allocation profiles, check for deadlocks, dump heaps, and analyze thread contention or socket I/O from flight recorder data. Useful when you're debugging memory leaks, CPU hotspots, or lock contention and want to stay in your Claude or Cursor workflow. The heap_live_histogram_diff tool is especially handy for spotting which classes are growing between snapshots without triggering a full GC.

tools
26
transport
STDIO
last updated
Sep 27, 2026

Tools

26 tools

Public tool metadata for what this MCP can expose to an agent.

list_java_processesList running Java processes (pid, mainClass, args). Use `topN` (default 10) to limit.

List running Java processes (pid, mainClass, args). Use `topN` (default 10) to limit.

No parameter schema in public metadata yet.

start_profilingStart JFR. Pass `pid`, `duration` (seconds). Optional: `preset` (default effective: `profile`), `settingsFile` (path to `.jfc`, mutually exclusive with `preset`), `memorysize`, `stackdepth` (default 128).

Start JFR. Pass `pid`, `duration` (seconds). Optional: `preset` (default effective: `profile`), `settingsFile` (path to `.jfc`, mutually exclusive with `preset`), `memorysize`, `stackdepth` (default 128).

No parameter schema in public metadata yet.

profile_jfr_networkSocket I/O summary from `.jfr` (`jdk.SocketRead`, `jdk.SocketWrite`). Optional `filepath` (default new_profile), `topN`.

Socket I/O summary from `.jfr` (`jdk.SocketRead`, `jdk.SocketWrite`). Optional `filepath` (default new_profile), `topN`.

No parameter schema in public metadata yet.

profile_jfr_file_ioFile read/write summary (`jdk.FileRead`, `jdk.FileWrite`). Optional `filepath`, `topN`.

File read/write summary (`jdk.FileRead`, `jdk.FileWrite`). Optional `filepath`, `topN`.

No parameter schema in public metadata yet.

profile_jfr_locksMonitor contention (`JavaMonitorBlocked`) and j.u.c parking (`ThreadPark`). Optional `filepath`, `topN`.

Monitor contention (`JavaMonitorBlocked`) and j.u.c parking (`ThreadPark`). Optional `filepath`, `topN`.

No parameter schema in public metadata yet.

profile_jfr_nativeNative-method CPU hotspots (`jdk.NativeMethodSample`). Optional `filepath`, `topN`.

Native-method CPU hotspots (`jdk.NativeMethodSample`). Optional `filepath`, `topN`.

No parameter schema in public metadata yet.

native_memory_summary`jcmd VM.native_memory summary` — requires JVM with `-XX:NativeMemoryTracking=summary` or `detail`. Pass `pid`.

`jcmd VM.native_memory summary` — requires JVM with `-XX:NativeMemoryTracking=summary` or `detail`. Pass `pid`.

No parameter schema in public metadata yet.

gc_class_stats`jcmd GC.class_stats` when available (often JDK 21+). Pass `pid`.

`jcmd GC.class_stats` when available (often JDK 21+). Pass `pid`.

No parameter schema in public metadata yet.

gc_finalizer_info`jcmd GC.finalizer_info`. Pass `pid`.

`jcmd GC.finalizer_info`. Pass `pid`.

No parameter schema in public metadata yet.

compiler_codecache`jcmd Compiler.codecache`. Pass `pid`.

`jcmd Compiler.codecache`. Pass `pid`.

No parameter schema in public metadata yet.

compiler_queue`jcmd Compiler.queue`. Pass `pid`.

`jcmd Compiler.queue`. Pass `pid`.

No parameter schema in public metadata yet.

list_jfr_recordingsList active JFR recordings for a process. Use before `stop_profiling` to get `recordingId`.

List active JFR recordings for a process. Use before `stop_profiling` to get `recordingId`.

No parameter schema in public metadata yet.

stop_profilingStop recording and save to recordings/new_profile.jfr. Requires `pid` and `recordingId`.

Stop recording and save to recordings/new_profile.jfr. Requires `pid` and `recordingId`.

No parameter schema in public metadata yet.

check_deadlockCheck for Java-level deadlocks. Returns structured JSON with threads, locks, and cycle.

Check for Java-level deadlocks. Returns structured JSON with threads, locks, and cycle.

No parameter schema in public metadata yet.

analyze_threadsThread dump (jstack) with deadlock summary. Pass `pid`, optional `topN` (default 10), `structured` (JSON lock-wait chains).

Thread dump (jstack) with deadlock summary. Pass `pid`, optional `topN` (default 10), `structured` (JSON lock-wait chains).

No parameter schema in public metadata yet.

heap_histogramClass histogram (GC.class_histogram). Pass `pid`, optional `topN` (20), `all` (triggers full GC — may pause app).

Class histogram (GC.class_histogram). Pass `pid`, optional `topN` (20), `all` (triggers full GC — may pause app).

No parameter schema in public metadata yet.

heap_live_histogram_diffTwo histograms spaced by `intervalSeconds` (default 5). Top classes by instance/byte growth. Pass `pid`, optional `topN`, `all`, `minInstanceDelta`.

Two histograms spaced by `intervalSeconds` (default 5). Top classes by instance/byte growth. Pass `pid`, optional `topN`, `all`, `minInstanceDelta`.

No parameter schema in public metadata yet.

heap_dumpCreate .hprof for MAT/VisualVM. Pass `pid`. Saved to recordings/heap_dump.hprof.

Create .hprof for MAT/VisualVM. Pass `pid`. Saved to recordings/heap_dump.hprof.

No parameter schema in public metadata yet.

heap_infoBrief heap summary. Pass `pid`.

Brief heap summary. Pass `pid`.

No parameter schema in public metadata yet.

vm_infoJVM info: uptime, version, flags. Pass `pid`.

JVM info: uptime, version, flags. Pass `pid`.

No parameter schema in public metadata yet.

trace_methodBuild call tree for a method from .jfr. Pass `className`, `methodName`. Optional: `filepath` (default new_profile), `topN`.

Build call tree for a method from .jfr. Pass `className`, `methodName`. Optional: `filepath` (default new_profile), `topN`.

No parameter schema in public metadata yet.

parse_jfr_summaryParse .jfr into summary: top methods, GC stats, anomalies. Optional: `filepath` (default new_profile), `events`, `topN`.

Parse .jfr into summary: top methods, GC stats, anomalies. Optional: `filepath` (default new_profile), `events`, `topN`.

No parameter schema in public metadata yet.

profile_memoryMemory profile: top allocators by bytes/count, allocation stacks, OldObjectSample by class. Optional: `filepath`, `topN`, `sortBy` (`bytes`/`count`).

Memory profile: top allocators by bytes/count, allocation stacks, OldObjectSample by class. Optional: `filepath`, `topN`, `sortBy` (`bytes`/`count`).

No parameter schema in public metadata yet.

gc_efficiencyGC efficiency from .jfr: pause vs freed bytes per collector. Optional: `filepath`, `topN`.

GC efficiency from .jfr: pause vs freed bytes per collector. Optional: `filepath`, `topN`.

No parameter schema in public metadata yet.

profile_timeCPU bottleneck profile (bottom-up). Optional: `filepath` (default new_profile), `topN`.

CPU bottleneck profile (bottom-up). Optional: `filepath` (default new_profile), `topN`.

No parameter schema in public metadata yet.

profile_frequencyCall frequency profile (leaf frames). Optional: `filepath` (default new_profile), `topN`.

Call frequency profile (leaf frames). Optional: `filepath` (default new_profile), `topN`.

No parameter schema in public metadata yet.

Sponsors

Readme

javaperf

npm version

MCP (Model Context Protocol) server for profiling Java applications via JDK utilities (jcmd, jfr, jps)

Enables AI assistants to diagnose performance, analyze threads, and inspect JFR recordings without manual CLI usage.

📦 Install: npm install -g javaperf or use via npx 🌐 npm: https://www.npmjs.com/package/javaperf

How to connect to Claude Desktop / IDE

Add the server to your MCP config. Example for claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "javaperf": {
      "command": "npx",
      "args": ["-y", "javaperf"]
    }
  }
}

For Cursor IDE: Settings → Features → Model Context Protocol → Edit Config, then add the same block inside mcpServers. See the Integration section for more options (local dev, custom JAVA_HOME, etc.).

Requirements

  • Node.js v18+
  • JDK 8u262+ or 11+ with JFR support

View the full README on GitHub

Details

Repository
github.com/thesharque/mcp-jperf
Package
javaperf
Transport
STDIO
Registry
MCP registry, active

More from thesharque