JProfiler Help

MCP server

The Model Context Protocol (MCP) is an open standard that enables AI agents to interact with external tools and data sources. JProfiler provides an MCP server that allows AI agents to profile Java applications, analyze performance data and inspect heap dumps. With this integration, you can ask an AI agent to find performance hotspots, analyze memory usage or investigate garbage collection issues, and the agent will use JProfiler's profiling capabilities to provide answers.

Supported AI agents

JProfiler's MCP integration supports the following AI agents:

  • Antigravity
    Google's agentic coding tool. Supports global integration.
  • Claude Code
    Anthropic's CLI-based coding agent. Supports both global and project-scoped integration.
  • Claude Desktop
    Anthropic's desktop application. Supports global integration.
  • Codex
    OpenAI's CLI-based coding agent. Supports global integration.
  • Cursor
    An AI-powered code editor. Supports both global and project-scoped integration.
  • Junie
    JetBrains' AI coding agent in IntelliJ IDEA. Requires manual configuration in the IDE under Tools→Junie→MCP Settings.
  • Junie CLI
    JetBrains' CLI-based AI agent. Supports both global and project-scoped integration.
  • OpenCode
    An open-source CLI-based coding agent. Supports both global and project-scoped integration.

The list of supported agents will be extended as more AI agents adopt the MCP standard.

Setting up the integration

To integrate JProfiler with an AI agent, invoke Session→AI Agent Integrations from the main menu. This opens the general settings dialog with the AI agent integration panel.

In the AI agent integration panel, select the desired AI agent from the drop-down. For agents that support project-scoped integration, you can choose between a global and a project-scoped configuration. A global integration makes the JProfiler MCP server available for all projects of the current user, while a project-scoped integration writes the configuration file into the selected project directory, so it is only active for that project. You can perform the integration multiple times for different projects.

Click the Integrate button to perform the integration. JProfiler will update the agent's configuration file to register the JProfiler MCP server. After the integration, the AI agent can discover and use the JProfiler MCP server. The MCP server executable bin/jpmcp is started by the AI agent as needed.

CLI setup

The MCP setup page on the ej-technologies website provides one-line installation scripts that download and configure the MCP server for your AI agent. On macOS and Linux, run:

curl -fsSL https://www.ej-technologies.com/jprofiler/mcp/install.sh | sh

On Windows, run the following command in PowerShell:

irm https://www.ej-technologies.com/jprofiler/mcp/install.ps1 | iex

Manual setup with the npm wrapper

If you prefer to use npm and configure the MCP server manually, you can use the @ej-technologies/jprofiler-mcp npm package. It automatically downloads and provisions JProfiler on first use, so no separate installation is required. It also handles license activation, including the option to start a free evaluation.

Add the following MCP server configuration to the agent's configuration file:

{
  "mcpServers": {
    "JProfiler": {
      "command": "npx",
      "args": ["-y", "@ej-technologies/jprofiler-mcp@latest"]
    }
  }
}

The wrapper downloads JProfiler to the .jprofiler-mcp directory in the user's home directory and verifies the download with a SHA-256 checksum. Subsequent invocations reuse the existing installation.

Capabilities

The JProfiler MCP server bin/jpmcp is a command-line tool that communicates with AI agents via the MCP standard protocol. It requires a valid JProfiler license, just like the JProfiler GUI.

The MCP server can profile Java applications in several ways:

  • Starting processes
    The MCP server can start a Java process with profiling enabled. It provides the required JVM parameter and records data for all configured subsystems.
  • Attaching to local processes
    For already running JVMs, the MCP server can list available Java processes and attach to them by process ID.
  • Attaching to Docker containers
    The MCP server supports attaching to Java processes running in Docker containers, providing the same profiling capabilities as for local processes.

Independently of profiling a live application, existing snapshots can be analyzed:

  • JProfiler snapshots (.jps)
    Full JProfiler snapshots with CPU, memory and probe data. Two snapshots of the same type can be loaded for baseline comparison to detect performance regressions.
  • HPROF snapshots (.hprof)
    Standard Java heap dumps for memory analysis.
  • PHD snapshots (.phd)
    IBM portable heap dump files.
  • JFR recordings (.jfr)
    JDK Flight Recorder files with CPU, probe and object count data.

What you can ask the agent

After a session has been recorded or a snapshot has been loaded, you can ask the AI agent questions about the recorded data in natural language. The agent chooses the appropriate analysis steps itself. The following areas are supported:

  • Performance
    CPU hotspots and call trees with back traces, per-thread attribution and wall clock time analysis. For example: "Why is the checkout endpoint slow?"
  • Memory
    Heap dump analysis with biggest objects, retained sizes, reference chains to GC roots and automatic detection of wasted memory. The agent can also create heap dumps of running JVMs on demand. For example: "What is holding on to memory in this heap dump?"
  • Allocations
    Allocation hotspots and call trees that show where objects are created, including objects that have already been garbage collected. For example: "Why are so many byte arrays allocated?"
  • Probe events
    Individual events from higher-level probes such as JDBC or the HTTP server, for example single SQL statements or HTTP requests with their durations and stack traces. For example: "Which SQL statements are the slowest?"
  • Telemetries
    Time series for heap memory, CPU load, threads, GC activity and other recorded telemetries. For example: "How did the heap usage develop during the load test?"
  • Garbage collection
    Individual garbage collections with their causes, pause times and heap usage before and after each collection. For example: "Why are there such long GC pauses?"
  • Monitors & locks
    Lock contention and deadlock analysis, including the locking history with stack traces. For example: "Which lock are my threads fighting over?"
  • Threads
    Thread dumps and the per-thread time breakdown by thread state. For example: "What are all the threads doing?"
  • MBeans
    Snapshots of JMX MBean attribute values captured from the profiled JVM. For example: "What is the current size of the connection pool?"
  • Slow outliers
    Methods that are occasionally much slower than usual, with inspection of the slowest individual invocations. For example: "Why is this call sometimes a hundred times slower?"

The recorded subsystems and the profiled packages are selected by the AI agent for each session in the recording configuration, so no setup is required when installing the MCP server.

Complex profiling scenarios

Probe-specific settings can be adjusted with the probeConfig key of the advanced recording configuration, for example to change URL splitting of the HTTP server probe or to record prepared statement parameters in the JDBC probe. The attribute names are those of the session configuration in config/jprofiler_config.xsd of the JProfiler installation, the agent can also read them from the jprofiler://config/probes MCP resource.

Session-wide tuning settings, such as the splitting cap for call tree splitting or the sampling frequency, can be set directly as keys of the advanced recording configuration. The reference of all supported settings is served as the jprofiler://config/session MCP resource.

The MCP recording integration works best with simple profiling scenarios. For complex scenarios that require detailed control over profiling settings, such as custom triggers, advanced filter configurations or specialized recording modes, it is recommended to record a JProfiler snapshot (.jps) manually using the JProfiler GUI and then let the AI agent analyze the recorded data.