MCP SAP GUI 服务器
用于 SAP GUI 自动化的模型上下文协议 (MCP) 服务器。该服务器提供用于自动化与 SAP GUI 交互的工具,从而支持对 SAP 事务进行编程控制。
要求
- Python 3.8 或更高版本
- SAP GUI 安装和配置
- 有效的 SAP 凭证(系统、客户端、用户、密码)
- Node.js(用于 npx)
安装
- 克隆 github 文件夹并使用安装脚本运行自动安装:
这将指导您完成构建过程,并将其直接集成到 Cline 或 Roo 中(如果您选择这样做)。
- 或使用构建脚本手动安装..:
- 配置 SAP 凭据:
- 将
.env.example
复制到.env
- 使用您的 SAP 凭证更新值
- 使用 mcp 检查器测试服务器:
- 使用集成脚本自动配置 MCP 设置:
该脚本将:
- 自动确定正确的设置文件路径
- 在进行任何更改之前创建备份
- 安全更新 MCP 配置
- 验证变更以防止损坏
手动配置(如果需要):
- 使用此提示向您的 AI 模型解释该工具:
可用工具
MCP SAP GUI 服务器为 SAP 自动化提供了以下工具:
交易管理
launch_transaction
:启动特定的 SAP 事务代码end_transaction
:结束当前 SAP 事务
界面交互
sap_click
:单击 SAP GUI 窗口中的特定坐标sap_move_mouse
:将鼠标光标移动到特定坐标sap_type
:在当前光标位置输入文本sap_scroll
:滚动 SAP GUI 屏幕(向上/向下)
屏幕截图
save_last_screenshot
:保存 SAP GUI 窗口的最后一个屏幕截图。返回已保存图像的绝对文件路径。
屏幕截图返回格式
所有与 SAP GUI 窗口交互的工具(launch_transaction、sap_click、sap_move_mouse、sap_type、sap_scroll)都支持由return_screenshot
参数控制的不同屏幕截图返回格式:
none
(默认值):仅返回成功/错误消息
as_file
:将截图保存到指定的目标文件夹并返回路径
注意:使用as_file
时,必须使用as_file_target_folder
参数指定目标文件夹。如果文件夹不存在,则会创建该文件夹。
as_base64
:返回原始 base64 字符串
as_imagecontent
:返回 MCP ImageContent 对象
as_imageurl
:返回带有数据 URL 的嵌入资源
使用示例:
工具参数摘要:
工具 | 范围 | 类型 | 默认 | 描述 |
---|---|---|---|---|
launch_transaction | transaction | string | 要启动的 SAP 事务代码(例如 VA01、ME21N、MM03) | |
return_screenshot | string | none | 截图返回格式( none 、 as_file 、 as_base64 、 as_imagecontent 、 as_imageurl ) | |
as_file_target_folder | string | 使用“as_file”返回格式时保存屏幕截图的目标文件夹路径 | ||
sap_click | x | integer | 点击发生的水平像素坐标(0-1920) | |
y | integer | 点击发生的垂直像素坐标(0-1080) | ||
return_screenshot | string | none | 截图返回格式( none 、 as_file 、 as_base64 、 as_imagecontent 、 as_imageurl ) | |
as_file_target_folder | string | 使用“as_file”返回格式时保存屏幕截图的目标文件夹路径 | ||
sap_move_mouse | x | integer | 光标移动到的水平像素坐标(0-1920) | |
y | integer | 光标移动到的垂直像素坐标(0-1080) | ||
return_screenshot | string | none | 截图返回格式( none 、 as_file 、 as_base64 、 as_imagecontent 、 as_imageurl ) | |
as_file_target_folder | string | 使用“as_file”返回格式时保存屏幕截图的目标文件夹路径 | ||
sap_type | text | string | 在 SAP GUI 窗口的当前光标位置输入的文本 | |
return_screenshot | string | none | 截图返回格式( none 、 as_file 、 as_base64 、 as_imagecontent 、 as_imageurl ) | |
as_file_target_folder | string | 使用“as_file”返回格式时保存屏幕截图的目标文件夹路径 | ||
sap_scroll | direction | string | 滚动屏幕的方向(“向上”使内容向下移动,“向下”使内容向上移动) | |
return_screenshot | string | none | 截图返回格式( none 、 as_file 、 as_base64 、 as_imagecontent 、 as_imageurl ) | |
as_file_target_folder | string | 使用“as_file”返回格式时保存屏幕截图的目标文件夹路径 | ||
end_transaction | ||||
save_last_screenshot | filename | string | 屏幕截图保存的路径 |
发展
运行测试
- 使用 mcp 检查器测试服务器(构建 + 调试):
- 或者使用测试套件:测试套件包含与 SAP GUI 交互的实时测试。运行测试之前,请确保已安装并配置 SAP GUI。
运行测试:
测试套件包括:
- SapGuiServer 测试(test_server.py)
- 工具注册
- 请求处理
- 响应格式
- 错误处理
项目结构
执照
[MIT许可证]
Related MCP Servers
- -securityFlicense-qualityThis MCP server implementation allows users to manage and expose actions as tools from their Integration App workspace through the Model Context Protocol.Last updated -1019TypeScript
- -securityFlicense-qualityA Model Context Protocol server that integrates with Cursor IDE, providing real-time communication, modern web dashboards, and extensible tools via SSE and WebSocket connections.Last updated -1,0121Python
- -securityFlicense-qualityEnables integration between SAP HANA Cloud Database and Cursor IDE through the Model Context Protocol, providing standardized interfaces for managing ML models and execution contexts.Last updated -Python
- -securityAlicense-qualityA Model Context Protocol server that provides file system operations, analysis, and manipulation capabilities through a standardized tool interface.Last updated -1TypeScriptMIT License