SAP Connect: Running San Miguel Corporation SAP Data Queries in the Agent

Introduction

In SAP environments, querying tables or calling BAPIs usually requires assembling authentication tickets, zero-padded parameters, and pagination rules while switching back and forth between scripts and conversational interfaces. By codifying this workflow in a universal SKILL.md and letting Agents like Cursor or Claude Code execute it step-by-step, you can reduce the repeated overhead of environment setup and verbal instructions. Below is the sap connect Skill on SkillHub (coordinate @user_ee21d0b2/mf-sap-data, v1.0.0), which packages Ming Fai Group’s internal SAP query capabilities into an installable skill.

What Is This

sap connect is listed on SkillHub under the display name sap connect, while the in-package documentation title is “SAP Data Query Skill”. It is positioned as a community Skill (source: community) dedicated to Ming Fai Group SAP data queries. The publisher coordinate is user_ee21d0b2, the category is it-ops-security, and the page tags show requires_api_key=false, meaning that installing the Skill itself does not require a SkillHub API Key—this is separate from the corporate authentication needed to reach the SAP gateway.

The Skill calls the Group portal-side APIs via HTTP (ticket authentication, BAPI invocation, table/column metadata, and table-data queries) and documents the JSON output structure, 18-digit material numbers padded with leading zeros, 12-digit production order numbers padded similarly, pagination, and field-count limits. The included PACKAGE_INFO.json records version 1.0.0 with the description “SAP Data Query Skill – Ming Fai Group exclusive”.

Core Functions

Based on the package’s SKILL.md and code directories, the verified capabilities include:

  1. WeCom-related authentication: Collects information such as the last six digits of the ID card to obtain an SAP access ticket and manages ticket lifecycle (the docs state a 24-hour validity).
  2. BAPI invocation: Calls BAPIs by RFC name and parameters; the documentation example uses BAPI_MATERIAL_GET_DETAIL, with left-padding for material barcodes and production order numbers.
  3. Table & view queries: Specifies table name, fields, filters, and sorting, supports pagination; filter conditions use fields like FieldName, Calculation, Lower (consistent with references/api_spec.md).
  4. Intelligent query: Builds queries on specified tables from natural-language intent (intelligent_query).
  5. Result handling: Standardized JSON output, export to JSON / Excel / CSV, and interfaces for query history and status retrieval.

Core modules live under core/ (auth.py, bapi_client.py, table_client.py, query_builder.py), with query templates in assets/query_templates.json.

Installation & Activation

Installing to an Agent via the SkillHub CLI

The official SkillHub page instructs you to read the SkillHub installation guide and then install the coordinate @user_ee21d0b2/mf-sap-data.

  1. Ensure the skillhub CLI is present on your machine (if not, follow the installation guide’s curl script).
  2. During installation you must point --dir to the current Agent’s skills directory; otherwise the default ./skills/ location may not be recognized. Example:
skillhub install mf-sap-data --namespace user_ee21d0b2 --dir ~/.cursor/skills/

Common directories: Claude Code uses ~/.claude/skills/; Codex uses ~/.codex/skills/ or a project-level .agents/skills/. After installation, restart or refresh the skill list according to your client.

You can also search by running:

skillhub search mf-sap-data

Python Dependencies & Environment Variables

The package contains Python code. Install dependencies within the skill directory:

pip install -r requirements.txt

The README.md explains configuring SAP gateway endpoints and application info via .env. Typical variables (use the documentation’s endpoint domain, and run in an intranet-reachable environment):

SAP_AUTH_ENDPOINT=https://info02.mingfaigroup.com/api/account/agent/getticket
SAP_BAPI_ENDPOINT=https://info02.mingfaigroup.com/api/sap/sapinvoke/invoke
SAP_TABLE_COLUMNS_ENDPOINT=https://info02.mingfaigroup.com/api/sap/sapinvoke/gettablecolumns
SAP_TABLE_DATA_ENDPOINT=https://info02.mingfaigroup.com/api/sap/sapinvoke/gettabledata
SAP_APP_NAME=mf.portal.agent
SAP_APP_VERSION=1.0
SAP_TIMEOUT=60
SAP_MAX_PAGE_SIZE=10000
SAP_DEFAULT_PAGE_SIZE=1000
SAP_MAX_PAGES=100

The package also ships scripts/test_connection.py for connectivity checks; install.py and scripts/setup.py handle environment initialization—run them from the skill root as described in the README.

Typical Usage

The examples below come from the package’s SKILL.md / README.md. Class names like SAPDataQuerySkill and import paths should match the package structure after installation (Agents usually follow the steps in SKILL.md during a session).

Authentication

from sap_data_query_skill import SAPDataQuerySkill

skill = SAPDataQuerySkill()
auth_result = skill.authenticate(
    work_code="MS00051286",
    identity="123456"  # last six digits of the ID card
)

Table Query (MARA raw-material example)

result = skill.query_table(
    table_name="MARA",
    fields=["MATNR", "MAKTX", "MEINS", "MATKL"],
    filters=[
        {
            "FieldName": "MATKL",
            "Calculation": "Equal",
            "Lower": "ROH"
        }
    ],
    orders=[{"FieldName": "MATNR", "Direction": "Ascend"}],
    page_size=1000
)

BAPI & Formatting

bapi_result = skill.query_bapi(
    rfc_name="BAPI_MATERIAL_GET_DETAIL",
    params={"MATERIAL": skill.format_material_code("123456")}
)

Export

export_result = skill.export_results(
    result=result,
    format="excel",
    file_path="物料查询结果.xlsx"
)

The documentation also defines query limits: default page size 1,000 rows, max page size 10,000 rows, maximum 100 pages, recommended return fields ≤ 20 (hard cap 50), and a query timeout of 60 seconds.

Use Cases & Considerations

Who It’s For

  • Operations or business analysts inside Ming Fai Group who already have SAP query permissions and want to query tables, call BAPIs, and export results via an AI Agent following a unified specification.
  • Teams that need to reuse the same authentication flow, parameter zero-padding, and JSON output format across members.

Limitations & Risks

  • The documentation clearly states: For internal Ming Fai Group use only; unauthorized external sharing is prohibited. The API host info02.mingfaigroup.com typically requires intranet or whitelist access; external networks cannot reproduce the examples directly.
  • SkillHub metadata shows roughly 1,124 downloads (per page statistics) and a rating field of 100000. Before installing, review the security scan and permission disclosures on SkillHub and conduct an internal audit of the package scripts and network scope.
  • requires_api_key=false only means the SkillHub installation side needs no API Key; actual queries still rely on authentication data such as employee number and the last six digits of the ID card. Handle sensitive data according to Group data-protection policies (the docs mention masking and log encryption requirements).
  • The technical support email listed in the docs is it-support@minghuigroup.com; users outside Ming Fai Group generally cannot access the Skill’s backend endpoints.

Conclusion

sap connect packages Ming Fai Group’s SAP ticket authentication, BAPI calls, table queries, and export workflow into a standard Skill, enabling one-click installation into Agents like Cursor via SkillHub and step-by-step execution guided by SKILL.md. Official entry points:

  • SkillHub page: https://www.skillhub.cn/skills/user_ee21d0b2/mf-sap-data
  • API coordinate page: https://api.skillhub.cn/user_ee21d0b2/mf-sap-data

Installation coordinate: @user_ee21d0b2/mf-sap-data, version 1.0.0.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye