动作管理服务器

IBM Orchestrate MCP Server 是一个模型上下文协议服务器,提供与IBM Orchestrate动作管理API交互的工具,支持动作组检索、设备动作调度和健康检查等功能,适用于设备管理和自动化任务调度场景。

  • by mohammed-taha-roshan
  • Java
  • 本地部署
  • 更新于
在 GitHub 查看 mohammed-taha-roshan/mcp-server

使用说明

IBM编排MCP服务器

一种模型上下文协议(MCP)服务器,提供与IBM Orchestrate Action Management API交互的工具。此服务器可以部署到Fast MCP并导入IBM Orchestrate以实现无缝集成。

特性

  • 获取行动组:检索为客户配置的所有操作组
  • 安排行动:使用时区和重复支持安排设备操作(重启、配置更新等)
  • 健康检查:验证MCP服务器是否正常运行

先决条件

  • Java 17或更高版本
  • Gradle 8.x
  • 使用有效的MaaS令牌进行IBM Orchestrate访问
  • 访问IBM编排操作管理API

快速开始

1.克隆存储库

git clone <your-repo-url>
cd AI-agent/mcp

2.建设项目

./gradlew clean build

3.本地运行

./gradlew bootRun

服务器将于启动 http://localhost:8080

可用工具

1.get_action_groups

从IBM Orchestrate检索特定客户的操作组。

参数:

  • customerId (必填):用于获取操作组的客户ID
  • maasToken (必填):MaaS身份验证令牌

例子:

{
  "customerId": "70090505",
  "maasToken": "0edfcf88-f811-4de9-9181-e80e21473b32-ImKw8Be"
}

2.调度操作

安排在IBM Orchestrate中执行的操作。

参数:

  • customerId (必填):客户ID
  • maasToken (必填):MaaS身份验证令牌
  • actionType (必填):操作类型(例如,MDM_RESTART_DEVICE)
  • actionConfigName (必填):此操作配置的名称
  • description (可选):动作描述
  • targetList (必需):目标设备ID的逗号分隔列表
  • scheduleStart (必填):ISO 8601时间戳(例如,2025-11-05T05:00:00.000Z)
  • timezone (必填):时间表的时区(例如,美国/纽约)
  • frequency (可选):重复频率(一次、一天、一周、一个月)-默认为一次

例子:

{
  "customerId": "70090505",
  "maasToken": "0edfcf88-f811-4de9-9181-e80e21473b32-ImKw8Be",
  "actionType": "MDM_RESTART_DEVICE",
  "actionConfigName": "restart-config-001",
  "description": "Scheduled device restart",
  "targetList": "7954649",
  "scheduleStart": "2025-11-05T05:00:00.000Z",
  "timezone": "America/New_York",
  "frequency": "ONCE"
}

3.健康检查

在MCP服务器上执行运行状况检查。

参数: 无

答复:

{
  "status": "healthy",
  "service": "IBM Orchestrate MCP Server",
  "version": "1.0.0"
}

部署到快速MCP

第一步:推送到GitHub

git add .
git commit -m "Add IBM Orchestrate MCP Server"
git push origin main

步骤2:配置快速MCP

  1. 登录您的快速MCP仪表板
  2. 导航至 服务器 → 添加新服务器
  3. 选择 GitHub存储库
  4. 输入您的存储库URL
  5. 配置生成设置:
    • 生成命令: ./gradlew clean build
    • 启动命令: java -jar build/libs/mcp-0.0.1-SNAPSHOT.jar
    • 端口: 8080

步骤3:部署

点击 部署 并等待部署完成。快速MCP将:

  • 克隆您的存储库
  • 构建应用程序
  • 启动MCP服务器
  • 为您提供一个公共URL

导入到IBM Orchestrate

方法1:使用IBM Orchestrate UI

  1. 登录到IBM Orchestrate
  2. 导航至 集成 → MCP服务器
  3. 点击 添加MCP服务器
  4. 输入以下详细信息:
    • 名字:IBM编排操作管理器
    • 统一资源定位符:您的快速MCP部署URL
    • 描述:用于管理IBM Orchestrate操作的MCP服务器
  5. 点击 测试连接 验证
  6. 点击 保存

方法2:使用API

curl -X POST https://orchestrate.ibm.com/api/v1/mcp-servers \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "IBM Orchestrate Action Manager",
    "url": "https://your-fastmcp-url.com",
    "description": "MCP server for managing IBM Orchestrate actions",
    "enabled": true
  }'

配置

更新基本URL

如果您需要更改IBM Orchestrate API基本URL,请编辑:

mcp/src/main/java/com/ibm/mcp/client/ActionGroupClient.java

this.webClient = WebClient.builder()
    .baseUrl("http://YOUR_API_URL:PORT")
    .build();

环境变量

您还可以使用环境变量配置基本URL:

export ORCHESTRATE_API_URL=http://172.25.52.61:8080

然后更新代码以从环境中读取:

String baseUrl = System.getenv().getOrDefault("ORCHESTRATE_API_URL", "http://172.25.52.61:8080");
this.webClient = WebClient.builder()
    .baseUrl(baseUrl)
    .build();

测试

运行单元测试

./gradlew test

使用cURL进行测试

获取行动组:

curl -X POST http://localhost:8080/mcp/tools/get_action_groups \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "70090505",
    "maasToken": "0edfcf88-f811-4de9-9181-e80e21473b32-ImKw8Be"
  }'

计划行动:

curl -X POST http://localhost:8080/mcp/tools/schedule_action \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "70090505",
    "maasToken": "0edfcf88-f811-4de9-9181-e80e21473b32-ImKw8Be",
    "actionType": "MDM_RESTART_DEVICE",
    "actionConfigName": "test-restart",
    "description": "Test restart",
    "targetList": "7954649",
    "scheduleStart": "2025-11-05T05:00:00.000Z",
    "timezone": "America/New_York",
    "frequency": "ONCE"
  }'

项目结构

mcp/
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/ibm/mcp/
│   │   │       ├── McpServerApplication.java      # Main application
│   │   │       ├── client/
│   │   │       │   └── ActionGroupClient.java     # HTTP client for API calls
│   │   │       └── tools/
│   │   │           └── ActionGroupToolService.java # MCP tools definition
│   │   └── resources/
│   │       └── application.properties              # Configuration
│   └── test/
│       └── java/
│           └── com/ibm/mcp/
│               └── McpApplicationTests.java        # Tests
├── build.gradle                                     # Build configuration
└── README.md                                        # This file

故障排除

构建失败

# Clean and rebuild
./gradlew clean build --refresh-dependencies

连接问题

  • 验证IBM Orchestrate API URL是否可访问
  • 检查您的MaaS令牌是否有效
  • 确保防火墙规则允许出站连接

工具未出现在IBM Orchestrate中

  • 验证MCP服务器是否正在运行且可访问
  • 检查服务器日志是否有错误
  • 测试health_check端点
  • 确保@Tool注释配置正确

CI/CD

该项目包括用于自动部署的GitHub Actions:

  • 构建:每次推送都会自动构建
  • 测试:运行单元测试
  • 部署:在合并到主分支时部署到快速MCP

看 .github/workflows/deploy.yml 用于配置。

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 提交拉取请求

许可证

[您的许可证在这里]

支持

对于问题和疑问:

  • GitHub问题:[您的回购问题URL]
  • 电子邮件:[您的支持电子邮件]
  • 文档:[您的文档URL]