内容
# 运维 MCP 服务器
Un **企业运维助手** 由 MCP(模型上下文协议)、Java 和 Spring Boot 构建。
## 🚀 特性
此 MCP 服务器提供了用于监控企业运维的工具:
- **getSystemMetrics** - 获取实时系统指标(延迟、错误率、时间戳)
- **getRecentIncidents** - 获取最近的事件列表,包含完整详细信息
## 📋 要求
- Java 25 或更高版本
- Maven 3.6+(包含 Maven Wrapper)
## 🔧 快速设置
### Windows
```powershell
# 运行批处理脚本以编译和启动
.\run.bat
```
### Linux/macOS
```bash
# 编译
./mvnw clean package
# 运行
./mvnw spring-boot:run
```
## 🛠️ 可用工具
### 1. getSystemMetrics
获取当前的系统指标。
**示例输出:**
```json
{
"avgLatencyMs": 120,
"errorRate": 0.02,
"timestamp": "2026-02-11T10:30:00Z"
}
```
### 2. getRecentIncidents
获取最近的系统事件。
**示例输出:**
```json
[
{
"id": "INC-42",
"title": "数据库延迟峰值",
"timestamp": "2026-02-11T09:30:00Z",
"status": "已解决"
},
{
"id": "INC-43",
"title": "缓存淘汰异常",
"timestamp": "2026-02-11T08:30:00Z",
"status": "正在调查"
}
]
```
## 🔌 与 Claude Desktop 集成
将此配置添加到 Claude 的配置文件中:
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
**macOS/Linux:** `~/Library/Application Support/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"operations-mcp-server": {
"command": "java",
"args": [
"-jar",
"/完整路径/operations-mcp-server/target/operations-mcp-server-0.0.1-SNAPSHOT.jar"
]
}
}
}
```
重启 Claude Desktop 以启用工具。
## 📚 文档
有关更多详细信息,请参阅 [USAGE.md](USAGE.md)。
## 🏗️ 项目结构
```
operations-mcp-server/
├── src/main/java/it/matteoroxis/operations_mcp_server/
│ ├── OperationsMcpServerApplication.java # 主要应用程序
│ ├── component/
│ │ └── MonitoringTools.java # 实现的 MCP 工具
│ ├── configuration/
│ │ └── McpServerConfiguration.java # MCP 配置
│ └── model/
│ ├── Incident.java # 事件模型
│ └── SystemMetrics.java # 系统指标模型
└── src/main/resources/
└── application.properties # Spring 配置
```
## 🔑 使用的技术
- **Spring Boot 3.5.10** - 应用程序框架
- **Spring AI 1.1.2** - MCP 服务器集成
- **Java 25** - 编程语言
- **Maven** - 构建工具
## 📝 许可证
本项目按原样提供,不提供任何保证。