Table of Contents

Arthas MCP Server

Overview

Arthas MCP Server is an experimental module of Arthas that implements a server based on the MCP (Model Context Protocol)open in new window. This module provides a unified JSON-RPC 2.0 interface through HTTP/Netty, enabling AI assistants to execute Arthas diagnostic commands via tool calls.

MCP (Model Context Protocol) is a standardized protocol proposed by Anthropic for connecting AI assistants with various tools and data sources. Through Arthas MCP Server, AI assistants can naturally execute Java application diagnostic tasks, significantly improving development and operations efficiency.

Key Features

  • AI-Native Integration: Supports mainstream AI clients (Claude Desktop, Cherry Studio, Cline, etc.)
  • Standardized Protocol: Full implementation of MCP protocol specification (version 2025-03-26), supporting Streamable Http transport
  • 26 Diagnostic Tools: Covers core functionalities including JVM monitoring, class loading, method tracing, etc.
  • Security Authentication: Supports Bearer Token authentication mechanism

Supported Diagnostic Tools

Arthas MCP Server integrates 26 core diagnostic tools, categorized by functionality:

ToolDescription
dashboardReal-time JVM/application dashboard with customizable refresh interval and count control
heapdumpGenerate JVM heap dump file, supports --live option to export only live objects
jvmView current JVM detailed information
mbeanView or monitor MBean attributes, supports real-time refresh and pattern matching
memoryView JVM memory information
threadView thread information and stack traces, supports finding blocked and busiest threads
syspropView or modify system properties, supports dynamic JVM system property modification
sysenvView system environment variables
vmoptionView or update VM options, supports dynamic JVM parameter adjustment
perfcounterView Perf Counter information, displays JVM performance counters
vmtoolVM tool collection, supports forced GC, instance retrieval, thread interruption, etc.
getstaticView static field values of a class
ognlExecute OGNL expressions, dynamically invoke methods and access fields

Class/ClassLoader Tools (8)

ToolDescription
scView loaded class information in JVM, supports detailed info and statistics
smView method information of loaded classes, displays method signatures and modifiers
jadDecompile loaded class source code, converts bytecode to Java code
classloaderClassLoader diagnostic tool, view classloader statistics, hierarchy tree, URLs
mcMemory compiler, compiles Java source code to bytecode files
redefineRedefine classes, load external class files to redefine classes in JVM
retransformRetransform classes, triggers class retransformation and bytecode enhancement
dumpDump actual running class bytecode from JVM to specified directory

Monitoring and Diagnostic Tools (6)

ToolDescription
monitorMonitor invocation of specified methods in real-time
stackOutput call path of current method, helps analyze method call chains
traceTrace internal method call paths, output time cost for each node
ttTime tunnel for method execution data, records parameters and return values for each invocation
watchObserve method invocations including parameters, return values, and exceptions

Quick Start

1. Configure MCP Service

Enable MCP service in arthas.properties configuration file:

# MCP (Model Context Protocol) configuration
arthas.mcpEndpoint=/mcp

2. Start Application

Start Arthas or Java application with Arthas normally. By default, MCP service will be exposed on HTTP port 8563.

Verify MCP service is running:

curl http://localhost:8563/mcp

If MCP protocol information is returned, the service has started successfully.

3. Configure AI Client

Configuration examples for mainstream AI clients:

Cherry Studio / Cline

Add MCP server configuration in settings:

{
  "mcpServers": {
    "arthas-mcp": {
      "type": "streamableHttp",
      "url": "http://localhost:8563/mcp"
    }
  }
}

Configuration

Arthas Configuration

PropertyDescriptionDefault
arthas.mcpEndpointMCP service access pathNone (requires manual configuration)
arthas.httpPortHTTP service port8563
arthas.passwordAuthentication password (when authentication enabled)None

Authentication Configuration

When arthas.password is configured in the configuration file, MCP Server will automatically enable authentication. In this case, you need to add an authentication header in the AI client configuration, with the Bearer Token set to the configured password value.

Configuration file example (arthas.properties):

arthas.password=your-secure-password

AI client configuration example:

{
  "mcpServers": {
    "arthas-mcp": {
      "type": "streamableHttp",
      "url": "http://localhost:8563/mcp",
      "headers": {
        "Authorization": "Bearer your-secure-password"
      }
    }
  }
}

WARNING

Note: The token in the Authorization header must exactly match the value configured in arthas.password.

Feedback & Contribution

TIP

Arthas MCP Server is an experimental feature. Feedback and suggestions are welcome!