Labsco
toni-ramchandani logo

sapient-mcp

โ˜… 8

from toni-ramchandani

MCP toAutomate SAP GUI

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedPaid serviceAdvanced setup

SAPient MCP

Intelligent SAP GUI automation for AI agents

A production-ready Model Context Protocol (MCP) server that enables LLMs (Claude, Copilot, Cursor, etc.) to automate SAP GUI using the RoboSAPiens library.

Compatible MCP Clients

ClientModeNotes
Claude DesktopstdioFull support
Claude CodestdioFull support
Cursorstdio or SSEFull support
VS Code (GitHub Copilot)stdio or SSERequires Copilot agent mode
Windsurfstdio or SSEFull support
Any MCP clientSSE/HTTPVia --port flag

Environment Variables

All settings can be provided as env vars with the ROBOSAP_MCP_ prefix:

VariableDefaultDescription
ROBOSAP_MCP_SAPLOGON_PATHC:\...\saplogon.exePath to SAP Logon executable
ROBOSAP_MCP_SAP_SERVERnullServer description for auto-connect
ROBOSAP_MCP_SAP_CLIENTnullSAP client for auto-login
ROBOSAP_MCP_SAP_USERnullSAP user for auto-login
ROBOSAP_MCP_SAP_PASSWORDnullSAP password (never logged)
ROBOSAP_MCP_PORTnull (stdio)Port for SSE mode
ROBOSAP_MCP_CAPS""Comma-separated caps: screenshot,codegen,advanced
ROBOSAP_MCP_OUTPUT_DIR./sap_outputScreenshots and logs directory
ROBOSAP_MCP_SCREENSHOT_ON_ERRORtrueAuto-screenshot on tool failures

Available Tools

Core (always loaded)

ToolDescription
sap_openLaunch SAP Logon
sap_connect_to_serverConnect to SAP server
sap_connect_to_runningAttach to running SAP session
sap_get_session_infoRead-only: current state & title
sap_closeClose SAP
sap_execute_transactionRun a transaction code
sap_activate_tabClick a tab by label
sap_get_window_titleRead-only: current window title
sap_select_menu_itemNavigate menu bar
sap_send_keySend keyboard key (Enter, F3, etc.)
sap_fill_text_fieldFill a field by its label
sap_clear_text_fieldClear a field
sap_set_checkboxCheck a checkbox
sap_unset_checkboxUncheck a checkbox
sap_select_radio_buttonSelect a radio button
sap_push_buttonClick a button by label
sap_button_existsRead-only: check if button exists
sap_read_text_fieldRead-only: read field value
sap_read_textRead-only: read any text element
sap_read_status_barRead-only: SAP status bar message
sap_count_table_rowsRead-only: table row count
sap_select_table_rowSelect a table row
sap_read_table_cellRead-only: read a cell value
sap_fill_cellFill a table cell
sap_double_click_cellDouble-click a table cell
sap_scroll_tableScroll table up/down

--caps screenshot

ToolDescription
sap_take_screenshotCapture SAP window screenshot

--caps codegen

ToolDescription
sap_get_generated_scriptGet accumulated Robot Framework script
sap_clear_scriptClear script buffer

--caps advanced

ToolDescription
sap_get_snapshotStructured JSON snapshot of current window

Example LLM Conversation

You: Create a purchase order for vendor 100001, company code 1000, with 50 units of material ABC-001

SAPient will guide the LLM to:

  1. Call sap_execute_transaction("/nME21N")
  2. Call sap_get_window_title() โ†’ "Create Purchase Order"
  3. Call sap_fill_text_field("Vendor", "100001")
  4. Call sap_fill_text_field("Company Code", "1000")
  5. Call sap_send_key("Enter") to accept header
  6. Call sap_activate_tab("Item Overview")
  7. Call sap_fill_cell("1", "Material", "ABC-001")
  8. Call sap_fill_cell("1", "Quantity", "50")
  9. Call sap_push_button("Save")
  10. Call sap_read_status_bar() โ†’ "Purchase order 4500001234 created"

Project Structure

sapient-mcp/
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ sap_config.json              # Example config file
โ”œโ”€โ”€ claude_desktop_config.json   # Example Claude Desktop config
โ””โ”€โ”€ src/
    โ””โ”€โ”€ sapient_mcp/
        โ”œโ”€โ”€ __init__.py
        โ”œโ”€โ”€ __main__.py          # Entry point + CLI arg parsing
        โ”œโ”€โ”€ config.py            # Pydantic settings (env/file/CLI)
        โ”œโ”€โ”€ session.py           # SAPSessionManager singleton
        โ””โ”€โ”€ server.py            # FastMCP server + all 27 tool definitions

Logs

Logs are written to {output_dir}/sapient_mcp.log.

In stdio mode, logs never go to stdout/stderr (would break JSON-RPC). In SSE mode, logs also appear on stderr.