WildFly MCP Server for LLM Metrics and Operations
Manage WildFly servers with an MCP server to let LLMs retrieve metrics, view logs and invoke operations in real time.
npx -y @wildfly-extras/wildfly-mcpOverview
The WildFly MCP Server is an adapter service that exposes WildFly management capabilities through a Model Context Protocol (MCP) endpoint so LLM-based agents can inspect runtime state, fetch metrics, read logs and invoke management operations in real time. Instead of granting an LLM direct access to a WildFly admin console or SSH session, the MCP server surfaces a constrained, structured set of tools that are easier to reason about and can be audited or rate‑limited.
This approach is useful for operational automation, incident response, and observability. An LLM connected to the MCP server can ask for recent JVM metrics, tail application logs, or request a graceful server reload. The MCP server mediates those interactions, translating between the MCP tool model and WildFly’s management API while enforcing authentication, authorization and request limits.
Features
- Exposes WildFly metrics (CPU, heap, thread counts, subsystem stats) via MCP tools
- Provides access to recent and streamed server logs with filtering
- Allows invocation of WildFly management operations (deploy, reload, subsystem operations)
- Runs as a standalone Java service (buildable with Maven) and configurable via environment variables or a properties file
- Authentication and TLS support for secure agent access
- Auditable operation execution and rate limiting for safety
Installation / Configuration
Prerequisites:
- Java 17+ (or the version required by the project)
- Maven (for building from source)
- A WildFly server with a management user configured
Build and run from source:
# Clone and build
# Run the bundled JAR (replace with the actual artifact name)
Basic configuration (environment variables or an application.properties file). Example application.properties:
# WildFly management endpoint
# MCP server port and TLS option
# Optional: API key to protect MCP endpoints
Run the server with environment variables instead of a properties file:
Security notes:
- Prefer TLS (mcp.tls.enabled=true) and validate certificates.
- Use a dedicated management user with minimal privileges needed by the LLM workflows.
- Enable request auditing and set conservative rate limits for operation endpoints.
Available Resources
The MCP server exposes a small, consistent set of HTTP endpoints (examples — actual path may vary by implementation/version):
| Endpoint | Purpose |
|---|---|
| GET /mcp/metrics | Retrieve current metrics for server, JVM and subsystems (JSON) |
| GET /mcp/logs | Fetch recent logs with query parameters (levels, timeframe, tail) |
| POST /mcp/logs/stream | Open a streaming/long-polling log feed |
| POST /mcp/operations | Invoke a WildFly management operation (payload contains operation name and params) |
| GET /mcp/tools | List available MCP tools and their schemas (tools description for LLM) |
Example: fetch metrics with curl
Example response fragment:
Operation invocation example:
Use Cases
Automated scaling decisions
- An LLM agent polls /mcp/metrics for heap and request throughput. When CPU and heap pressure exceed configured thresholds, it invokes a management operation to add a server instance or adjust thread pools.
Incident triage and remediation
- During an error spike, a chat assistant queries /mcp/logs to fetch recent ERROR entries and then runs a targeted operation (e.g., restart a failing subsystem) using /mcp/operations. All actions are logged for post-mortem review.
ChatOps for on-call engineers
- A team uses an LLM in Slack to ask “What’s the latest log for PaymentService?” The assistant retrieves filtered logs via /mcp/logs and suggests or executes an operation to roll back a problematic deployment after human approval.
Observability enrichment
- Integrate the MCP server with external analytics: periodic metric snapshots from /mcp/metrics feed a monitoring pipeline without exposing raw WildFly management credentials to third-party tools.
Getting Help and Contributing
- Source code and issues: https://github.com/wildfly-extras/wildfly-mcp
- When reporting issues, include server version, configuration snippet (without secrets) and a reproduction case.
- Contributions (bug fixes, new tools, enhancements) are welcome via pull requests. Follow project coding and testing guidelines in the repository.