trackmcp
Back to directory

A powerful Model Context Protocol (MCP) server that enables AI assistants like Claude Desktop to monitor and manage Java applications through JMX. Provides real-time MBean discovery, attribute management, and natural language JMX operations.

10 stars JavaOthers Updated Jun 20, 2026
ai-assistantclaude-desktopjavajava-managementjmxmbeansmcpmodel-context-protocolmodel-context-protocol-serversmonitoringspring-boot

Documentation

JMX MCP Server

Java
Spring Boot
MCP
License

A powerful Model Context Protocol (MCP) server that provides comprehensive JMX monitoring and management capabilities for AI assistants like Claude Desktop. Monitor Java applications, manage MBeans, and perform JMX operations through natural language interactions.

πŸŽ₯ Demo Video

Watch the JMX MCP Server in action! See how Claude Desktop can monitor and manage Java applications through natural language:

https://github.com/user-attachments/assets/722e1885-5aeb-4584-8116-b93324e0abc1

*The demo shows real-time JMX monitoring, MBean exploration, and AI-powered Java application management through Claude Desktop.*

πŸš€ Features

πŸ” Comprehensive JMX Integration

  • Real-time MBean Discovery: Automatically discovers and catalogs all available MBeans
  • Attribute Management: Read and write MBean attributes with full type safety
  • Operation Execution: Execute MBean operations with parameter validation
  • Domain Exploration: Browse and filter MBeans by domain

πŸ€– AI-Powered Monitoring

  • Natural Language Queries: Ask questions like "What's the current heap memory usage?"
  • Intelligent Analysis: AI can correlate metrics and identify performance issues
  • Automated Insights: Get recommendations based on JMX data patterns

πŸ›‘οΈ Enterprise-Ready

  • Security Validation: Built-in security controls and access validation
  • Connection Management: Robust local and remote JMX connection handling
  • Error Handling: Comprehensive error handling and recovery mechanisms
  • Production Logging: Configurable logging for different environments

πŸ”Œ MCP Protocol Compliance

  • Tools: 12 JMX management tools for AI interaction
  • Resources: All JMX attributes exposed as discoverable resources
  • STDIO Transport: Optimized for Claude Desktop integration
  • JSON-RPC 2.0: Full protocol compliance for reliable communication

πŸ“‹ Prerequisites

  • Java 17+ (OpenJDK or Oracle JDK)
  • Maven 3.6+ for building
  • Claude Desktop or any MCP-compatible AI client

πŸ› οΈ Quick Start

1. Clone and Build

bash
git clone https://github.com/itz4blitz/JMX-MCP.git
cd JMX-MCP
mvn clean package

2. Test the Server

bash
# Test with comprehensive validation
python3 comprehensive-test.py

3. Configure Claude Desktop

Add to your Claude Desktop MCP configuration file:

Location:

  • macOS: `~/.config/claude/mcp_servers.json`
  • Windows: `%APPDATA%\Claude\mcp_servers.json`

Configuration:

json
{
  "mcpServers": {
    "jmx-mcp-server": {
      "command": "java",
      "args": [
        "-Xmx512m",
        "-Xms256m",
        "-Dspring.profiles.active=stdio",
        "-Dspring.main.banner-mode=off",
        "-Dlogging.level.root=OFF",
        "-Dspring.main.log-startup-info=false",
        "-jar",
        "/path/to/your/jmx-mcp-server-1.0.0.jar"
      ],
      "env": {
        "JAVA_OPTS": "-Djava.awt.headless=true"
      }
    }
  }
}

4. Start Using with Claude

Restart Claude Desktop and try these queries:

code
"What JMX tools are available?"
"Show me the current heap memory usage"
"List all MBean domains"
"What's the garbage collection performance?"

πŸ”§ Available Tools (12 Total)

Core JMX Operations

