English | 中文 A lightweight JVM monitoring and diagnostic MCP (Multi-Agent Communication Protocol) server implementation based on native JDK tools. Provides AI agents with powerful capabilities to monitor and analyze Java applications without requiring third-party tools like Arthas. - Zero Dependencies: Uses only native JDK tools (jps, jstack, jmap, etc.) - Lightweight: Minimal resource consumption
Add this skill
npx mdskills install xzq-xu/jvm-mcp-serverComprehensive JVM monitoring MCP server with extensive toolset and excellent documentation
1# JVM MCP Server23<p align="center">4 <img src="https://img.shields.io/badge/Python-3.6+-blue.svg" alt="Python Version">5 <img src="https://img.shields.io/badge/JDK-8+-green.svg" alt="JDK Version">6 <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">7</p>89[English](README.md) | [中文](README_zh.md)1011[](https://mseep.ai/app/xzq-xu-jvm-mcp-server)121314A lightweight JVM monitoring and diagnostic MCP (Multi-Agent Communication Protocol) server implementation based on native JDK tools. Provides AI agents with powerful capabilities to monitor and analyze Java applications without requiring third-party tools like Arthas.1516<a href="https://glama.ai/mcp/servers/@xzq-xu/jvm-mcp-server">17 <img width="380" height="200" src="https://glama.ai/mcp/servers/@xzq-xu/jvm-mcp-server/badge" alt="JVM Server MCP server" />18</a>1920## Features2122- **Zero Dependencies**: Uses only native JDK tools (jps, jstack, jmap, etc.)23- **Lightweight**: Minimal resource consumption compared to agent-based solutions24- **High Compatibility**: Works with all Java versions and platforms25- **Non-Intrusive**: No modifications to target applications required26- **Secure**: Uses only JDK certified tools and commands27- **Remote Monitoring**: Support for both local and remote JVM monitoring via SSH2829## Core Capabilities3031### Basic Monitoring32- Java process listing and identification33- JVM basic information retrieval34- Memory usage monitoring35- Thread information and stack trace analysis36- Class loading statistics37- Detailed class structure information3839### Advanced Features40- Method call path analysis41- Class decompilation42- Method search and inspection43- Method invocation monitoring44- Logger level management45- System resource dashboard4647## System Requirements4849- Python 3.6+50- JDK 8+51- Linux/Unix/Windows OS52- SSH access (for remote monitoring)5354## Installation5556### Using uv (Recommended)5758```bash59# Install uv if not already installed60curl -LsSf https://astral.sh/uv/install.sh | sh # Linux/macOS61# or62powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows6364# Install the package65uv pip install jvm-mcp-server66```6768### Using pip6970```bash71pip install jvm-mcp-server72```7374### From Source7576```bash77# Clone the repository78git clone https://github.com/your-repo/jvm-mcp-server.git79cd jvm-mcp-server8081# Using uv (recommended)82uv venv # Create virtual environment83uv sync # Install dependencies8485# Or install in development mode86uv pip install -e .87```8889## Quick Start9091### Starting the Server9293#### Using uv (Recommended)9495```bash96# Local mode97uv run jvm-mcp-server9899# Using environment variables file for remote mode100uv run --env-file .env jvm-mcp-server101102# In specific directory103uv --directory /path/to/project run --env-file .env jvm-mcp-server104```105106#### Using uvx107108```bash109# Local mode110uvx run jvm-mcp-server111112# With environment variables113uvx run --env-file .env jvm-mcp-server114```115116#### Using Python directly117118```python119from jvm_mcp_server import JvmMcpServer120121# Local mode122server = JvmMcpServer()123server.run()124125# Remote mode (via environment variables)126# Set SSH_HOST, SSH_PORT, SSH_USER, SSH_PASSWORD or SSH_KEY127import os128os.environ['SSH_HOST'] = 'user@remote-host'129os.environ['SSH_PORT'] = '22'130server = JvmMcpServer()131server.run()132```133134### Using with MCP Configuration135136```json137{138 "mcpServers": {139 "jvm-mcp-server": {140 "command": "uv",141 "args": [142 "--directory",143 "/path/to/jvm-mcp-server",144 "run",145 "--env-file",146 "/path/to/jvm-mcp-server/.env",147 "jvm-mcp-server"148 ]149 }150 }151}152```153154## Available Tools155156JVM-MCP-Server provides a comprehensive set of tools for JVM monitoring and diagnostics:157158- `list_java_processes`: List all Java processes159- `get_thread_info`: Get thread information for a specific process160- `get_jvm_info`: Get JVM basic information161- `get_memory_info`: Get memory usage information162- `get_stack_trace`: Get thread stack trace information163- `get_class_info`: Get detailed class information including structure164- `get_stack_trace_by_method`: Get method call path165- `decompile_class`: Decompile class source code166- `search_method`: Search for methods in classes167- `watch_method`: Monitor method invocations168- `get_logger_info`: Get logger information169- `set_logger_level`: Set logger levels170- `get_dashboard`: Get system resource dashboard171- `get_jcmd_output`: Execute JDK jcmd commands172- `get_jstat_output`: Execute JDK jstat commands173174For detailed documentation on each tool, see [Available Tools](./doc/available_tools.md).175176## Architecture177178JVM-MCP-Server is built on a modular architecture:1791801. **Command Layer**: Wraps JDK native commands1812. **Executor Layer**: Handles local and remote command execution1823. **Formatter Layer**: Processes and formats command output1834. **MCP Interface**: Exposes functionality through FastMCP protocol184185### Key Components186187- `BaseCommand`: Abstract base class for all commands188- `CommandExecutor`: Interface for command execution (local and remote)189- `OutputFormatter`: Interface for formatting command output190- `JvmMcpServer`: Main server class that registers all tools191192## Development Status193194The project is in active development. See [Native_TODO.md](Native_TODO.md) for current progress.195196### Completed197- Core architecture and command framework198- Basic commands implementation (jps, jstack, jmap, jinfo, jcmd, jstat)199- Class information retrieval system200- MCP tool parameter type compatibility fixes201202### In Progress203- Caching mechanism204- Method tracing205- Performance monitoring206- Error handling improvements207208## Contributing209210Contributions are welcome! Please feel free to submit a Pull Request.2112121. Fork the repository2132. Create your feature branch (`git checkout -b feature/amazing-feature`)2143. Commit your changes (`git commit -m 'Add some amazing feature'`)2154. Push to the branch (`git push origin feature/amazing-feature`)2165. Open a Pull Request217218## License219220This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.221222## Acknowledgements223224- JDK tools documentation225- FastMCP protocol specification226- Contributors and testers227
Full transparency — inspect the skill content before installing.