Logo de JMX MCP Server

JMX MCP Server

Comunidade
itz4blitz

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.

Publicado poritz4blitz
RepositórioJMX-MCP
IdiomaJava
Forks
3
Estrelas
10
Ferramentas disponíveis
0
Tipo de transportestdio
Categorias
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    JMX MCP Server disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 0 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    10 estrelas e 3 forks no repositório vinculado.

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:

"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
listMBeansList all discovered MBeans with optional domain filtering"Show me all memory-related MBeans"
getMBeanInfoGet detailed information about a specific MBean"Tell me about the Runtime MBean"
getAttributeRead the value of an MBean attribute"What's the current heap memory usage?"
setAttributeSet the value of a writable MBean attribute"Set the log level to DEBUG"
listDomainsList all available MBean domains"What domains are available?"

Connection Management

ToolDescriptionExample Usage
listJmxConnectionsList all configured JMX connections"Show me all available connections"
addJmxConnectionAdd a new JMX connection"Connect to the production server"
removeJmxConnectionRemove a JMX connection"Remove the old test connection"
switchJmxConnectionSwitch to a different JMX connection"Switch to the staging environment"
getConnectionInfoGet current JMX connection status and statistics"Is the JMX connection healthy?"

Service Discovery

ToolDescriptionExample Usage
discoverJmxServicesDiscover JMX-enabled Java applications on the system"Find all Java apps with JMX enabled"
autoRegisterDiscoveredConnectionsAutomatically 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:

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

Example Resources:

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

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

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

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   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

Use o MCP de JMX MCP Server com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar JMX MCP Server, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione JMX MCP Server como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de JMX MCP Server.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "jmx-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de JMX MCP Server, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de JMX MCP Server.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar JMX MCP Server para me ajudar nesta tarefa?
JMX MCP Server
Claro. Já li.
Veja o que encontrei usando JMX MCP Server.

Perguntas frequentes

Para que serve o servidor MCP JMX MCP Server?

JMX MCP Server é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP JMX MCP Server com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar JMX MCP Server com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP JMX MCP Server com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com JMX MCP Server conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP JMX MCP Server ao TypingMind?

JMX MCP Server funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP JMX MCP Server oferece no TypingMind?

JMX MCP Server disponibiliza recursos MCP que podem ser ativados na página Plugins do TypingMind e usados no chat ou atribuídos a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP JMX MCP Server?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se JMX MCP Server exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