ToolDescriptionExample Usage
`listMBeans`List all discovered MBeans with optional domain filtering"Show me all memory-related MBeans"
`getMBeanInfo`Get detailed information about a specific MBean"Tell me about the Runtime MBean"
`getAttribute`Read the value of an MBean attribute"What's the current heap memory usage?"
`setAttribute`Set the value of a writable MBean attribute"Set the log level to DEBUG"
`listDomains`List all available MBean domains"What domains are available?"

Connection Management

ToolDescriptionExample Usage
`listJmxConnections`List all configured JMX connections"Show me all available connections"
`addJmxConnection`Add a new JMX connection"Connect to the production server"
`removeJmxConnection`Remove a JMX connection"Remove the old test connection"
`switchJmxConnection`Switch to a different JMX connection"Switch to the staging environment"
`getConnectionInfo`Get current JMX connection status and statistics"Is the JMX connection healthy?"

Service Discovery

ToolDescriptionExample Usage
`discoverJmxServices`Discover JMX-enabled Java applications on the system"Find all Java apps with JMX enabled"
`autoRegisterDiscoveredConnections`Automatically register discovered JMX services"Auto-connect to all discovered Java apps"

πŸ“Š Available Resources

The server automatically exposes all JMX attributes as MCP resources, making them discoverable and accessible to AI assistants:

  • Memory Metrics: Heap usage, non-heap usage, memory pools
  • Garbage Collection: GC statistics, collection times, collection counts
  • Threading: Thread counts, deadlock detection, thread states
  • Runtime Information: JVM uptime, start time, system properties
  • Class Loading: Loaded classes, unloaded classes, class path
  • Operating System: CPU usage, system load, available processors

Resource URI Format:

code
jmx://domain:type=Type,name=Name/attributes/AttributeName

Example Resources:

code
jmx://java.lang:type=Memory/attributes/HeapMemoryUsage
jmx://java.lang:type=Runtime/attributes/Uptime
jmx://java.lang:type=GarbageCollector,name=G1_Young_Generation/attributes/CollectionCount

πŸ’¬ Example Interactions

Memory Monitoring

code
User: "What's the current memory situation?"
Claude: I'll check the JMX memory metrics for you.

[Uses getAttribute tool to read HeapMemoryUsage]

The current heap memory usage is:
- Used: 245 MB
- Committed: 512 MB  
- Max: 2048 MB
- Usage: 12% of maximum heap

The application is running efficiently with low memory pressure.

Performance Analysis

code
User: "Are there any performance issues?"
Claude: Let me analyze the JMX performance metrics.

[Uses multiple tools to check GC, threads, and memory]

Performance analysis:
βœ… Memory: Healthy (12% heap usage)
βœ… GC: Efficient (avg 15ms collection time)
⚠️  Threads: High count (245 threads) - consider investigation
βœ… CPU: Normal load

Recommendation: Monitor thread creation patterns.

πŸ—οΈ Architecture

code
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Claude AI     │◄──►│  JMX MCP Server  │◄──►│  Java App JMX   β”‚
β”‚                 β”‚    β”‚                  β”‚    β”‚                 β”‚
β”‚ Natural Languageβ”‚    β”‚ β€’ Tools (12)     β”‚    β”‚ β€’ MBeans        β”‚
β”‚ Queries         β”‚    β”‚ β€’ Resources(224+)β”‚    β”‚ β€’ Attributes    β”‚
β”‚                 β”‚    β”‚ β€’ JSON-RPC 2.0   β”‚    β”‚ β€’ Operations    β”‚
β”‚                 β”‚    β”‚ β€’ Multi-Connect  β”‚    β”‚ β€’ Discovery     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

  • JMXConnectionManager: Manages local and remote JMX connections
  • MBeanDiscoveryService: Discovers and catalogs available MBeans
  • JmxService: Provides @Tool-annotated methods for AI interaction
  • JMXToMCPMapper: Maps JMX attributes to MCP resources
  • JmxSecurityValidator: Validates operations for security compliance

βš™οΈ Configuration Profiles

Default Profile

Standard configuration with full logging for development and debugging.

STDIO Profile

