javaperf
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@javaperf list Java processes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
javaperf
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.).
Related MCP server: Arthas MCP Server
Requirements
Node.js v18+
JDK 8u262+ or 11+ with JFR support
JDK tools (jps, jcmd, jfr) are auto-detected via JAVA_HOME or which java. If not found, set JAVA_HOME to your JDK root.
Quick Start
For Users (using npm package)
# No installation needed - use directly in Cursor/Claude Desktop
# Just configure it as described in Integration section belowFor Developers
Clone the repository:
git clone https://github.com/theSharque/mcp-jperf.git
cd mcp-jperfInstall dependencies:
npm installBuild the project:
npm run buildUsage
Development Mode
npm run devProduction Mode
npm startMCP Inspector
Debug and test with MCP Inspector:
npx @modelcontextprotocol/inspector node dist/index.jsIntegration
Cursor IDE
Open Cursor Settings β Features β Model Context Protocol
Click "Edit Config" button
Add one of the configurations below
Option 1: Via npm (Recommended)
Installs from npm registry automatically:
{
"mcpServers": {
"javaperf": {
"command": "npx",
"args": ["-y", "javaperf"]
}
}
}Option 2: Via npm link (Development)
For local development with live changes:
{
"mcpServers": {
"javaperf": {
"command": "javaperf"
}
}
}Requires: cd /path/to/mcp-jperf && npm link -g
Option 3: Direct path
{
"mcpServers": {
"javaperf": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "${workspaceFolder}",
"env": {
"JAVA_HOME": "/path/to/your/jdk"
}
}
}
}If list_java_processes fails with "jps not found", the MCP server may not inherit your shell's JAVA_HOME. Add the env block above with your JDK root path (e.g. /usr/lib/jvm/java-17 or ~/.sdkman/candidates/java/current).
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"javaperf": {
"command": "npx",
"args": ["-y", "javaperf"]
}
}
}Continue.dev
Edit .continue/config.json:
{
"mcpServers": {
"javaperf": {
"command": "npx",
"args": ["-y", "javaperf"]
}
}
}Tools
Tool | Description |
| List running Java processes (pid, mainClass, args). Use |
| Start JFR. Pass |
| Socket I/O summary from |
| File read/write summary ( |
| Monitor contention ( |
| Native-method CPU hotspots ( |
|
|
|
|
|
|
|
|
|
|
| List active JFR recordings for a process. Use before |
| Stop recording and save to recordings/new_profile.jfr. Requires |
| Check for Java-level deadlocks. Returns structured JSON with threads, locks, and cycle. |
| Thread dump (jstack) with deadlock summary. Pass |
| Class histogram (GC.class_histogram). Pass |
| Two histograms spaced by |
| Create .hprof for MAT/VisualVM. After |
| Brief heap summary. Pass |
| JVM info: uptime, version, flags. Pass |
| Build call tree for a method from .jfr. Pass |
| Parse .jfr into summary: top methods, GC stats, anomalies. Optional: |
| Memory profile: top allocators by bytes/count, allocation stacks, OldObjectSample by class. Optional: |
| GC efficiency from .jfr: pause vs freed bytes per collector. Optional: |
| CPU bottleneck profile (bottom-up). Optional: |
| Call frequency profile (leaf frames). Optional: |
Example Workflow
List processes β
list_java_processesStart recording β
start_profilingwithpidandduration(e.g. 60)Wait for
durationseconds (or let it run)Check recordings (optional) β
list_jfr_recordingsto getrecordingIdStop and save β
stop_profilingwithpidandrecordingIdAnalyze β
parse_jfr_summary,profile_memory,gc_efficiency,profile_time,profile_frequency,trace_method,profile_jfr_network,profile_jfr_file_io,profile_jfr_locks, orprofile_jfr_native(events must exist in the recording β usestart_profilingwith a suitable preset or.jfcviasettingsFile)
Example Workflow: Memory leak hypothesis
List processes β
list_java_processesFind growing classes β
heap_live_histogram_diffwithpid,intervalSeconds: 5Record under load β
start_profilingβ wait βstop_profilingAllocation profile β
profile_memoryonnew_profile(checkoldObjectSamplesByClassfor suspect class)GC pressure β
gc_efficiencyon the same.jfrConfirm retention β
heap_dumpβ Eclipse MAT β Path to GC Roots (exclude weak/soft references)AI builds a coherent leak hypothesis from the combined results (no dedicated tool)
Remote JVM (stdio MCP)
javaperf uses stdio MCP and attaches to JVMs via local jps/jcmd. That only works on the OS account and host where the MCP process runs.
To diagnose a JVM on another machine:
Run the MCP server (your IDE connector, Cursor, or Claude Desktop) on that machine, for example SSH remote workspace, Codespaces, CI runner checkout on the server, or a shell session on the same host as the process.
Do not rely on piping
jcmdover plain SSH from another host unless you deliberately run MCP there; attaching across hosts is outside this serverβs scope.
Requirements (same user, local attach) listed under Limitations still apply.
Limitations
Sampling: JFR samples ~10ms; fast methods may not appear in ExecutionSample
Local only: Runs on the machine where MCP is started
Permissions: Must run as same user as target JVM for jcmd access
Available Tools
26 toolsanalyze_threadsA
Thread dump (jstack -l). Default: plain text. Set structured=true for JSON lock-wait chains (live snapshot). Historical contention: profile_jfr_locks. Deadlock cycle: check_deadlock.
Inputs: pid (required), topN, structured.
check_deadlockA
Checks for Java-level deadlocks in the specified process. Parses jcmd Thread.print output and returns structured JSON: which threads are involved, what locks they hold/wait for, and the deadlock cycle. Use for automated analysis and reports.
Inputs: pid (required).
compiler_codecacheC
jcmd Compiler.codecache β code heap usage and related JVM output.
Inputs: pid (required).
compiler_queueC
jcmd Compiler.queue β methods queued for JIT compilation.
Inputs: pid (required).
gc_class_statsA
jcmd GC.class_stats (class loader / metaspace style stats where supportedβoften JDK 21+). On older JDK returns error hint; use heap_info or heap_histogram instead.
Inputs: pid (required).
gc_efficiencyA
GC efficiency from .jfr: pause time vs freed bytes per collector/cause. Use after stop_profiling; complements profile_memory and heap_info. Not a general JFR summary (see parse_jfr_summary).
Inputs: filepath, topN.
gc_finalizer_infoC
jcmd GC.finalizer_info β finalizer queue diagnostics for the live process.
Inputs: pid (required).
heap_dumpA
Creates .hprof for Eclipse MAT / VisualVM. After heap_live_histogram_diff picks a growing class, use MAT Path to GC Roots (exclude weak/soft). Saved to recordings/heap_dump.hprof. Warning: large file.
Inputs: pid (required).
heap_histogramA
Static class histogram (jcmd GC.class_histogram). For live growth over time use heap_live_histogram_diff instead.
Inputs: pid (required), topN, all.
heap_infoA
Brief heap usage summary: capacities, used, committed regions. Quick snapshot without full dump.
Inputs: pid (required).
heap_live_histogram_diffA
Two GC.class_histogram snapshots spaced by intervalSeconds; returns classes whose instance count grew most. Use first in memory-leak workflow; then profile_memory and heap_dump (MAT path-to-GC-roots). Each snapshot walks the heap and may pause the app.
Inputs: pid (required), intervalSeconds, topN, all, +1 more.
list_java_processesA
Lists all running Java processes on the machine. Returns an array of objects with pid, mainClass, and args. Use this tool first to discover the target process PID before calling start_profiling or analyze_threads. Data is obtained via jps -l -m.
Inputs: topN.
list_jfr_recordingsA
Lists active and recent JFR recordings for a Java process (jcmd JFR.check). Returns recording id, duration, state (running/stopped), and filename. Use before stop_profiling to get the correct recordingId.
Inputs: pid (required).
native_memory_summaryA
jcmd VM.native_memory summary=true. Requires JVM started with -XX:NativeMemoryTracking=summary or detail; otherwise explains how to enable.
Inputs: pid (required).
parse_jfr_summaryA
Parses a .jfr file and returns a structured summary: top methods by CPU samples, GC statistics, thread allocation stats, and anomaly hints (e.g. high GC count). Use for a quick high-level overview of the recording before diving into specific profiles.
Inputs: filepath, events, topN.
profile_frequencyA
Call frequency profile from a .jfr file. Counts methods that appear at the leaf (top) of the stack in ExecutionSample events β i.e. methods that were actively executing when sampled. Returns the most frequently sampled methods (exclusive, not cumulative). Use when looking for hot spots or the most often executed code paths.
Inputs: filepath, topN.
profile_jfr_file_ioA
Summarize file read/write events (jdk.FileRead, jdk.FileWrite): counts, bytes, top paths, stack hotspots. Events must exist in recording; configure via start_profiling preset or settingsFile (.jfc).
Inputs: filepath, topN.
profile_jfr_locksA
Lock contention from JFR: synchronized monitors (JavaMonitorBlocked) and j.u.c parking (ThreadPark). Live wait chains: analyze_threads structured=true. Deadlocks: check_deadlock. Enable events via custom .jfc if missing.
Inputs: filepath, topN.
profile_jfr_nativeB
CPU-style cumulative hotspots from jdk.NativeMethodSample stacks. Recording must enable NativeMethodSample (often requires custom .jfc).
Inputs: filepath, topN.
profile_jfr_networkA
Summarize JDK socket I/O from a .jfr (jdk.SocketRead, jdk.SocketWrite): event counts, total bytes read/written where available, top endpoints (host:port / address), and cumulative stack hotspots. Recording must include those events (custom .jfc or preset that enables them). If emptyEvents, use start_profiling settingsFile.
Inputs: filepath, topN.
profile_memoryA
JFR memory profile: top allocators by bytes/count, allocation stacks, OldObjectSample by class (allocation site, not GC roots). Pair with heap_live_histogram_diff, gc_efficiency, heap_dump+MAT. Requires profile preset recording.
Inputs: filepath, topN, sortBy.
profile_timeA
CPU time (bottleneck) profile from a .jfr file. Uses bottom-up aggregation: each method is counted in every sample where it appears in the stack, including time spent in callees. Returns methods consuming the most CPU time. Use when the goal is to find performance bottlenecks and slow code paths.
Inputs: filepath, topN.
start_profilingA
Starts JFR on the target PID. Rotates recordings (old_profile.jfr β new_profile.jfr). Default preset is profile. Optional preset or settingsFile (.jfc, cwd-relative or absolute)βmutually exclusive. Builtin presets may omit socket/I/O/native/locks; use a custom .jfc for jdk.SocketRead/Write, FileRead/Write, JavaMonitorBlocked, jdk.ThreadPark, NativeMethodSample. Then list_jfr_recordings and stop_profiling.
Inputs: pid (required), duration (required), memorysize, stackdepth, +2 more.
stop_profilingA
Stops an active JFR recording and saves it to recordings/new_profile.jfr. Use recordings/new_profile.jfr for current data, recordings/old_profile.jfr for previous (before/after comparison).
Inputs: pid (required), recordingId (required).
trace_methodA
Builds a call tree for a specific method from a .jfr file. Filters ExecutionSample events to find stack traces containing the given class and method, then aggregates call paths. Use when you want to see who calls a particular method and from where. Limitation: JFR sampling (~10 ms) may miss very fast methods.
Inputs: className (required), methodName (required), filepath, events, +1 more.
vm_infoA
JVM information: uptime, version, and flags. Useful for environment verification.
Inputs: pid (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 26 tools
Each tool targets a specific aspect of Java performance profiling (thread analysis, deadlock, GC, heap, JFR, various profiles). Descriptions clearly differentiate them, even where functionality might seem similar (e.g., analyze_threads vs check_deadlock, heap_histogram vs heap_live_histogram_diff).
All tool names use consistent snake_case with a verb_noun pattern (e.g., list_java_processes, start_profiling, profile_time). The naming is predictable and adheres to a single convention throughout.
26 tools is slightly above the typical 3-15 range but well-justified for the comprehensive domain of Java performance analysis. Each tool serves a distinct purpose, and the count reflects the complexity of the subject without being excessive.
The toolset covers the full lifecycle of performance profiling: discovery, starting/stopping recordings, analyzing CPU, memory, I/O, locks, network, and interpreting results. There are no obvious gaps for local Java process analysis, making it a complete toolkit.
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Official Duck Framework MCP server for AI-assisted development and project scaffolding.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseDqualityDmaintenanceMCP server that provides 8 tools for Java memory leak investigation: \- Class histograms, GC pressure snapshots, JFR recordings, heap dumps, MAT leak suspects analysis, async-profiler allocation profiles \- Structured confidence-based verdicts (none/low/medium/high) requiring independent signal corroboration \- Designed for use inside Claude Code with two slash commands84Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceJava diagnostics MCP server for LLM integration with Alibaba Arthas, enabling analysis and diagnosis of Java applications.58MIT
- AlicenseAqualityDmaintenanceA high-performance MCP server that bridges AI agents with Java codebases, providing professional-grade Java language intelligence via Eclipse JDT.LS.1515 npm3GPL 3.0
- AlicenseAqualityDmaintenanceA Model Context Protocol server that connects AI agents to live Java processes via Alibaba Arthas, enabling real-time diagnostics, debugging, and performance analysis without code changes.25MIT