Skip to main content
Glama
MCP SAP GUI Server

MCP SAP GUI Server

MCP SAP GUI サーバー

SAP GUI自動化のためのモデルコンテキストプロトコル(MCP)サーバー。このサーバーは、SAP GUIとのやり取りを自動化するツールを提供し、SAPトランザクションのプログラムによる制御を可能にします。

画像

要件

  • Python 3.8以上

  • SAP GUIがインストールおよび設定されている

  • 有効な SAP 資格情報 (システム、クライアント、ユーザー、パスワード)

  • Node.js (npx 用)

Related MCP server: sapgui-mcp

インストール

  1. github フォルダーを複製し、セットアップ スクリプトを使用して自動インストールを実行します。

setup.bat

これにより、ビルド プロセスがガイドされ、選択した場合は Cline または Roo に直接統合されます。

  1. またはビルド スクリプトを使用して手動でインストールします。

build.bat
  1. SAP 資格情報を構成します。

  • .env.exampleを.envにコピーする

  • SAP資格情報で値を更新します

  1. mcp インスペクタを使用したテストサーバー:

run.bat debug
  1. 統合スクリプトを使用して、MCP 設定を自動的に構成します。

integrate.bat cline  # Configure for Cline
integrate.bat roo    # Configure for Roo

スクリプトは次のようになります。

  • 正しい設定ファイルのパスを自動的に決定する

  • 変更を加える前にバックアップを作成してください

  • MCP構成を安全に更新する

  • 破損を防ぐために変更を検証する

手動構成(必要な場合):

    "mcp-sap-gui": {
      "command": "python",
      "args": [
        "-m",
        "sap_gui_server.server"
      ],
      "cwd": "PATH_TO_YOUR_FOLDER/mcp-sap-gui",
      "disabled": false,
      "autoApprove": []
    }
  1. このプロンプトを使用して、AI モデルにツールを説明します。

**Important Safety Notice:**
SAP is a highly sensitive system where incorrect interactions can have serious consequences. Every action must be performed with utmost precision and care. When in doubt about any action, STOP immediately and request user assistance.

**Available Tools:**
The `mcp-sap-gui` server provides tools for SAP GUI interaction:
* `launch_transaction`: Start a new transaction
* `sap_click`: Click at specific coordinates
* `sap_move_mouse`: Move mouse to coordinates
* `sap_type`: Enter text into fields
* `end_transaction`: Close the current transaction

**Technical Limitations and Requirements:**
1. You will receive only screenshot images of the SAP GUI window after each action
2. No direct access to screen element metadata or technical representation
3. You must use image recognition to:
   * Identify UI elements (fields, buttons, etc.)
   * Determine precise x/y coordinates for interactions
   * Verify element sizes and positions
4. All coordinates must be exact - approximate clicking is not acceptable

**Step-by-Step Process:**
1. Start SAP GUI Session:
   * Call `launch_transaction` with desired transaction code
   * Analyze the returned screenshot carefully
2. Interact with Screen:
   * Use image recognition to identify needed elements
   * Calculate exact coordinates for interaction
   * Execute appropriate action (`sap_click`, `sap_type`, etc.)
   * Verify result in next screenshot
3. Capture Screenshots:
   * Save screenshots at key points in the process
4. End Session:
   * Call `end_transaction` when finished

**Best Practices:**
1. Always verify screen state before any action
2. Double-check coordinates before clicking
3. Document each step with clear annotations
4. If uncertain about any element position, request user verification
5. Maintain consistent screenshot naming convention

利用可能なツール

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パラメータによって制御されるさまざまなスクリーンショットの戻り形式をサポートしています。

  1. none (デフォルト): 成功/エラーメッセージのみを返します

{
    "type": "text",
    "text": "Status: success"
}
  1. as_file : スクリーンショットを指定されたターゲットフォルダに保存し、パスを返します。

{
    "type": "text",
    "text": "Screenshot saved as C:/path/to/file/screenshot.png"
}

注: as_fileを使用する場合は、 as_file_target_folderパラメータを使用してターゲットフォルダを指定する必要があります。フォルダが存在しない場合は作成されます。

  1. as_base64 : 生のbase64文字列を返す

{
    "type": "text",
    "text": "base64_encoded_string_here"
}
  1. as_imagecontent : MCP ImageContentオブジェクトを返します

{
    "type": "image",
    "data": "base64_encoded_string_here",
    "mimeType": "image/png"
}
  1. as_imageurl : データ URL を含む埋め込みリソースを返します。

{
    "type": "resource",
    "resource": {
        "uri": "application:image",
        "mimeType": "image/png",
        "text": "data:image/png;base64,..."
    }
}

使用例:

# Default - no screenshot
result = await client.call_tool("launch_transaction", {
    "transaction": "VA01"
})

