### Install and Configure MCP SAP GUI Server Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Instructions for cloning the repository, running automated setup scripts (setup.bat, build.bat), and configuring SAP credentials via the .env file. It also shows an example .env file and a JSON configuration for MCP settings. ```bash git clone https://github.com/your-repo/mcp-sap-gui.git cd mcp-sap-gui setup.bat # Or manual build build.bat # Configure SAP credentials - copy .env.example to .env cp .env.example .env ``` ```ini # .env configuration file SAP_SYSTEM=your_system SAP_CLIENT=your_client SAP_USER=your_username SAP_PASSWORD=your_password # Logging Levels (DEBUG, INFO, WARNING, ERROR, CRITICAL) LOG_LEVEL=ERROR SERVER_LOG_LEVEL=DEBUG MCP_LOG_LEVEL=WARNING SAP_CONTROLLER_LOG_LEVEL=DEBUG ``` ```json // MCP settings configuration for Cline/Roo { "mcp-sap-gui": { "command": "python", "args": ["-m", "sap_gui_server.server"], "cwd": "PATH_TO_YOUR_FOLDER/mcp-sap-gui", "disabled": false, "autoApprove": [] } } ``` -------------------------------- ### Complete SAP Workflow Example (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Demonstrates a full SAP automation workflow, starting with launching the VA01 transaction, clicking on a specific field, and typing data followed by a Tab key press. Screenshots are captured at each step for analysis. ```python # Complete workflow: Create a sales order in VA01 # Step 1: Launch the VA01 transaction result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_imagecontent" }) # Analyze screenshot to find Order Type field coordinates # Step 2: Click on Order Type field (coordinates from image analysis) result = await client.call_tool("sap_click", { "x": 450, "y": 180, "return_screenshot": "as_imagecontent" }) # Step 3: Type the order type and tab to next field result = await client.call_tool("sap_type", { "text": "OR{TAB}", # Standard Order type "return_screenshot": "as_imagecontent" }) ``` -------------------------------- ### MCP SAP GUI Server Installation and Configuration Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Instructions for setting up the MCP SAP GUI Server, including cloning the repository, running setup scripts, and configuring SAP credentials and MCP settings. ```APIDOC ## Installation and Configuration Set up the MCP SAP GUI Server by running the setup script and configuring credentials. ```bash # Clone repository and run automated setup git clone https://github.com/your-repo/mcp-sap-gui.git cd mcp-sap-gui setup.bat # Or manual build build.bat # Configure SAP credentials - copy .env.example to .env cp .env.example .env ``` ```ini # .env configuration file SAP_SYSTEM=your_system SAP_CLIENT=your_client SAP_USER=your_username SAP_PASSWORD=your_password # Logging Levels (DEBUG, INFO, WARNING, ERROR, CRITICAL) LOG_LEVEL=ERROR SERVER_LOG_LEVEL=DEBUG MCP_LOG_LEVEL=WARNING SAP_CONTROLLER_LOG_LEVEL=DEBUG ``` ```json // MCP settings configuration for Cline/Roo { "mcp-sap-gui": { "command": "python", "args": ["-m", "sap_gui_server.server"], "cwd": "PATH_TO_YOUR_FOLDER/mcp-sap-gui", "disabled": false, "autoApprove": [] } } ``` ``` -------------------------------- ### Automated Installation Script Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Executes the automated installation process for the MCP SAP GUI Server. This script guides the user through the build and integration steps. ```batch setup.bat ``` -------------------------------- ### Complete Workflow Example Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Demonstrates a complete SAP automation workflow, from launching a transaction to data entry and confirmation. ```APIDOC ## Complete Workflow Example This example demonstrates a complete SAP automation workflow for creating a sales order in transaction VA01. ### Step 1: Launch the VA01 transaction ```python # Launch the VA01 transaction result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_imagecontent" }) # Analyze screenshot to find Order Type field coordinates ``` ### Step 2: Click on Order Type field ```python # Click on Order Type field (coordinates from image analysis) result = await client.call_tool("sap_click", { "x": 450, "y": 180, "return_screenshot": "as_imagecontent" }) ``` ### Step 3: Type the order type and tab to the next field ```python # Type the order type and tab to next field result = await client.call_tool("sap_type", { "text": "OR{TAB}", # Standard Order type "return_screenshot": "as_imagecontent" }) ``` ``` -------------------------------- ### Manual Build Script Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Initiates the manual build process for the MCP SAP GUI Server. This is an alternative to the automated setup script. ```batch build.bat ``` -------------------------------- ### Python: Launch SAP Transaction with Screenshot Options Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Example Python code demonstrating how to use the `launch_transaction` tool with different `return_screenshot` settings. This includes launching without a screenshot (default), saving the screenshot to a specified folder, and retrieving the screenshot as a base64 string. ```python # Default - no screenshot result = await client.call_tool("launch_transaction", { "transaction": "VA01" }) ``` ```python # Save to specific folder result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_file", "as_file_target_folder": "C:/screenshots" }) ``` ```python # Get base64 string result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_base64" }) ``` -------------------------------- ### POST /launch_transaction Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Launches a SAP transaction by its transaction code. This tool starts the SAP GUI session, authenticates, handles multiple logon popups, and can return a screenshot of the resulting screen in various formats. ```APIDOC ## POST /launch_transaction ### Description Launches a SAP transaction by its transaction code (e.g., VA01, ME21N, MM03). This tool starts the SAP GUI session, authenticates with the configured credentials, handles multiple logon popups automatically, and returns a screenshot of the resulting screen. ### Method POST ### Endpoint /launch_transaction ### Parameters #### Query Parameters - **transaction** (string) - Required - The transaction code to launch (e.g., "VA01"). - **return_screenshot** (string) - Optional - Specifies the format of the returned screenshot. Options: "as_file", "as_base64", "as_imagecontent", "as_imageurl". - **as_file_target_folder** (string) - Optional - If `return_screenshot` is "as_file", this specifies the folder to save the screenshot. ### Request Example ```python # Launch a sales order transaction with default settings (no screenshot returned) result = await client.call_tool("launch_transaction", { "transaction": "VA01" }) # Response: {"type": "text", "text": "Status: success"} # Launch with screenshot saved to file result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_file", "as_file_target_folder": "C:/sap_screenshots" }) # Response: {"type": "text", "text": "Screenshot saved as C:/sap_screenshots/sap_screenshot_20250221_143025.png"} # Launch with screenshot as base64 string result = await client.call_tool("launch_transaction", { "transaction": "ME21N", "return_screenshot": "as_base64" }) # Response: {"type": "text", "text": "iVBORw0KGgoAAAANSUhEUgAAA..."} # Launch with screenshot as MCP ImageContent object result = await client.call_tool("launch_transaction", { "transaction": "MM03", "return_screenshot": "as_imagecontent" }) # Response: {"type": "image", "data": "base64_encoded_string", "mimeType": "image/png"} # Launch with screenshot as embedded resource with data URL result = await client.call_tool("launch_transaction", { "transaction": "SE80", "return_screenshot": "as_imageurl" }) # Response: {"type": "resource", "resource": {"uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..."}} ``` ### Response #### Success Response (200) - **type** (string) - The type of the response (e.g., "text", "image", "resource"). - **text** (string) - If type is "text", contains the status message or screenshot file path. - **data** (string) - If type is "image", contains the base64 encoded image data. - **mimeType** (string) - If type is "image", the MIME type of the image (e.g., "image/png"). - **resource** (object) - If type is "resource", contains details about the embedded resource. - **uri** (string) - The URI of the resource. - **mimeType** (string) - The MIME type of the resource. - **text** (string) - The resource content, often a data URL. #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ```json { "type": "text", "text": "Screenshot saved as C:/sap_screenshots/sap_screenshot_20250221_143025.png" } ``` ```json { "type": "text", "text": "iVBORw0KGgoAAAANSUhEUgAAA..." } ``` ```json { "type": "image", "data": "base64_encoded_string", "mimeType": "image/png" } ``` ```json { "type": "resource", "resource": { "uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..." } } ``` ``` -------------------------------- ### Test Server with Debug Mode Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Starts the MCP SAP GUI Server in debug mode for testing purposes. This allows for interactive debugging and verification of server functionality. ```batch run.bat debug ``` -------------------------------- ### Run SAP GUI Server Tests Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Runs the test suite that includes live tests interacting with SAP GUI. Ensure SAP GUI is installed and configured before execution. This command specifically targets server-side tests. ```bash run.bat test server ``` -------------------------------- ### Configure MCP for Roo Integration Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Automatically configures MCP settings for integration with Roo. This script ensures proper setup by backing up existing configurations and validating changes. ```batch integrate.bat roo ``` -------------------------------- ### Launch SAP Transaction with MCP SAP GUI Server (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Demonstrates how to launch SAP transactions using the `launch_transaction` tool. It covers options for returning screenshots as files, base64 strings, MCP ImageContent objects, or embedded data URLs. Requires an active client connection. ```python # Launch a sales order transaction with default settings (no screenshot returned) result = await client.call_tool("launch_transaction", { "transaction": "VA01" }) # Response: {"type": "text", "text": "Status: success"} # Launch with screenshot saved to file result = await client.call_tool("launch_transaction", { "transaction": "VA01", "return_screenshot": "as_file", "as_file_target_folder": "C:/sap_screenshots" }) # Response: {"type": "text", "text": "Screenshot saved as C:/sap_screenshots/sap_screenshot_20250221_143025.png"} # Launch with screenshot as base64 string result = await client.call_tool("launch_transaction", { "transaction": "ME21N", "return_screenshot": "as_base64" }) # Response: {"type": "text", "text": "iVBORw0KGgoAAAANSUhEUgAAA..."} # Launch with screenshot as MCP ImageContent object result = await client.call_tool("launch_transaction", { "transaction": "MM03", "return_screenshot": "as_imagecontent" }) # Response: {"type": "image", "data": "base64_encoded_string", "mimeType": "image/png"} # Launch with screenshot as embedded resource with data URL result = await client.call_tool("launch_transaction", { "transaction": "SE80", "return_screenshot": "as_imageurl" }) # Response: {"type": "resource", "resource": {"uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..."}} ``` -------------------------------- ### SAP GUI Screenshot Return Formats Reference (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Details the various formats available for returning screenshots from SAP GUI interaction tools. Options include 'none', 'as_file', 'as_base64', 'as_imagecontent', and 'as_imageurl', each with a different output structure. ```python # return_screenshot options: # "none" (default) - Only returns success/error messages # "as_file" - Saves to folder specified by as_file_target_folder, returns path # "as_base64" - Returns raw base64 encoded string # "as_imagecontent" - Returns MCP ImageContent object # "as_imageurl" - Returns embedded resource with data URL # Response format for "none": {"type": "text", "text": "Status: success"} # Response format for "as_file": {"type": "text", "text": "Screenshot saved as C:/path/to/file/sap_screenshot_20250221_143025.png"} # Response format for "as_base64": {"type": "text", "text": "iVBORw0KGgoAAAANSUhEUgAAA..."} # Response format for "as_imagecontent": {"type": "image", "data": "base64_encoded_string", "mimeType": "image/png"} # Response format for "as_imageurl": { "type": "resource", "resource": { "uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..." } } ``` -------------------------------- ### Project Structure Overview Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Illustrates the directory structure of the mcp-sap-gui project. It outlines the organization of source files, test modules, build scripts, and dependency lists. ```text mcp-sap-gui/ ├── src/ │ └── sap_gui_server/ │ ├── __init__.py │ ├── sap_controller.py # SAP GUI interaction logic │ └── server.py # MCP server implementation ├── tests/ │ ├── __init__.py │ ├── test_sap_controller.py │ └── test_server.py ├── build.bat # Build and test script ├── integrate.bat # Integration script for Cline/Roo ├── integrate.py # Python script for safe MCP settings updates ├── requirements.txt # Production dependencies └── requirements-dev.txt # Development dependencies ``` -------------------------------- ### Launch SAP Transaction Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Initiates a new SAP transaction by calling the `launch_transaction` tool with a specified transaction code. Requires careful analysis of the returned screenshot. ```python # Example usage (assuming 'sap_gui_server' is imported and configured) sap_gui_server.launch_transaction('VA01') ``` -------------------------------- ### Perform Click Action in SAP GUI with MCP SAP GUI Server (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Details on using the `sap_click` tool to simulate mouse clicks at specified pixel coordinates within the SAP GUI window. It supports returning screenshots for verification, either saved to a file or as an image content object. Coordinates are relative to the SAP window and handle DPI scaling. ```python # Click at coordinates without screenshot result = await client.call_tool("sap_click", { "x": 450, "y": 200 }) # Response: {"type": "text", "text": "Status: success"} # Click and capture screenshot to verify result result = await client.call_tool("sap_click", { "x": 350, "y": 150, "return_screenshot": "as_imagecontent" }) # Response includes status and screenshot image for verification # Click on a button and save screenshot for analysis result = await client.call_tool("sap_click", { "x": 800, "y": 300, "return_screenshot": "as_file", "as_file_target_folder": "C:/sap_automation/screenshots" }) # Response: {"type": "text", "text": "Status: success"}, {"type": "text", "text": "Screenshot saved as C:/sap_automation/screenshots/sap_screenshot_20250221_143030.png"} ``` -------------------------------- ### Screenshot Return Formats Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Reference for the different formats available for returning screenshots via the `return_screenshot` parameter. ```APIDOC ## Screenshot Return Formats Reference All interaction tools (e.g., `launch_transaction`, `sap_click`, `sap_move_mouse`, `sap_type`, `sap_scroll`) support flexible screenshot return formats through the `return_screenshot` parameter. ### Options: - **"none"** (default): Only returns success/error messages. - **"as_file"**: Saves the screenshot to the folder specified by `as_file_target_folder` and returns the file path. - **"as_base64"**: Returns the raw base64 encoded string of the screenshot. - **"as_imagecontent"**: Returns an MCP ImageContent object, including base64 data and mime type. - **"as_imageurl"**: Returns an embedded resource with a data URL representing the screenshot. ### Response Formats: #### "none" ```json { "type": "text", "text": "Status: success" } ``` #### "as_file" ```json { "type": "text", "text": "Screenshot saved as C:/path/to/file/sap_screenshot_20250221_143025.png" } ``` #### "as_base64" ```json { "type": "text", "text": "iVBORw0KGgoAAAANSUhEUgAAA..." } ``` #### "as_imagecontent" ```json { "type": "image", "data": "base64_encoded_string", "mimeType": "image/png" } ``` #### "as_imageurl" ```json { "type": "resource", "resource": { "uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..." } } ``` ``` -------------------------------- ### Enter Distribution Channel and Division in SAP GUI Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt This snippet shows how to input both the distribution channel and division, followed by pressing Enter, within the SAP GUI. It utilizes the 'sap_type' tool to send the combined input and the ENTER key. A screenshot is captured as image content. ```python result = await client.call_tool("sap_type", { "text": "10{TAB}00{ENTER}", "return_screenshot": "as_imagecontent" }) ``` -------------------------------- ### Run Full Test Suite with MCP Inspector Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Executes the full test suite for the mcp-sap-gui project using the MCP inspector. This command initiates a build process followed by debugging tests. ```bash ./run.bat full ``` -------------------------------- ### SAP GUI Screenshot Return Formats Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md This snippet illustrates the different formats for returning screenshots from SAP GUI interaction tools. Supported formats include 'none' (default), 'as_file', 'as_base64', 'as_imagecontent', and 'as_imageurl'. Each format has a corresponding JSON output structure. ```json { "type": "text", "text": "Status: success" } ``` ```json { "type": "text", "text": "Screenshot saved as C:/path/to/file/screenshot.png" } ``` ```json { "type": "text", "text": "base64_encoded_string_here" } ``` ```json { "type": "image", "data": "base64_encoded_string_here", "mimeType": "image/png" } ``` ```json { "type": "resource", "resource": { "uri": "application:image", "mimeType": "image/png", "text": "data:image/png;base64,..." } } ``` -------------------------------- ### POST /sap_click Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Clicks at specific pixel coordinates in the SAP GUI window. Coordinates are relative to the SAP window, with DPI scaling handled automatically. Can optionally return a screenshot. ```APIDOC ## POST /sap_click ### Description Clicks at specific pixel coordinates in the SAP GUI window. Coordinates are relative to the SAP window (not screen coordinates), with DPI scaling handled automatically. Use image recognition on previous screenshots to determine exact click positions. This endpoint can optionally capture and return a screenshot after the click. ### Method POST ### Endpoint /sap_click ### Parameters #### Query Parameters - **x** (integer) - Required - The X-coordinate within the SAP GUI window to click. - **y** (integer) - Required - The Y-coordinate within the SAP GUI window to click. - **return_screenshot** (string) - Optional - Specifies the format of the returned screenshot. Options: "as_file", "as_base64", "as_imagecontent", "as_imageurl". - **as_file_target_folder** (string) - Optional - If `return_screenshot` is "as_file", this specifies the folder to save the screenshot. ### Request Example ```python # Click at coordinates without screenshot result = await client.call_tool("sap_click", { "x": 450, "y": 200 }) # Response: {"type": "text", "text": "Status: success"} # Click and capture screenshot to verify result result = await client.call_tool("sap_click", { "x": 350, "y": 150, "return_screenshot": "as_imagecontent" }) # Response includes status and screenshot image for verification # Click on a button and save screenshot for analysis result = await client.call_tool("sap_click", { "x": 800, "y": 300, "return_screenshot": "as_file", "as_file_target_folder": "C:/sap_automation/screenshots" }) # Response: {"type": "text", "text": "Status: success"}, {"type": "text", "text": "Screenshot saved as C:/sap_automation/screenshots/sap_screenshot_20250221_143030.png"} ``` ### Response #### Success Response (200) - **type** (string) - The type of the response (e.g., "text", "image", "resource"). - **text** (string) - If type is "text", contains the status message or screenshot file path. - **data** (string) - If type is "image", contains the base64 encoded image data. - **mimeType** (string) - If type is "image", the MIME type of the image (e.g., "image/png"). - **resource** (object) - If type is "resource", contains details about the embedded resource. - **uri** (string) - The URI of the resource. - **mimeType** (string) - The MIME type of the resource. - **text** (string) - The resource content, often a data URL. #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ```json { "type": "text", "text": "Screenshot saved as C:/sap_automation/screenshots/sap_screenshot_20250221_143030.png" } ``` ``` -------------------------------- ### Manual MCP SAP GUI Server Configuration Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Manual JSON configuration for the MCP SAP GUI server. This includes specifying the command, arguments, working directory, and disable status. ```json { "mcp-sap-gui": { "command": "python", "args": [ "-m", "sap_gui_server.server" ], "cwd": "PATH_TO_YOUR_FOLDER/mcp-sap-gui", "disabled": false, "autoApprove": [] } } ``` -------------------------------- ### Move Mouse and Capture Screenshot (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Moves the mouse cursor to a specified X, Y coordinate within the SAP GUI window and optionally captures a screenshot. The screenshot can be returned as an image content object. This is useful for interacting with elements that appear on hover. ```python result = await client.call_tool("sap_move_mouse", { "x": 500, "y": 250, "return_screenshot": "as_imagecontent" }) ``` -------------------------------- ### Enter Sales Organization in SAP GUI Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt This snippet demonstrates how to enter a sales organization code into an SAP GUI field using the 'sap_type' tool. It simulates typing the organization code followed by a TAB key press. The 'return_screenshot' option is set to 'as_imagecontent'. ```python result = await client.call_tool("sap_type", { "text": "1000{TAB}", "return_screenshot": "as_imagecontent" }) ``` -------------------------------- ### Click at Specific Coordinates Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Performs a mouse click at exact x/y coordinates within the SAP GUI window. Precise coordinate calculation based on image recognition is mandatory. ```python # Example usage sap_gui_server.sap_click(x=100, y=200) ``` -------------------------------- ### Configure MCP for Cline Integration Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Automatically configures MCP settings for integration with Cline. This script handles file path determination, backups, and safe updates to the MCP configuration. ```batch integrate.bat cline ``` -------------------------------- ### Type Text into Fields Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Enters text into the currently active field in the SAP GUI window. The tool types at the cursor's current position. ```python # Example usage sap_gui_server.sap_type('Example Text') ``` -------------------------------- ### Move Mouse Cursor in SAP GUI with MCP SAP GUI Server (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Explains the usage of the `sap_move_mouse` tool to move the mouse cursor to specific coordinates within the SAP GUI window without performing a click. This is useful for hovering actions or preparing for subsequent mouse events. Requires an active client connection. ```python # Move mouse to specific coordinates result = await client.call_tool("sap_move_mouse", { "x": 500, "y": 250 }) # Response: {"type": "text", "text": "Status: success"} ``` -------------------------------- ### sap_move_mouse Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Moves the mouse cursor to a specified position within the SAP GUI window and optionally captures a screenshot, useful for interacting with hover states. ```APIDOC ## POST /sap_move_mouse ### Description Moves the mouse cursor to a specified position within the SAP GUI window and optionally captures a screenshot. This is useful for interacting with hover states or precise element targeting. ### Method POST ### Endpoint /sap_move_mouse ### Parameters #### Request Body - **x** (integer) - Required - The X-coordinate to move the mouse to. - **y** (integer) - Required - The Y-coordinate to move the mouse to. - **return_screenshot** (string) - Optional - Specifies the format of the returned screenshot. Options include "none", "as_file", "as_base64", "as_imagecontent", "as_imageurl". Defaults to "none". ### Request Example ```json { "x": 500, "y": 250, "return_screenshot": "as_imagecontent" } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the type of response, e.g., "text" or "image". - **text** (string) - Status message (e.g., "Status: success"). - **data** (string) - Base64 encoded image content if `return_screenshot` is "as_imagecontent". - **mimeType** (string) - MIME type of the image if `return_screenshot` is "as_imagecontent". #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ``` -------------------------------- ### Type Text in SAP GUI (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Types specified text at the current cursor position in the SAP GUI. It supports special keys using Windows SendKeys syntax, such as Enter (~), Tab ({TAB}), function keys ({F1}-{F16}), and arrow keys. Screenshots can be captured with the output. ```python # Type simple text into a field result = await client.call_tool("sap_type", { "text": "100-200" }) ``` ```python # Type text followed by Tab to move to next field result = await client.call_tool("sap_type", { "text": "CUSTOMER001{TAB}" }) ``` ```python # Type text and press Enter to confirm result = await client.call_tool("sap_type", { "text": "1000~" # ~ is equivalent to {ENTER} }) ``` ```python # Complex input with multiple fields and special keys result = await client.call_tool("sap_type", { "text": "Material123{TAB}100{TAB}EA{ENTER}", "return_screenshot": "as_imagecontent" }) ``` ```python # Use function keys for SAP-specific actions result = await client.call_tool("sap_type", { "text": "{F8}" # Execute in many SAP screens }) ``` ```python # Press Escape to cancel operation result = await client.call_tool("sap_type", { "text": "{ESC}" }) ``` -------------------------------- ### POST /sap_move_mouse Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Moves the mouse cursor to specific coordinates in the SAP GUI window without clicking. Useful for hovering or preparing for subsequent actions. ```APIDOC ## POST /sap_move_mouse ### Description Moves the mouse cursor to specific coordinates in the SAP GUI window without clicking. Useful for hovering over elements to trigger tooltips or preparing for subsequent click actions. ### Method POST ### Endpoint /sap_move_mouse ### Parameters #### Query Parameters - **x** (integer) - Required - The X-coordinate within the SAP GUI window to move the mouse to. - **y** (integer) - Required - The Y-coordinate within the SAP GUI window to move the mouse to. ### Request Example ```python # Move mouse to specific coordinates result = await client.call_tool("sap_move_mouse", { "x": 500, "y": 250 }) # Response: {"type": "text", "text": "Status: success"} ``` ### Response #### Success Response (200) - **type** (string) - The type of the response (e.g., "text"). - **text** (string) - Contains the status message (e.g., "Status: success"). #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ``` -------------------------------- ### Move Mouse Cursor Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Moves the mouse cursor to specified x/y coordinates on the SAP GUI screen. This is often a precursor to other interaction actions. ```python # Example usage sap_gui_server.sap_move_mouse(x=50, y=150) ``` -------------------------------- ### sap_type Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Types text at the current cursor position in the SAP GUI window. Supports special keys for navigation and actions. ```APIDOC ## POST /sap_type ### Description Types text at the current cursor position in the SAP GUI window. Supports special keys using Windows SendKeys syntax including Enter (~), Tab ({TAB}), function keys ({F1}-{F16}), arrow keys ({UP}, {DOWN}, {LEFT}, {RIGHT}), and others like {ESC}, {BACKSPACE}, {DELETE}. ### Method POST ### Endpoint /sap_type ### Parameters #### Request Body - **text** (string) - Required - The text to type, including any special keys. - **return_screenshot** (string) - Optional - Specifies the format of the returned screenshot. Options include "none", "as_file", "as_base64", "as_imagecontent", "as_imageurl". Defaults to "none". ### Request Example ```json { "text": "CUSTOMER001{TAB}", "return_screenshot": "as_imagecontent" } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the type of response, e.g., "text" or "image". - **text** (string) - Status message (e.g., "Status: success"). - **data** (string) - Base64 encoded image content if `return_screenshot` is "as_imagecontent". - **mimeType** (string) - MIME type of the image if `return_screenshot` is "as_imagecontent". #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ``` -------------------------------- ### save_last_screenshot Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Saves the last captured screenshot from any SAP GUI interaction to a specified file path. ```APIDOC ## POST /save_last_screenshot ### Description Saves the last captured screenshot from any SAP GUI interaction to a specified file path. The screenshot is stored internally after each tool call and can be saved later using this tool. ### Method POST ### Endpoint /save_last_screenshot ### Parameters #### Request Body - **filename** (string) - Required - The name or full path where the screenshot file should be saved. ### Request Example ```json { "filename": "order_confirmation.png" } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the type of response, typically "text". - **text** (string) - Confirmation message including the saved file path (e.g., "Screenshot saved as C:/current/working/dir/order_confirmation.png"). #### Response Example ```json { "type": "text", "text": "Screenshot saved as C:/current/working/dir/order_confirmation.png" } ``` ``` -------------------------------- ### Scroll SAP GUI Screen Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Scrolls the SAP GUI screen either up or down. This is useful for navigating content that is not fully visible. ```python # Example usage to scroll down sap_gui_server.sap_scroll('down') # Example usage to scroll up sap_gui_server.sap_scroll('up') ``` -------------------------------- ### Scroll SAP GUI Screen (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Scrolls the content of the SAP GUI window either up or down. The 'direction' parameter accepts 'up' or 'down'. Screenshots can be captured to show the result of the scroll action. ```python # Scroll down to see more content result = await client.call_tool("sap_scroll", { "direction": "down" }) ``` ```python # Scroll up and capture the result result = await client.call_tool("sap_scroll", { "direction": "up", "return_screenshot": "as_imagecontent" }) ``` -------------------------------- ### Save Last Screenshot (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Saves the most recently captured screenshot to a specified file path. Screenshots are stored internally after each tool call and can be saved later using this function. Supports both relative and absolute file paths. ```python # Save the last screenshot to a specific location result = await client.call_tool("save_last_screenshot", { "filename": "order_confirmation.png" }) ``` ```python # Save with full path specification result = await client.call_tool("save_last_screenshot", { "filename": "C:/reports/sap_screen.png" }) ``` -------------------------------- ### sap_scroll Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Scrolls the SAP GUI screen up or down to adjust the viewable content. ```APIDOC ## POST /sap_scroll ### Description Scrolls the SAP GUI screen up or down. The `direction` parameter specifies the scroll direction: "up" moves content down (scrolls the view up), and "down" moves content up (scrolls the view down). ### Method POST ### Endpoint /sap_scroll ### Parameters #### Request Body - **direction** (string) - Required - The direction to scroll. Accepts "up" or "down". - **return_screenshot** (string) - Optional - Specifies the format of the returned screenshot. Options include "none", "as_file", "as_base64", "as_imagecontent", "as_imageurl". Defaults to "none". ### Request Example ```json { "direction": "down", "return_screenshot": "as_imagecontent" } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the type of response, e.g., "text" or "image". - **text** (string) - Status message (e.g., "Status: success"). - **data** (string) - Base64 encoded image content if `return_screenshot` is "as_imagecontent". - **mimeType** (string) - MIME type of the image if `return_screenshot` is "as_imagecontent". #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ``` -------------------------------- ### Save Last Screenshot Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Saves the most recently captured screenshot of the SAP GUI window. The function returns the absolute file path of the saved image. ```python # Example usage saved_path = sap_gui_server.save_last_screenshot() print(f"Screenshot saved to: {saved_path}") ``` -------------------------------- ### End SAP Transaction (Python) Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Terminates the current SAP transaction and closes all associated SAP GUI windows. This action ensures a clean shutdown by terminating saplogon.exe and sapshcut.exe processes. ```python # End the current SAP session result = await client.call_tool("end_transaction", {}) ``` -------------------------------- ### end_transaction Source: https://context7.com/mario-andreschak/mcp-sap-gui/llms.txt Ends the current SAP transaction and closes all SAP GUI windows, ensuring a clean shutdown of the SAP session. ```APIDOC ## POST /end_transaction ### Description Ends the current SAP transaction and closes all SAP GUI windows. This action terminates the `saplogon.exe` and `sapshcut.exe` processes, ensuring a clean shutdown of the SAP session. ### Method POST ### Endpoint /end_transaction ### Parameters #### Request Body This endpoint does not require any parameters. ### Request Example ```json { } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the type of response, typically "text". - **text** (string) - Status message confirming the transaction has ended (e.g., "Status: success"). #### Response Example ```json { "type": "text", "text": "Status: success" } ``` ``` -------------------------------- ### End SAP Transaction Source: https://github.com/mario-andreschak/mcp-sap-gui/blob/main/README.md Closes the current SAP transaction. This tool should be used when the automation task for a transaction is complete. ```python # Example usage sap_gui_server.end_transaction() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.