arthas-mcp
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., "@arthas-mcp What's causing the high CPU usage?"
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.
arthas-mcp
Let AI agents diagnose live JVMs. An MCP server that connects Claude (or any MCP client) to Alibaba Arthas, the battle-tested Java diagnostics tool — no restarts, no code changes, no redeploy.
Ask your AI things like:
"Why is this service burning 200% CPU?" → it pulls the dashboard, finds the hottest threads, reads their stacks, and tells you which method is spinning.
"What arguments is
OrderService.createOrderactually receiving in production?" → it sets up awatch, captures live invocations, and shows you real params and return values."Is the deployed class the version we think it is?" → it decompiles the loaded bytecode with
jadand diffs it against your source.
How it works
Claude / MCP client ──stdio──▶ arthas-mcp ──HTTP──▶ Arthas (sync commands)
──WebSocket──▶ Arthas (streaming: watch/trace/monitor)
│
▼
target JVMSync commands (dashboard, thread, jad, …) go over Arthas' HTTP API and return directly. Streaming commands (watch, trace, stack, monitor, tt -t) run as background jobs over WebSocket: output streams to a local log file, the tool waits up to awaitMs (default 5s) and returns results inline if the command finished — otherwise it hands back a job ID you can poll with arthas_read_log and cancel with arthas_stop_job. Long captures never block the conversation and never flood the context window (every response is capped, ~16k chars, configurable).
Related MCP server: Arthas MCP Server
Quick start
1. Attach Arthas to your Java process
curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar # pick the target JVM from the listThat's it — Arthas serves its HTTP/WebSocket API on 127.0.0.1:8563 by default, which is exactly where arthas-mcp looks.
2. Add the MCP server
Claude Code
claude mcp add arthas -- npx -y arthas-mcpClaude Desktop / Windsurf / Cursor (mcpServers config):
{
"mcpServers": {
"arthas": {
"command": "npx",
"args": ["-y", "arthas-mcp"],
"env": {
"ARTHAS_WS_URL": "ws://127.0.0.1:8563/ws"
}
}
}
}env is optional if Arthas runs on the default port.
3. Ask questions
Open your client and ask anything about the running JVM. The AI picks the right Arthas commands by itself.
Diagnosing a JVM in Kubernetes
Arthas must run inside the pod; then port-forward its API port:
# copy + attach arthas inside the pod (or bake it into your image)
kubectl exec -it <pod> -- sh -c 'curl -sO https://arthas.aliyun.com/arthas-boot.jar && java -jar arthas-boot.jar 1 --target-ip 0.0.0.0'
# expose the HTTP/WS API locally
kubectl port-forward <pod> 8563:8563arthas-mcp on your laptop now talks to the JVM in the cluster.
Tools
Tool | What it does |
| Start here for a symptom — proven step-by-step recipes (high CPU, memory leak, slow requests, worker-pool exhaustion, deadlocks, HikariCP, Spring, flame graphs). Human-readable copy: COOKBOOK.md |
| Threads / memory / GC / runtime overview |
| Thread list, top-N CPU, blocking threads, per-thread stacks |
| JVM info and detailed memory breakdown |
| Search loaded classes / methods |
| Decompile a loaded class (see what's actually deployed) |
| Capture live method params / return values / exceptions ⏳ |
| Call-path timing — find the slow hop ⏳ |
| Who calls this method, live ⏳ |
| Invocation stats: QPS, RT, failure rate ⏳ |
| Time Tunnel: record invocations, replay them later ⏳ (record mode) |
| Evaluate OGNL / read static fields |
| Classloader hierarchy and leaks |
| async-profiler: CPU / alloc / lock flame graphs |
| Dump the heap to a file |
| Escape hatch: run any raw Arthas command |
| Manage background jobs ⏳ |
| Repoint to another Arthas instance mid-session |
| Meta |
⏳ = streaming command, runs as a background job (see How it works).
Configuration
Env var / flag | Default | Meaning |
|
| Arthas WebSocket endpoint (HTTP API URL is derived) |
| derived | Alternative: give the HTTP API URL instead |
|
| Per-response character cap before truncation |
| — | CLI override, takes precedence over env |
Background-job logs live under $TMPDIR/arthas-mcp-logs/.
Security
Arthas is a full-power diagnostics tool: ognl evaluates arbitrary expressions inside the target JVM, and arthas_exec runs any Arthas command. Only point arthas-mcp at JVMs you are authorized to debug, keep the Arthas port bound to localhost (or reached via kubectl port-forward / SSH tunnel), and never expose 8563 to untrusted networks.
Development
git clone https://github.com/HeavenC/arthas-mcp.git
cd arthas-mcp
npm install
npm run build # tsc → dist/
node dist/index.js # speaks MCP on stdioThe whole server is a single file: src/index.ts.
License
Available Tools
25 toolsarthas_async_jobsA
List all async background jobs (watch/trace/stack/monitor). Shows job ID, command, status, log file path, and elapsed time.
Inputs: cleanup.
arthas_classloaderC
Show classloader hierarchy and info.
Inputs: all, list, tree, timeout, +1 more.
arthas_cookbookA
Get a proven step-by-step Arthas command recipe for a common production symptom (high CPU, memory leak, slow requests, worker pool exhaustion, deadlocks, connection pool, Spring inspection, ...). START HERE when diagnosing a symptom instead of composing commands from scratch. Call without arguments to list topics.
Inputs: topic.
arthas_dashboardC
Get a comprehensive dashboard showing thread stats, memory usage, GC info, and runtime data.
Inputs: timeout.
arthas_execA
Execute an Arthas command and return the result. For sync commands (dashboard, thread, jvm, sc, sm, jad, ognl, etc.) returns result directly. For streaming commands (watch, trace, stack, monitor) runs in background and returns a job ID + log file path.
Inputs: command (required), timeout.
arthas_getstaticC
Get static field values.
Inputs: className (required), fieldName (required), timeout.
arthas_heapdumpB
Create a heap dump file.
Inputs: live, timeout, filename.
arthas_helpB
Get help for Arthas commands.
Inputs: command, timeout.
arthas_jadC
Decompile a loaded class.
Inputs: classPattern (required), timeout, methodPattern.
arthas_jvmC
Get JVM information including memory usage, GC stats, runtime info.
Inputs: timeout.
arthas_memoryC
Get detailed memory information.
Inputs: timeout.
arthas_monitorA
Monitor method invocation statistics. Runs in background; waits up to awaitMs for completion and returns results inline if done, otherwise returns a job ID.
Inputs: classPattern (required), methodPattern (required), count, cycle, +2 more.
arthas_ognlC
Execute OGNL expressions.
Inputs: express (required), timeout, classLoaderHash.
arthas_profilerC
Start/stop async profiler for CPU or memory profiling.
Inputs: event, action, timeout, duration, +1 more.
arthas_read_logA
Read the output log of an async job. Use this to check results from watch/trace/stack/monitor commands. Returns the tail by default to keep responses small.
Inputs: jobId (required), tail.
arthas_scC
Search for loaded classes.
Inputs: classPattern (required), timeout, detailed.
arthas_set_configC
Update Arthas connection configuration.
Inputs: wsUrl, httpUrl, defaultTimeout.
arthas_smC
Search for methods in loaded classes.
Inputs: classPattern (required), timeout, detailed, methodPattern.
arthas_stackA
Get the call stack of a method. Runs in background; waits up to awaitMs for completion and returns results inline if done, otherwise returns a job ID.
Inputs: classPattern (required), methodPattern (required), count, awaitMs, +2 more.
arthas_stop_jobA
Stop a running async job (watch/trace/stack/monitor).
Inputs: jobId (required).
arthas_threadC
Get thread information. Shows thread stack traces, CPU usage, and thread states.
Inputs: topN, state, blocked, timeout, +1 more.
arthas_traceA
Trace method execution path and timing. Runs in background; waits up to awaitMs for completion and returns results inline if done, otherwise returns a job ID.
Inputs: classPattern (required), methodPattern (required), count, awaitMs, +3 more.
arthas_ttC
Time Tunnel: Record method invocations for replay. Record mode (record=true) is ASYNC.
Inputs: list, count, depth, record, +4 more.
arthas_versionB
Get Arthas version information.
Inputs: timeout.
arthas_watchA
Watch method execution. Runs in background; waits up to awaitMs for completion and returns results inline if done, otherwise returns a job ID. Use arthas_read_log to check output later, arthas_stop_job to stop.
Inputs: classPattern (required), methodPattern (required), count, depth, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 25 tools
Each tool has a distinctly described purpose. While some tools (e.g., watch, trace, stack, monitor) overlap in monitoring methods, their descriptions clearly differentiate them (watch for watching parameters/return, trace for timing, stack for call stack, monitor for stats). No ambiguity remains.
All tool names follow the consistent pattern `arthas_<verb_or_noun>`, using snake_case throughout. The prefix is uniform, making the set predictable and easy to navigate.
With 25 tools, the server covers the essential Arthas diagnostic commands without being overwhelming. Each tool serves a specific purpose, and the count balances comprehensiveness with usability.
The tool set covers all major Arthas capabilities: class inspection, method tracing, thread analysis, JVM info, profiling, heap dump, OGNL, async job management, and a cookbook. There are no obvious gaps for common diagnostic tasks.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for building and testing AI agents with multi-model experimentation and insights.
A Model Context Protocol server for Wix AI tools
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enhances AI agents by providing deep semantic understanding of codebases, enabling more intelligent interactions through advanced code search and contextual awareness.91MIT- AlicenseNot gradedqualityNot gradedmaintenanceJava diagnostics MCP server for LLM integration with Alibaba Arthas, enabling analysis and diagnosis of Java applications.58MIT
- AlicenseAqualityCmaintenanceMCP 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.2664 npm10MIT
- AlicenseNot gradedqualityAmaintenanceA source-aware MCP server that connects AI agents to browser and server runtimes, enabling real-time debugging, monitoring, and automatic fixes via WebSocket or HTTP.2MIT