MCP SAP GUI Server
MCP SAP GUI Server
A Model Context Protocol (MCP) server for SAP GUI automation. This server provides tools to automate interactions with SAP GUI, enabling programmatic control of SAP transactions.
Requirements
- Python 3.8 or higher
- SAP GUI installed and configured
- Valid SAP credentials (system, client, user, password)
- Node.js (for npx)
Installation
- Automated Install using setup script:
- OR Manual Install using build script..:
- Configure SAP credentials:
- Copy
credentials.env.example
to.env
- Update the values with your SAP credentials
- Test server using mcp inspector:
- Use the integration script to automatically configure MCP settings:
The script will:
- Automatically determine the correct settings file path
- Create a backup before making any changes
- Safely update the MCP configuration
- Validate changes to prevent corruption
Manual Configuration (if needed):
- Use this prompt to explain the Tool to your AI Model:
Available Tools
The MCP SAP GUI Server provides the following tools for SAP automation:
Transaction Management
launch_transaction
: Launch a specific SAP transaction codeend_transaction
: End the current SAP transaction
Interface Interaction
sap_click
: Click at specific coordinates in the SAP GUI windowsap_move_mouse
: Move mouse cursor to specific coordinatessap_type
: Type text at the current cursor positionsap_scroll
: Scroll the SAP GUI screen (up/down)
Screen Capture
save_last_screenshot
: Save the last captured screenshot of the SAP GUI window. Returns the absolute file path of the saved image.
Screenshot Return Formats
All tools that interact with the SAP GUI window (launch_transaction, sap_click, sap_move_mouse, sap_type, sap_scroll) support different screenshot return formats controlled by the return_screenshot
parameter:
none
(Default): Only returns success/error messages
as_file
: Saves screenshot to a temporary file and returns the path
as_base64
: Returns the raw base64 string
as_imagecontent
: Returns MCP ImageContent object
as_imageurl
: Returns embedded resource with data URL
Example usage:
Tool Parameter Summary:
Tool | Parameter | Type | Default | Description |
---|---|---|---|---|
launch_transaction | transaction | string | SAP transaction code to launch (e.g., VA01, ME21N, MM03) | |
return_screenshot | string | none | Screenshot return format (none , as_file , as_base64 , as_imagecontent , as_imageurl ) | |
sap_click | x | integer | Horizontal pixel coordinate (0-1920) where the click should occur | |
y | integer | Vertical pixel coordinate (0-1080) where the click should occur | ||
return_screenshot | string | none | Screenshot return format (none , as_file , as_base64 , as_imagecontent , as_imageurl ) | |
sap_move_mouse | x | integer | Horizontal pixel coordinate (0-1920) to move the cursor to | |
y | integer | Vertical pixel coordinate (0-1080) to move the cursor to | ||
return_screenshot | string | none | Screenshot return format (none , as_file , as_base64 , as_imagecontent , as_imageurl ) | |
sap_type | text | string | Text to enter at the current cursor position in the SAP GUI window | |
return_screenshot | string | none | Screenshot return format (none , as_file , as_base64 , as_imagecontent , as_imageurl ) | |
sap_scroll | direction | string | Direction to scroll the screen ('up' moves content down, 'down' moves up) | |
return_screenshot | string | none | Screenshot return format (none , as_file , as_base64 , as_imagecontent , as_imageurl ) | |
end_transaction | ||||
save_last_screenshot | filename | string | Path where the screenshot will be saved |
Development
Running Tests
- Test server using mcp inspector (build + debug):
- Or use test suite: The test suite includes live tests that interact with SAP GUI. Make sure you have SAP GUI installed and configured before running tests.
Run tests:
The test suite includes:
- SapGuiServer tests (test_server.py)
- Tool registration
- Request handling
- Response formatting
- Error handling
Project Structure
License
[MIT License]
This server cannot be installed
Automates interactions with SAP GUI using the Model Context Protocol, allowing precise control of SAP transactions through tools like clicking, typing, scrolling, and transaction management.