An Enterprise Operations Assistant built with Model Context Protocol (MCP), Java 25 and Spring Boot 3.5.
This project integrates:
- Model Context Protocol (MCP): for communication with external tools via
McpSyncClient - Spring AI 1.1.2: for OpenAI GPT-4 integration
- Spring Boot 3.5: for enterprise architecture
The application retrieves system metrics and recent incidents via MCP, processes them and provides intelligent operational recommendations using GPT-4.
- JDK 25 (or JDK 21+)
- Maven 3.8+
- MCP Server running at
http://localhost:8081/mcp(Streamable HTTP) - OpenAI API Key
Windows (PowerShell):
$env:OPENAI_API_KEY="sk-your-api-key-here"Linux/Mac:
export OPENAI_API_KEY="sk-your-api-key-here"Or edit src/main/resources/application.properties and replace ${OPENAI_API_KEY} with your key directly.
The client expects a Streamable HTTP MCP server available at:
http://localhost:8081/mcp
The server must expose the following tools:
getSystemMetricsβ returns{ avgLatencyMs, errorRate }getRecentIncidentsβ returns a list of[{ id, title, timestamp, status }]
spring.application.name=operations-mcp-client
# MCP Client
spring.ai.mcp.client.type=SYNC
spring.ai.mcp.client.request-timeout=30s
spring.ai.mcp.client.toolcallback.enabled=false
spring.ai.mcp.client.streamable-http.connections.tools-server.url=http://localhost:8081
spring.ai.mcp.client.streamable-http.connections.tools-server.endpoint=/mcp
# OpenAI
spring.ai.openai.api-key=${OPENAI_API_KEY}
spring.ai.openai.chat.options.model=gpt-4
spring.ai.openai.chat.options.temperature=0.7mvn clean installmvn spring-boot:runcurl http://localhost:8080/api/incidents/analyzeOr open in browser: http://localhost:8080/api/incidents/analyze
operations-mcp-client/
βββ src/main/java/it/matteoroxis/operations_mcp_client/
β βββ config/
β β βββ McpClientConfig.java # McpSyncClient configuration
β β βββ SpringAIConfig.java # Spring AI ChatClient configuration
β βββ controller/
β β βββ IncidentController.java # REST controller GET /api/incidents/analyze
β βββ model/
β β βββ Incident.java # Record: id, title, timestamp, status
β β βββ SystemMetrics.java # Record: avgLatencyMs, errorRate, timestamp
β βββ service/
β β βββ IncidentAnalysisService.java # Core analysis service
β βββ OperationsMcpClientApplication.java
βββ src/main/resources/
βββ application.properties
GET /api/incidents/analyze
β
βΌ
IncidentAnalysisService.analyze()
β
βββ McpSyncClient β callTool("getSystemMetrics") β SystemMetrics
βββ McpSyncClient β callTool("getRecentIncidents") β List<Incident>
β
βΌ
ChatClient (OpenAI GPT-4)
β
βΌ
Operational recommendations in natural language
Incident
public record Incident(String id, String title, Instant timestamp, String status) {}SystemMetrics
public record SystemMetrics(int avgLatencyMs, double errorRate, Instant timestamp) {}| Method | Path | Description |
|---|---|---|
GET |
/api/incidents/analyze |
Analyses metrics and incidents, returns GPT-4 recommendations |
The service dynamically builds a prompt containing:
- System metrics: average latency, error rate, timestamp
- Recent incidents list: ID, title, status, timestamp
- Analysis constraints: likely causes, prioritised actions, additional metrics to collect
| Dependency | Version | Purpose |
|---|---|---|
spring-boot-starter-web |
3.5.10 | REST API |
spring-ai-starter-mcp-client |
1.1.2 | MCP Client |
spring-ai-starter-model-openai |
1.1.2 | OpenAI integration |
jackson-databind |
- | JSON parsing of MCP responses |
The MCP server is not available at http://localhost:8081. Make sure the server is running before starting the client.
Maven cannot find the JDK. Make sure JAVA_HOME points to a JDK:
# Windows
$env:JAVA_HOME="C:\Program Files\Java\jdk-25"Verify that the OPENAI_API_KEY environment variable is set correctly.
Make sure the MCP server returns JSON in the expected format:
[
{ "id": "INC-42", "title": "...", "timestamp": 1234567890, "status": "Resolved" }
]The timestamp field must be an epoch number in seconds (not an ISO-8601 string).
- Java 25
- Spring Boot 3.5.10
- Spring AI 1.1.2
- MCP Java SDK (via
spring-ai-starter-mcp-client) - OpenAI GPT-4
- Jackson
- Maven
This project is an educational example.
Matteo Roxis