# Save to specific folder
result = await client.call_tool("launch_transaction", {
    "transaction": "VA01",
    "return_screenshot": "as_file",
    "as_file_target_folder": "C:/screenshots"
})

# Get base64 string
result = await client.call_tool("launch_transaction", {
    "transaction": "VA01",
    "return_screenshot": "as_base64"
})

ツールパラメータの概要:

道具

パラメータ

タイプ

デフォルト

説明

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

スクリーンショットを保存するパス

発達

テストの実行

  1. mcp インスペクタを使用したテスト サーバー (ビルド + デバッグ):

./run.bat full
  1. または、テストスイートを使用します。テストスイートには、SAP GUIと連携するライブテストが含まれています。テストを実行する前に、SAP GUIがインストールおよび設定されていることを確認してください。

テストを実行します:

run.bat test server

テスト スイートには次のものが含まれます。

  • SapGuiServer テスト (test_server.py)

    • ツール登録

    • リクエスト処理

    • 応答のフォーマット

    • エラー処理

プロジェクト構造

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

ライセンス

[MITライセンス]

Available Tools

12 tools
end_transactionA

End only the configured session's current transaction. Unsaved work in that transaction can be lost.

Inputs: no named parameters.

launch_transactionC

Start a transaction in the configured session; preserves unrelated SAP sessions.

Inputs: transaction (required), return_screenshot, as_file_target_folder.

sap_clickC

Click physical screenshot pixels relative to the selected SAP window.

Inputs: x (required), y (required), return_screenshot, as_file_target_folder.

sap_get_screenA
Read-only

Read up to 300 SAP COM controls and text (password fields redacted), optionally with screenshot.

Inputs: return_screenshot, as_file_target_folder.

sap_move_mouseC

Move within the selected SAP window using physical screenshot pixels.

Inputs: x (required), y (required), return_screenshot, as_file_target_folder.

sap_pressC

Press a SAP GUI button through its COM interface.

Inputs: element_id (required).

sap_run_guixt_scriptA

Submit a preinstalled GuiXT InputScript to this exact SAP window; requires configured GuiXT opt-in. Completion is asynchronous.

Inputs: script (required).

sap_scrollC

Scroll the selected SAP window.

Inputs: direction (required), return_screenshot, as_file_target_folder.

sap_send_vkeyC

Send a documented SAP virtual key (0 is Enter) to the configured session.

Inputs: key (required).

sap_set_fieldC

Set literal text through SAP GUI ActiveX/COM scripting, scoped to wnd[N] in this session.

Inputs: text (required), element_id (required).

sap_typeA

Type WScript SendKeys text/special keys in the selected SAP window. Use sap_set_field for literal text.

Inputs: text (required), return_screenshot, as_file_target_folder.

save_last_screenshotB

Save the last requested screenshot under SAP_OUTPUT_ROOT without overwriting a file.

Inputs: filename (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools target distinct actions (pixel click, mouse move, scroll, transaction lifecycle, COM field set, button press, virtual key, screenshot). Two pairs overlap somewhat: sap_type vs sap_set_field for entering text, and sap_press vs sap_send_vkey for triggering controls; descriptions mitigate by recommending COM for literal text and documenting vkey behavior.

    Naming Consistency4/5

    All names use snake_case and mostly follow a verb_noun pattern, with a consistent sap_ prefix on interaction tools. However, three lifecycle/screenshot tools (launch_transaction, end_transaction, save_last_screenshot) omit the sap_ prefix, a minor inconsistency.

    Tool Count5/5

    Twelve tools is well-scoped for a GUI automation server: transaction lifecycle, screen reading, several input modalities, screenshots, and GuiXT scripting each earn a place without obvious redundancy.

    Completeness4/5

    The surface covers core GUI automation: transaction start/end, screen scraping, pixel and COM input, scrolling, screenshots, and GuiXT scripting. Minor gaps remain for explicit window selection, waiting for screen readiness, and targeted field value extraction, but agents can work around these with existing tools.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that enables AI assistants to interact with SAP GUI for Windows through the SAP GUI Scripting API.
      61
      505 PyPI
      61
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to execute SAP tasks through a cost-routing MCP server that tries API, recorded scripts, WebGUI, and computer-use vision in cheapest-first order, falling back only when needed. It can also promote an interactive GUI routine into a reusable recorded script to make repeat runs nearly free.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Windows GUI automation through the Model Context Protocol, providing tools, workflows, and generative capabilities for natural language-driven interaction with desktop applications.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to drive SAP GUI for Windows through the SAP GUI Scripting API — connecting to systems, running transactions, reading and writing screen fields, extracting ALV grid, table, tree, and report-list data, and capturing screenshots. Includes server-enforced confirmation points and previews so nothing is written to SAP without explicit user approval.
      MIT