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

要件
Related MCP server: Supabase MCP Server
インストール
github フォルダーを複製し、セットアップ スクリプトを使用して自動インストールを実行します。
これにより、ビルド プロセスがガイドされ、選択した場合は Cline または Roo に直接統合されます。
またはビルド スクリプトを使用して手動でインストールします。
SAP 資格情報を構成します。
.env.exampleを.envにコピーする
SAP資格情報で値を更新します
mcp インスペクタを使用したテストサーバー:
統合スクリプトを使用して、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": []
}
このプロンプトを使用して、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 自動化用の次のツールを提供します。
トランザクション管理
インターフェースの相互作用
sap_click : SAP GUIウィンドウ内の特定の座標をクリックします
sap_move_mouse : マウスカーソルを特定の座標に移動する
sap_type : 現在のカーソル位置にテキストを入力します
sap_scroll : SAP GUI画面をスクロールする(上/下)
スクリーンキャプチャ
スクリーンショットの返却形式
SAP GUI ウィンドウと対話するすべてのツール (launch_transaction、sap_click、sap_move_mouse、sap_type、sap_scroll) は、 return_screenshotパラメータによって制御されるさまざまなスクリーンショットの戻り形式をサポートしています。
none (デフォルト): 成功/エラーメッセージのみを返します
{
"type": "text",
"text": "Status: success"
}
as_file : スクリーンショットを指定されたターゲットフォルダに保存し、パスを返します。
{
"type": "text",
"text": "Screenshot saved as C:/path/to/file/screenshot.png"
}
注: as_fileを使用する場合は、 as_file_target_folderパラメータを使用してターゲットフォルダを指定する必要があります。フォルダが存在しない場合は作成されます。
as_base64 : 生のbase64文字列を返す
{
"type": "text",
"text": "base64_encoded_string_here"
}
as_imagecontent : MCP ImageContentオブジェクトを返します
{
"type": "image",
"data": "base64_encoded_string_here",
"mimeType": "image/png"
}
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
| | スクリーンショットを保存するパス |
発達
テストの実行
mcp インスペクタを使用したテスト サーバー (ビルド + デバッグ):
または、テストスイートを使用します。テストスイートには、SAP GUIと連携するライブテストが含まれています。テストを実行する前に、SAP GUIがインストールおよび設定されていることを確認してください。
テストを実行します:
テスト スイートには次のものが含まれます。
プロジェクト構造
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ライセンス]