Skip to main content
Glama

RFC_MCP

An MCP server that lets a chat assistant call SAP function modules over classic RFC. It is aimed at SAP ECC, where there is often no OData or ADT surface to use, and works against other ABAP systems too.

Built on open-rfc by Marian Zeis

All RFC communication in this project is done by open-rfc, an SDK-free TypeScript implementation of the SAP RFC protocol written by Marian Zeis. Because of it, this server needs no SAP NW RFC SDK, no native addon and no S-user download.

open-rfc is licensed under Apache-2.0 and is itself adapted in part from open-rfc-go. This project is independent of both, and is not affiliated with or endorsed by SAP SE.

Related MCP server: guniweb-sap-mcp

Status

Built and unit-tested against a scripted SAP. It has not yet been run against a real SAP system. Make the first live call RFC_SYSTEM_INFO on a non-productive client.

Tools

Tool

What it reaches

Intended gating

RfcDescribeFunction

The interface of any function module: parameters, types, and which tool can call it

read

RfcReadTable

Rows of one table through RFC_READ_TABLE, with named fields, an Open SQL selection, a row cap and paging

read

RfcCall

A fixed set of read-only function modules: RFC_SYSTEM_INFO, /SDF/UPL_SYSTEM_STATUS, SCMON_GET_LOG_STATUS, SWNC_GET_DIRECTORY_FRAME, RPY_PROGRAM_READ, RFC_READ_REPORT

read

RfcCallExtended

Function modules you list in RFC_MCP_EXTENDED_FUNCTIONS, for example a BAPI. Not advertised when the list is empty

require an approval for every call

Three guardrails are enforced in src/policy.ts, whatever the SAP user is authorized for:

  1. The function modules behind RfcCall are fixed in code. Anything else has to be listed by the operator and goes through RfcCallExtended.

  2. Sensitive tables are never read: HR master data and payroll clusters (PAnnnn, PBnnnn, HRPnnnn, PCLn, HRPY_*), password hashes (USR02, USH02, USRPWDHISTORY), stored credentials and key material (RFCDES, RSECTAB, SSF_PSE*) and payment-card numbers. The list is a floor, not a data-protection classification of your system. Set RFC_MCP_TABLES to allow only named tables.

  3. Off by default. The process exits unless RFC_MCP_ENABLED=true.

Never callable, even if listed: RFC_ABAP_INSTALL_AND_RUN, RFC_REMOTE_*, SXPG_* (operating system commands), BAPI_USER_* and SUSR_* (user administration), BAPI_TRANSACTION_COMMIT, and every generic table reader. The server refuses to start with one of them, or with a sensitive table, in its configuration.

Limits

  • No transport encryption. Classic RFC without SNC sends the password and the data in clear text. Run the server on a trusted private network next to the SAP system, never across an untrusted one. open-rfc does not support SNC, X.509, SAProuter or message-server logon.

  • Release band. open-rfc 0.2.6 is beta, qualified by its author on SAP NetWeaver 7.50 and SAP S/4HANA 2023. ECC 6.0 EHP8 runs on 7.50. Older ECC releases and non-Unicode systems are untested or unsupported. Check the open-rfc documentation for the current support boundary.

  • Nothing is committed. Each call logs on, runs one function module and logs off. A BAPI that needs BAPI_TRANSACTION_COMMIT therefore does not persist its changes. A function module that commits by itself does, so list only what you have reviewed.

  • A failed call is not proof of no effect. After a timeout or a dropped connection the outcome is unknown. The server never retries.

  • UCON and gateway ACLs still apply. A hardened system may refuse RFC outright. Errors carry a cause (ucon, gateway_acl, rfc_auth, table_auth, row_512, logon, unreachable, absent) so a Basis team knows what to change.

  • One technical user. Calls run as the configured SAP user, not as the person in the chat.

  • RFC_READ_TABLE limits. A row is at most 512 bytes across the selected fields, and some field types are not readable. Name only the fields you need.

Install

Requires Node.js 22.14 or later.

git clone https://github.com/espenleknes-stack/RFC_MCP.git
cd RFC_MCP
npm ci --ignore-scripts
npm run build

Configuration

Variable

Required

Meaning

RFC_MCP_ENABLED

yes

Must be exactly true

SAP_RFC_ASHOST

yes

Application server host

SAP_RFC_SYSNR

no

System number, default 00 (gateway port 33NN)

SAP_CLIENT

yes

Three-digit client

SAP_USER, SAP_PASSWORD

yes

Technical RFC user. Take the password from a secret store, not a committed file

SAP_LANGUAGE

no

Default EN

RFC_MCP_EXTENDED_FUNCTIONS

no

Comma-separated function modules for RfcCallExtended. Exact names, no wildcards

RFC_MCP_TABLES

no

Comma-separated tables. When set, only these are readable

RFC_MCP_MAX_ROWS

no

Row ceiling per table read, default 200, at most 5000

RFC_MCP_TIMEOUT_SECONDS

no

Per-call timeout, default 25

Give the SAP user S_RFC for the function groups it calls and S_TABU_DIS (or S_TABU_NAM) for the tables it reads, and no more than the tools are meant to reach.

Use it from an MCP client

The server speaks MCP over stdio. A typical client entry:

{
  "mcpServers": {
    "sap-ecc-rfc": {
      "command": "node",
      "args": ["/absolute/path/to/RFC_MCP/dist/index.js"],
      "env": {
        "RFC_MCP_ENABLED": "true",
        "SAP_RFC_ASHOST": "ecc-app01.corp.example.com",
        "SAP_RFC_SYSNR": "00",
        "SAP_CLIENT": "100",
        "SAP_USER": "RFC_CHAT",
        "SAP_PASSWORD": "<from your secret store>",
        "RFC_MCP_EXTENDED_FUNCTIONS": "BAPI_MATERIAL_GET_DETAIL"
      }
    }
  }
}

A good first conversation: ask for the system information (RfcCall with RFC_SYSTEM_INFO), then describe a function module with RfcDescribeFunction before calling it. Parameter names are case-sensitive and follow the function module's interface.

Configure your MCP host to ask for approval before RfcCallExtended. The server marks it with readOnlyHint: false; the three other tools carry readOnlyHint: true.

Development

npm test            # builds, then runs the unit tests and starts the built entry point
npm run typecheck
npm run pack:check

Logs go to stderr as one JSON object per event: tool, function module, outcome, cause and duration. Parameters, rows and credentials are never logged.

License

Licensed under the Apache License 2.0, the same license as open-rfc.

Trademarks

SAP, ABAP, SAP ECC, SAP S/4HANA and SAP NetWeaver are trademarks or registered trademarks of SAP SE or its affiliates.

Available Tools

3 tools
RfcCallA
Read-only

Call one of the fixed read-only SAP function modules: RFC_SYSTEM_INFO (system id, release, kernel, host and code page); /SDF/UPL_SYSTEM_STATUS (whether usage logging (UPL) is active and since when); SCMON_GET_LOG_STATUS (ABAP call monitor (SCMON) collection status); SWNC_GET_DIRECTORY_FRAME (workload statistics (ST03N) periods available); RPY_PROGRAM_READ (program source with includes); RFC_READ_REPORT (raw report source). No other function module is callable with this tool.

Inputs: function (required), parameters.

RfcDescribeFunctionA
Read-only

Read the interface of one SAP function module: its import, export, changing and tables parameters, their types, and which tool can call it. Use this before a call; parameter names are case-sensitive.

Inputs: function (required).

RfcReadTableA
Read-only

Read rows of one SAP table over RFC. Name the fields you need (a row is limited to 512 bytes in total) and narrow with "where" in Open SQL syntax, for example MANDT = '100' AND MTART = 'FERT'. At most 200 rows per call; page with skipRows. HR, payroll, password and credential tables are never readable.

Inputs: table (required), fields (required), where, maxRows, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 3 tools

    Disambiguation5/5

    The three tools target distinct operations: describing a function module interface, reading table rows, and calling a fixed whitelist of function modules. Their boundaries are clear, and the descriptions reinforce when each should be used.

    Naming Consistency4/5

    All names use the same Rfc prefix and PascalCase action-oriented style. RfcCall is a slight deviation because it lacks an explicit noun object compared with RfcDescribeFunction and RfcReadTable, but the convention remains readable.

    Tool Count5/5

    Three tools are well-scoped for a narrow read-only SAP RFC server. Each tool has a clear, broad responsibility without excessive fragmentation.

    Completeness3/5

    The set covers core safe-read operations: table reads, function-module calls from a whitelist, and interface introspection. However, discovery is notably incomplete: there is no way to list available function modules/tables or describe table schemas, which may leave agents guessing field names and structures.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to integrate with SAP systems via OData REST APIs for querying entity sets, performing CRUD operations, and executing function imports. It features automatic service discovery, CSRF token management, and smart connection handling without requiring the SAP RFC SDK.
      11
      13
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants and n8n workflows to interact with SAP S/4HANA and ECC systems via OData, IDoc, and RFC/BAPI, with governed read-only-by-default access and multiple authentication types.
      3
      ISC
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to discover, inspect, and call SAP RFC-enabled function modules (BAPIs/RFCs) with configurable read/write policies, transaction support, audit logging, and ABAP source retrieval.
      6
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to securely read and write SAP ABAP development objects via the ADT REST API, enforcing policy-based guardrails such as package/namespace allow-lists, read-only mode, human approvals, and audit logging.
      8
      2
      MIT