Skip to content
Back to search

jvm-mcp-server

This is an implementation project of a JVM-based MCP (Model Context Protocol) server. The project aims to provide a standardized MCP server implementation for the JVM platform, enabling AI models to better interact with the Java ecosystem.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/xzq-xu--jvm-mcp-server/badge.svg)](/listings/xzq-xu--jvm-mcp-server)

HTML

<a href="/listings/xzq-xu--jvm-mcp-server"><img src="/api/listings/xzq-xu--jvm-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Using uv (Recommended)

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh  # Linux/macOS
# or
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"  # Windows

# Install the package
uv pip install jvm-mcp-server

Using pip

pip install jvm-mcp-server

From Source

# Clone the repository
git clone https://github.com/your-repo/jvm-mcp-server.git
cd jvm-mcp-server

# Using uv (recommended)
uv venv  # Create virtual environment
uv sync  # Install dependencies

# Or install in development mode
uv pip install -e .

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 256 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # JVM MCP Server
  2. <p align="center">
  3. <img src="https://img.shields.io/badge/Python-3.6+-blue.svg" alt="Python Version">
  4. <img src="https://img.shields.io/badge/JDK-8+-green.svg" alt="JDK Version">
  5. <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
  6. </p>
  7. [English](README.md) | [中文](README_zh.md)
  8. [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/xzq-xu-jvm-mcp-server-badge.png)](https://mseep.ai/app/xzq-xu-jvm-mcp-server)
  9. 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.
  10. <a href="https://glama.ai/mcp/servers/@xzq-xu/jvm-mcp-server">
  11. <img width="380" height="200" src="https://glama.ai/mcp/servers/@xzq-xu/jvm-mcp-server/badge" alt="JVM Server MCP server" />
  12. </a>
  13. ## Hosted deployment
  14. A hosted deployment is available on [Fronteir AI](https://fronteir.ai/mcp/xzq-xu-jvm-mcp-server).
  15. ## Features
  16. - **Zero Dependencies**: Uses only native JDK tools (jps, jstack, jmap, etc.)
  17. - **Lightweight**: Minimal resource consumption compared to agent-based solutions
  18. - **High Compatibility**: Works with all Java versions and platforms
  19. - **Non-Intrusive**: No modifications to target applications required
  20. - **Secure**: Uses only JDK certified tools and commands
  21. - **Remote Monitoring**: Support for both local and remote JVM monitoring via SSH
  22. ## Core Capabilities
  23. ### Basic Monitoring
  24. - Java process listing and identification
  25. - JVM basic information retrieval
  26. - Memory usage monitoring
  27. - Thread information and stack trace analysis
  28. - Class loading statistics
  29. - Detailed class structure information
  30. ### Advanced Features
  31. - Method call path analysis
  32. - Class decompilation
  33. - Method search and inspection
  34. - Method invocation monitoring
  35. - Logger level management
  36. - System resource dashboard
  37. ## System Requirements
  38. - Python 3.6+
  39. - JDK 8+
  40. - Linux/Unix/Windows OS
  41. - SSH access (for remote monitoring)
  42. ## Installation
  43. ### Using uv (Recommended)
  44. ```bash
  45. # Install uv if not already installed
  46. curl -LsSf https://astral.sh/uv/install.sh | sh # Linux/macOS
  47. # or
  48. powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
  49. # Install the package
  50. uv pip install jvm-mcp-server
  51. ```
  52. ### Using pip
  53. ```bash
  54. pip install jvm-mcp-server
  55. ```
  56. ### From Source
  57. ```bash
  58. # Clone the repository
  59. git clone https://github.com/your-repo/jvm-mcp-server.git
  60. cd jvm-mcp-server
  61. # Using uv (recommended)
  62. uv venv # Create virtual environment
  63. uv sync # Install dependencies
  64. # Or install in development mode
  65. uv pip install -e .
  66. ```
  67. ## Quick Start
  68. ### Starting the Server
  69. #### Using uv (Recommended)
  70. ```bash
  71. # Local mode
  72. uv run jvm-mcp-server
  73. # Using environment variables file for remote mode
  74. uv run --env-file .env jvm-mcp-server
  75. # In specific directory
  76. uv --directory /path/to/project run --env-file .env jvm-mcp-server
  77. ```
  78. #### Using uvx
  79. ```bash
  80. # Local mode
  81. uvx run jvm-mcp-server
  82. # With environment variables
  83. uvx run --env-file .env jvm-mcp-server
  84. ```
  85. #### Using Python directly
  86. ```python
  87. from jvm_mcp_server import JvmMcpServer
  88. # Local mode
  89. server = JvmMcpServer()
  90. server.run()
  91. # Remote mode (via environment variables)
  92. # Set SSH_HOST, SSH_PORT, SSH_USER, SSH_PASSWORD or SSH_KEY
  93. import os
  94. os.environ['SSH_HOST'] = 'user@remote-host'
  95. os.environ['SSH_PORT'] = '22'
  96. server = JvmMcpServer()
  97. server.run()
  98. ```
  99. ### Using with MCP Configuration
  100. ```json
  101. {
  102. "mcpServers": {
  103. "jvm-mcp-server": {
  104. "command": "uv",
  105. "args": [
  106. "--directory",
  107. "/path/to/jvm-mcp-server",
  108. "run",
  109. "--env-file",
  110. "/path/to/jvm-mcp-server/.env",
  111. "jvm-mcp-server"
  112. ]
  113. }
  114. }
  115. }
  116. ```
  117. ## Available Tools
  118. JVM-MCP-Server provides a comprehensive set of tools for JVM monitoring and diagnostics:
  119. - `list_java_processes`: List all Java processes
  120. - `get_thread_info`: Get thread information for a specific process
  121. - `get_jvm_info`: Get JVM basic information
  122. - `get_memory_info`: Get memory usage information
  123. - `get_stack_trace`: Get thread stack trace information
  124. - `get_class_info`: Get detailed class information including structure
  125. - `get_stack_trace_by_method`: Get method call path
  126. - `decompile_class`: Decompile class source code
  127. - `search_method`: Search for methods in classes
  128. - `watch_method`: Monitor method invocations
  129. - `get_logger_info`: Get logger information
  130. - `set_logger_level`: Set logger levels
  131. - `get_dashboard`: Get system resource dashboard
  132. - `get_jcmd_output`: Execute JDK jcmd commands
  133. - `get_jstat_output`: Execute JDK jstat commands
  134. For detailed documentation on each tool, see [Available Tools](./doc/available_tools.md).
  135. ## Architecture
  136. JVM-MCP-Server is built on a modular architecture:
  137. 1. **Command Layer**: Wraps JDK native commands
  138. 2. **Executor Layer**: Handles local and remote command execution
  139. 3. **Formatter Layer**: Processes and formats command output
  140. 4. **MCP Interface**: Exposes functionality through FastMCP protocol
  141. ### Key Components
  142. - `BaseCommand`: Abstract base class for all commands
  143. - `CommandExecutor`: Interface for command execution (local and remote)
  144. - `OutputFormatter`: Interface for formatting command output
  145. - `JvmMcpServer`: Main server class that registers all tools
  146. ## Development Status
  147. The project is in active development. See [Native_TODO.md](Native_TODO.md) for current progress.
  148. ### Completed
  149. - Core architecture and command framework
  150. - Basic commands implementation (jps, jstack, jmap, jinfo, jcmd, jstat)
  151. - Class information retrieval system
  152. - MCP tool parameter type compatibility fixes
  153. ### In Progress
  154. - Caching mechanism
  155. - Method tracing
  156. - Performance monitoring
  157. - Error handling improvements
  158. ## Contributing
  159. Contributions are welcome! Please feel free to submit a Pull Request.
  160. 1. Fork the repository
  161. 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
  162. 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
  163. 4. Push to the branch (`git push origin feature/amazing-feature`)
  164. 5. Open a Pull Request
  165. ## License
  166. This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
  167. NP|## Acknowledgements
  168. #MH|
  169. #TK|- JDK tools documentation
  170. #WY|- FastMCP protocol specification
  171. #JK|- Contributors and testers
  172. #BP|
  173. #KG|## Permission Requirements
  174. #YM|
  175. #KB|Some JVM diagnostic commands (jstack, jmap, jinfo, jcmd, etc.) require sufficient permissions to attach to the target JVM process. If you encounter permission errors, try the following solutions:
  176. #YB|
  177. #KB|### Common Errors
  178. #RR|
  179. #KB|- `Permission denied`: Insufficient permissions
  180. #YZ|- `Unable to open socket file`: Cannot connect to JVM process
  181. #KD|- `No such process`: Process does not exist or has exited
  182. #MH|
  183. #KB|### Solutions
  184. #BR|
  185. #KB|1. **Run with sudo** (recommended): `sudo uv run jvm-mcp-server`
  186. #XZ|2. **Run as the same user as target Java process**: Check the user ID of the Java process and run as that user
  187. #HM|3. **Add experimental attach permission to JDK**: Add to JVM startup arguments:
  188. # ```
  189. # -XX:+AllowRedefinitionToAddDeleteMethods
  190. # ```
  191. #XQ|4. **In Docker**: Ensure the container has sufficient permissions (--privileged or mount /proc)
  192. #KB|
  193. #KB|Note: `list_java_processes` uses the jps command and does not require special permissions. Other commands may need to be configured according to the solutions above.
  194. - JDK tools documentation
  195. - FastMCP protocol specification
  196. - Contributors and testers

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.