StefiHiu/mcp-sap
If you are the rightful owner of mcp-sap and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository implements a Model Context Protocol (MCP) demo for SAP GenAI solutions, showcasing plug-and-play tool integrations under one unified MCP server.
π MCP for SAP
This repository implements a MCP (Model Context Protocol) demo for SAP GenAI solutions.
The goal is to showcase plug-and-play tool integrations (Playwright, Tosca, UiPath, Jira, Xray, SAP mocks) under one unified MCP server.
It was designed to support RfPs and client demos where stakeholders want to see how different automation/testing tools can be orchestrated dynamically:
- π Switch profiles live (Playwright-only, UiPath-only, Tosca-only, or All)
- π Bridge between tools (e.g., take an Xray test case and generate Tosca assets)
- π Mock SAP metadata and sales orders for realistic workflows
- β‘ Provide a repeatable, single-script demo environment that works with a local LLM (LM Studio)
- π Simulate SAP Fiori UIs with Playwright flows on mock HTML + JSON data
- π€ Demonstrate UiPath/Tosca automation on SAP mocks without needing a live SAP system
π Project Structure
mcp-sap/
β
βββ server/
| βββ mcp_sap.py # MCP server entry point (loads adapters + bridges)
| βββ requirements.txt # Python dependencies
| βββ adapters/ # Separate modules for each adapter
β βββ sap_adapter.py # SAP mocks (sales orders + metadata)
β βββ playwright_adapter.py # Real Playwright actions (check, screenshot, run steps)
β βββ jira_adapter.py # Jira mocks (issues/search)
β βββ xray_adapter.py # Xray mocks (tests, test sets, test executions)
β βββ uipath_adapter.py # UiPath mocks (process list, start job, job status)
| βββ bridges_adapter.py # Bridges between tools, e.g. convert Xray test cases into Tosca packs
| βββ core.py # Script that initializes the MCP server, loads adapters, and manages profile switching between tools
β βββ tosca_adapter.py # Tosca mock asset generator
β
β
βββ data/
β βββ mocks/ # Example JSON mocks for SAP/Jira/Xray/UiPath
| βββ metadata/sap_metadata.json # Example SAP service metadata
| βββ sap/sales_orders.json # Multiple SAP sales orders (for mock UI flows)
|
|
βββ mock-ui/ # Example JSON mocks for SAP/Jira/Xray/UiPath
| βββ flp.html # Fiori Launchpad mock
| βββ sales_orders.html # Sales Orders app mock (reads from sales_orders.json)
β
βββ artifacts/ # Output folder for generated Tosca packs & demo assets
β
βββ README.md # This guide
βοΈ How to Use
0. Environment Setup
Create and activate venv (optional, but recommended)
python3 -m venv .venv
source .venv/bin/activate
Install dependencies
pip install -r requirements.txt
Install Playwright browser
playwright install chromium
Start the static server from the repo root to mock the SAP UI
python3 -m http.server 8000
-> go to http://localhost:8000/mock-ui/flp.html to see the mock fiori launchpad
-> go to http://localhost:8000/data/mocks/sap/sales_orders.json to see the data
-> To stop the static server CTRL + C
1. Set up LM Studio
Download and install LM Studio: https://lmstudio.ai
Go to Program β Install β Edit mcp.json, then paste this with your paths:
{
"mcpServers": {
"sap-mcp-local": {
"command": "absolute/path/to/python/folder (e.g. .../server/.venv/bin/python)",
"args": [
"mcp_sap.py"
],
"cwd": "absolute/path/to/server"
}
}
}
2. Which model to load
We recommend a lightweight instruct model for demos:
qwen2.5-7b-instruct-1m
This model balances speed and quality. Download it in LM Studio, then load it before starting the demo.
3. Summary of Available Tools to Call
- list_capabilities - Lists all available adapters and their current enabled state.
- current_profile - Retrieves the currently active profile settings.
- set_profile - Sets the current profile to enable a specific set of adapters.
- run_with_profile - Atomically sets a profile and calls a tool in one turn, taking
profile
,tool
, andargs_json
as parameters. - pw_check - Checks if a selector is visible on a page; requires URL and selector to check.
- pw_screenshot - Takes a screenshot of a page or a specific element; accepts URL, optional selector for full-page vs. single-element screenshots, output filename, and timeout as parameters.
- pw_run_steps - Runs a series of Playwright steps on the provided start URL with specified actions like navigation, clicking buttons, filling forms, etc.; requires
steps
list and optionallystart_url
. - sapui_wait_ready - Waits until SAP Fioriβs βbusyβ indicators are gone before continuing.
- sapui_open_tile - Opens a Fiori Launchpad (FLP) URL and clicks a specific tile by its visible text to launch an app; requires FLP URL and tile text with optional timeout.
- sapui_click_button - Clicks a Fiori button by ARIA name or visible text like "Create", "Save", etc.; takes the button's visible text or ARIA name along with an optional timeout.
- sapui_fill_by_label - Fills an input field by its label; requires label and value to fill, along with an optional timeout.
- sapui_assert_toast - Asserts that a Fiori MessageToast with specific text appears like "Saved", "Posted"; takes the text to check for appearance.
- sapui_assert_visible - Checks if a specific text or CSS/XPath selector is visible on the page; requires text or selector and an optional timeout.
- sapui_run_flow - Executes a sequence of steps designed for interacting with SAP Fiori applications, including waiting for readiness, opening tiles, clicking buttons, asserting messages, etc.; takes steps as JSON list and optionally start URL and overall timeout.
- jira_status - Checks if the JIRA adapter is enabled.
- jira_mock - Mocks JIRA API calls; supports issue fetching by key or searching via JQL with optional parameters kind (
issue
/search
) and either id (for issues) or jql string for searches. - xray_status - Checks if the XRay adapter is enabled.
- xray_mock - Mocks XRay API calls; supports fetching tests by key, plans by key, or executions with optional parameters kind (
test
/plan
/execution
) and either key (for test/plans) or id (for executions). - uipath_status - Checks if the UiPath adapter is enabled.
- uipath_mock - Mocks UiPath API calls; supports checking processes, starting jobs, or getting job statuses with optional kind (
processes
/start_job
/job_status
) and key (for specific operations like start jobs). - tosca_status - Checks if the Tosca adapter is enabled.
- tosca_pack_from_steps - Generates a Tosca pack from SAP-style steps with options to name it, optionally zip it, and include step lists or requirement text for generating test assets.
- jira_to_uipath_job_spec - Converts JIRA issues into simple UiPath job specs; requires issue key and optional process name for the job start spec.
- xray_to_tosca_pack - Converts XRay tests (mock or real) into Tosca packs in CSV/JSON format or as a ZIP file with required
key
parameter, optional pack_name, and zip_pack boolean. - jira_to_tosca_pack - Creates quick Tosca packs from JIRA issue summaries/descriptions for generating test assets without XRay tests yet; requires issue key, optional name for the generated pack, and a zip option if true.
You can call these functions using the run_with_profile
function to ensure that you are operating within a specific profile context. See more specific examples below.
4. Demo Flow (Copy & Paste into LM Studio Chat)
Open LM Studio chat, load the model and under Integrations select "mcp/sap-mcp-local" and paste:
a. Switch profiles
Call tool list_capabilities
Call tool set_profile name="playwright"
Call tool current_profile
b. SAP mock demo
Call tool set_profile name="sap"
Call tool sap_mock endpoint="sales_order" id="12345"
Call tool sap_metadata service="default"
c. Playwright demo (real browser check)
Call tool set_profile name="playwright"
Call tool pw_check url="https://example.com" selector="h1"
d. Playwright SAP UI mock demo
Call tool set_profile name="playwright"
Call tool sapui_run_flow start_url="http://localhost:8000/mock-ui/flp.html" steps="[
{\"action\":\"open_tile\",\"tile_text\":\"Sales Orders\"},
{\"action\":\"fill_by_label\",\"label\":\"Customer\",\"value\":\"1000001\"},
{\"action\":\"fill_by_label\",\"label\":\"Amount\",\"value\":\"1250.50\"},
{\"action\":\"click_button\",\"name\":\"Create\"},
{\"action\":\"assert_toast\",\"text\":\"Saved\"}
]"
e. UiPath status & mock processes
Call tool set_profile name="uipath"
Call tool uipath_status
Call tool uipath_mock kind="processes"
f. UiPath (mock) run flow on SAP Mock UI
Call tool run_with_profile profile="all" tool="uipath_run_flow_on_mock_ui" args_json="{
\"start_url\":\"http://localhost:8000/mock-ui/flp.html\",
\"steps\": [
{\"action\":\"open_tile\",\"tile_text\":\"Sales Orders\"},
{\"action\":\"assert_visible\",\"text_or_selector\":\"Sales Orders\"},
{\"action\":\"fill_by_label\",\"label\":\"Customer\",\"value\":\"1000001\"},
{\"action\":\"fill_by_label\",\"label\":\"Amount\",\"value\":\"1250.50\"},
{\"action\":\"click_button\",\"name\":\"Create\"},
{\"action\":\"assert_toast\",\"text\":\"Saved\"}
]
}"
g. Generate a UiPath Studio Sequence (.xaml) from steps
Call tool run_with_profile profile="uipath" tool="uipath_generate_xaml" args_json="{
\"steps\": [
{\"action\":\"open_tile\",\"tile_text\":\"Sales Orders\"},
{\"action\":\"fill_by_label\",\"label\":\"Customer\",\"value\":\"1000001\"},
{\"action\":\"click_button\",\"name\":\"Create\"},
{\"action\":\"assert_toast\",\"text\":\"Saved\"}
],
\"file_name\":\"UiPath_Mock_SAP_Demo.xaml\"
}"
h. Tosca demo (mock assets)
Call tool set_profile name="tosca"
Call tool tosca_run_flow_on_mock_ui flow="validate_sales_order"
i. Tosca (mock) run flow on SAP mock UI
Call tool run_with_profile profile="all" tool="tosca_run_flow_on_mock_ui" args_json="{
\"start_url\":\"http://localhost:8000/mock-ui/flp.html\",
\"steps\": [
{\"action\":\"open_tile\",\"tile_text\":\"Sales Orders\"},
{\"action\":\"assert_visible\",\"text_or_selector\":\"Sales Orders\"},
{\"action\":\"fill_by_label\",\"label\":\"Customer\",\"value\":\"1000001\"},
{\"action\":\"fill_by_label\",\"label\":\"Amount\",\"value\":\"1250.50\"},
{\"action\":\"click_button\",\"name\":\"Create\"},
{\"action\":\"assert_toast\",\"text\":\"Saved\"}
]
}"
j. Generate a Tosca mock pack from steps
Call tool run_with_profile profile="tosca" tool="tosca_pack_from_steps" args_json="{
\"steps\": [
{\"action\":\"open_tile\",\"tile_text\":\"Sales Orders\"},
{\"action\":\"fill_by_label\",\"label\":\"Customer\",\"value\":\"1000001\"},
{\"action\":\"click_button\",\"name\":\"Create\"},
{\"action\":\"assert_toast\",\"text\":\"Saved\"}
],
\"pack_name\":\"tosca_sap_mock_demo\",
\"zip_pack\": true
}"
k. Xray to Tosca bridge
Call tool set_profile name="all"
Call tool xray_to_tosca_pack key="SAP-TC-101" pack_name="xray-bridge-demo" zip_pack=true
Result: a ZIP will be created under artifacts/<date>/<pack-id>/
containing:
testcases.csv
modules.csv
testcases.json
README.md
l. Xray -> SAP Playwright flow
Call tool run_with_profile profile="all" tool="run_xray_sapui_flow" args_json="{
\"key\":\"SAP-TC-101\",
\"flp_url\":\"http://localhost:8000/mock-ui/flp.html\",
\"default_tile\":\"Sales Orders\"
}"
m. Jira & Xray status + example searches
Call tool set_profile name="jira"
Call tool jira_status
Call tool jira_mock kind="issue" id="SAP-123"
Call tool jira_mock kind="search" jql="project = SAP AND text ~ \"order\""
π Notes
Mocks vs. Real APIs: Jira/Xray/UiPath run in mock mode unless real credentials via environment variables (.env) are provided.
Artifacts: All generated Tosca packs are placed under artifacts/<date>/....
SAP Mock UI: mock-ui/flp.html
+ sales_orders.html
let Playwright/UiPath/Tosca demonstrate Fiori-style flows without a live SAP system.
Extensibility: New adapters or bridges can be added simply by dropping a script under /adapters