Optimized for Claude Desktop integration:

  • Silent Operation: No console output to avoid JSON-RPC interference
  • Minimal Logging: Error-only logging to prevent file system issues
  • Fast Startup: Optimized initialization for quick AI responses

πŸ§ͺ Testing

Comprehensive Test Suite

bash
# Run the comprehensive integration test
python3 comprehensive-test.py

Test Coverage:

  • βœ… MCP Protocol compliance
  • βœ… JSON-RPC 2.0 communication
  • βœ… All 12 tools registration and execution
  • βœ… Multi-connection management
  • βœ… Service discovery and auto-registration
  • βœ… Resource discovery and access
  • βœ… Error handling and recovery

Unit Tests

bash
mvn test

πŸ”’ Security

Built-in Security Features

  • ObjectName Validation: Prevents access to sensitive MBeans
  • Operation Filtering: Restricts dangerous operations
  • Type Safety: Validates attribute types before operations
  • Access Control: Configurable security policies

Security Configuration

yaml
jmx:
  security:
    enabled: true
    allowed-domains:
      - "java.lang"
      - "java.nio"
      - "com.myapp"
    blocked-operations:
      - "shutdown"
      - "restart"

πŸš€ Deployment

Local Development

bash
java -jar target/jmx-mcp-server-1.0.0.jar

Production Deployment

bash
java -Xmx1g -Xms512m \
     -Dspring.profiles.active=production \
     -jar jmx-mcp-server-1.0.0.jar

Docker Deployment

dockerfile
FROM openjdk:17-jre-slim
COPY target/jmx-mcp-server-1.0.0.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

1. Fork the repository

2. Create a feature branch

3. Make your changes

4. Add tests for new functionality

5. Ensure all tests pass

6. Submit a pull request

Code Style

  • Follow Java coding conventions
  • Use meaningful variable and method names
  • Add comprehensive JavaDoc comments
  • Maintain test coverage above 80%

πŸ“š Documentation

πŸ› Troubleshooting

Common Issues

Server won't start with Claude Desktop:

  • Verify Java 17+ is installed
  • Check the JAR path in configuration
  • Ensure STDIO profile is active

No tools/resources visible:

  • Restart Claude Desktop after configuration changes
  • Check server logs for errors
  • Verify MCP protocol compliance

Connection issues:

  • Confirm JMX is enabled on target application
  • Check network connectivity for remote connections
  • Validate security settings

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

bash
# Fork the repository on GitHub
git clone https://github.com/YOUR_USERNAME/JMX-MCP.git
cd JMX-MCP

# Build and test
mvn clean compile
mvn test

# Run the application
mvn spring-boot:run

Ways to Contribute

  • πŸ› Report bugs - Help us identify and fix issues
  • πŸ’‘ Suggest features - Share ideas for new functionality
  • πŸ“ Improve documentation - Help others understand the project
  • πŸ”§ Submit code - Fix bugs or implement new features
  • πŸ§ͺ Write tests - Improve test coverage and reliability
  • 🎨 UI/UX improvements - Enhance user experience

Community

  • GitHub Discussions: Ask questions and share ideas
  • Issues: Report bugs and request features
  • Pull Requests: Contribute code improvements
  • Wiki: Collaborative documentation

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Spring AI Team for the excellent MCP framework
  • Model Context Protocol for the standardized AI integration protocol
  • Anthropic for Claude Desktop and AI assistant capabilities
  • OpenJDK Community for the robust Java platform

πŸ“ž Support


Made with ❀️ for the AI and Java communities

Frequently asked questions

What is JMX-MCP?

JMX-MCP is A powerful Model Context Protocol (MCP) server that enables AI assistants like Claude Desktop to monitor and manage Java applications through JMX. Provides real-time MBean discovery, attribute management, and natural language JMX operations.

How do I install JMX-MCP?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is JMX-MCP open source?

Yes β€” it is hosted on GitHub at https://github.com/itz4blitz/JMX-MCP and has 10 stars.

Related MCP tools

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP