Ibm As 400 Iseries Mcp Server

Ibm As 400 Iseries Mcp Server

🚀 IBM AS/400 ISeries MCP Server

本项目实现了一个可定制的MCP服务器,用于执行RTE协议。

🚀 快速开始

示例展示

开发要求

  • Java 21+

运行步骤

  1. 编译项目:
./mvnw clean package
  1. SSE 模式下运行服务器:
java -jar target/rte-mcp-server-0.0.1-SNAPSHOT.jar
  1. STDIO 模式下运行服务器:
java -jar -Dspring.ai.mcp.server.stdio=true rte-mcp-server-0.0.1-SNAPSHOT.jar

RteUtils工具类

本项目旨在易于扩展。你可以通过使用 RteUtils 类添加自己的MCP工具。

同时,需要以 yaml 格式定义RTE连接参数和RTE流程。

RteUtils 实现了以下方法:

  • static RteProtocolClient connect(RteConfig config):使用提供的 yaml 文件连接到RTE服务器。
  • static String executeSteps(RteProtocolClient client, List steps):在RTE服务器上执行提供的步骤,并使用提供的 yaml 文件将屏幕结果作为字符串返回。

作为MCP工具公开的方法应使用 @Tool 注解,类应使用 @Services 注解,如下例所示:

@Service
public class RteServiceLoginTool implements RteTool {

private static final Logger logger = LoggerFactory.getLogger(RteServiceLoginTool.class);

@Tool(description = "Execute an RTE transaction in a given server", name = "TN5250 Login")
public String executeRteTransaction(String server, int port) {
try {
RteFlow flow = RteYamlLoader.load("/flow.yaml");
RteProtocolClient client = RteTool.connect(flow.getConfig(), server, port);
return RteTool.executeSteps(client, flow.getSteps());
} catch (IOException | RteIOException | InterruptedException | TimeoutException e) {
logger.error("Error executing RTE flow", e);
return "Error executing RTE flow: " + e.getMessage();
}
}
}

yaml 文件定义了连接参数和在RTE服务器上执行的步骤。该 yaml 文件应具有以下结构:

config:
server: localhost
port: 2324
protocol: TN5250
terminalType: 'IBM-3477-FC: 27x132'
sslType: None

steps:
- actions:
- label: User
input: TESTUSR
- label: Password
input: TESTPSW
attentionKey: ENTER

可以在 yaml 文件中定义任意数量的步骤。

属性 详情
服务器地址 连接到RTE服务器的服务器地址。
端口 连接到RTE服务器的端口。
协议 支持的协议有 TN5250TN3270VT420
终端类型 以下表格显示了每种协议支持的终端类型:
  • 0 关注
  • 0 收藏,8 浏览
  • system 提出于 2025-09-25 15:36

相似服务问题