Token导航 LogoToken导航TokenDH.com
Gorfc MCP Server logo
搜索检索未说明官方级别未说明来源级核验

Gorfc MCP Server

MCP Server

一个通过RFC连接LLMs与SAP系统的MCP服务器,支持调用BAPIs/RFCs、获取表元数据和性能监控

工具数

8

提示词数

0

GitHub Stars

0

资源数

0
GoClaude搜索Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

thm-ma

提供方

thm-ma

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

gorfc-mcp-server

A Model Context Protocol (MCP) server that connects LLMs to SAP systems via RFC (Remote Function Call). It exposes SAP RFC operations as MCP tools over stdio transport, allowing AI agents to ping SAP systems, describe function modules, invoke BAPIs/RFCs, and retrieve call metrics.

Prerequisites

  • Go 1.24+
  • SAP NW RFC SDK installed at /usr/local/sap/nwrfcsdk/ (headers in include/, libraries in lib/)
  • A SAP connection configured either via a sapnwrfc.ini file or environment variables (see Configuration)

SAP NetWeaver RFC SDK Proprietary Notice

The SAP NetWeaver RFC SDK is proprietary software owned by SAP SE. It is not open-source and is subject to specific licensing terms.

Licensing & Access

  • No Redistribution: You are not permitted to redistribute the SDK binaries (.dll, .so, .dylib) in your own applications or repositories.
  • Customer Access: Access requires a valid SAP license and an S-User ID for the SAP Support Portal.
  • Legal Source: Binaries must only be downloaded from the official SAP Software Download Center.

Official Resources

Build

make build           # compiles to ./gorfc-mcp-server
make build-windows   # cross-compiles to ./gorfc-mcp-server.exe (Windows x86_64)
make clean           # removes built binaries

The build uses CGO with flags pointing to the SAP NW RFC SDK:

CGO_CFLAGS="-I/usr/local/sap/nwrfcsdk/include"
CGO_LDFLAGS="-L/usr/local/sap/nwrfcsdk/lib"

Cross-compiling for Windows

The build-windows target cross-compiles for Windows x86_64 using MinGW. It requires a Windows build of the SAP NW RFC SDK with headers and libraries available at the configured SDK path and the MinGW-w64 cross-compiler (x86_64-w64-mingw32-gcc).

Install on Debian/Ubuntu:

  sudo apt install gcc-mingw-w64-x86-64

Configuration

Two connection modes are supported.

Mode 1 — ini-based (SAP_DEST)

Create a sapnwrfc.ini file (standard SAP NW RFC SDK format) in the working directory and reference the destination by name:

DEST=SID
TYPE=A
ASHOST=sap.example.com
SYSNR=00
CLIENT=100
USER=rfcuser
PASSWD=secret
LANG=EN
Note: sapnwrfc.ini contains plaintext credentials and is gitignored. Never commit this file.

Mode 2 — direct environment variables

Skip the ini file and supply connection parameters directly via environment variables.

Direct application-server connection:

VariableRequiredDescription
SAP_ASHOSTYesApplication server hostname
SAP_SYSNRNoSystem number (default 00)
SAP_CLIENTYesSAP client / mandant
SAP_USERYesLogon user
SAP_PASSWDYesLogon password
SAP_LANGNoLogon language (e.g. EN)

Load-balancing / message-server connection:

VariableRequiredDescription
SAP_MSHOSTYesMessage server hostname
SAP_MSSERVNoMessage server service / port
SAP_SYSIDNoSAP System ID
SAP_GROUPNoLogon group
SAP_CLIENTYesSAP client / mandant
SAP_USERYesLogon user
SAP_PASSWDYesLogon password
SAP_LANGNoLogon language

Running

ini-based

Pass the destination name via SAP_DEST or as the first CLI argument:

SAP_DEST=SID ./gorfc-mcp-server
./gorfc-mcp-server SID

The SID is the unique, three-character alphanumeric identifier for the SAP system as defined in sapnwrfc.ini:

SIDDescription
DEVDevelopment and configuration system
QASQuality Assurance and testing system
PRDProduction (live) environment

Direct environment variables

# Direct application-server connection
SAP_ASHOST=sap.example.com SAP_SYSNR=00 \
  SAP_CLIENT=100 SAP_USER=rfcuser SAP_PASSWD=secret \
  ./gorfc-mcp-server

# Load-balancing connection
SAP_MSHOST=msg.example.com SAP_SYSID=SID SAP_GROUP=PUBLIC \
  SAP_CLIENT=100 SAP_USER=rfcuser SAP_PASSWD=secret \
  ./gorfc-mcp-server

Logs are written to stderr with a [gorfc-mcp] prefix.

Test

# ini-based
SAP_DEST=SID go test -tags integration ./cmd/gorfc-mcp-server/

# direct env vars
SAP_ASHOST=sap.example.com SAP_SYSNR=00 SAP_CLIENT=100 \
  SAP_USER=rfcuser SAP_PASSWD=secret \
  go test -tags integration ./cmd/gorfc-mcp-server/

MCP Client Configuration

Claude Desktop

ini-based:

{
  "mcpServers": {
    "sap": {
      "command": "/path/to/gorfc-mcp-server",
      "args": ["SID"],
      "env": {
        "LD_LIBRARY_PATH": "/usr/local/sap/nwrfcsdk/lib"
      }
    }
  }
}

Direct environment variables:

{
  "mcpServers": {
    "sap": {
      "command": "/path/to/gorfc-mcp-server",
      "env": {
        "LD_LIBRARY_PATH": "/usr/local/sap/nwrfcsdk/lib",
        "SAP_ASHOST": "sap.example.com",
        "SAP_SYSNR": "00",
        "SAP_CLIENT": "100",
        "SAP_USER": "rfcuser",
        "SAP_PASSWD": "secret",
        "SAP_LANG": "EN"
      }
    }
  }
}

Claude Code

ini-based:

claude mcp add sap /path/to/gorfc-mcp-server -- SID

Direct environment variables (use claude mcp add --env flags or set them in your shell before launching):

Tools

Model Context Protocol (MCP) tools designed for SAP connectivity, metadata inspection, and table discovery via the NetWeaver RFC SDK.


Tool Overview

ToolDescription
rfc_pingVerify SAP connectivity.
rfc_connection_infoGet connection attributes and NW RFC SDK version.
rfc_describeGet function module metadata (parameters, types, directions).
rfc_callInvoke an RFC function module with parameters.
get_table_metadataRetrieve field details (types, length, domain) for a table.
get_table_relationsRetrieve foreign-key relationships and cardinalities.
search_sap_tablesSearch for tables by description/business term.
metrics_getReturn call statistics and performance metrics.

SAP Connectivity Tools

rfc_ping

Pings the connected SAP system to verify connectivity.

  • Parameters: None.

rfc_connection_info

Returns connection attributes such as System ID, Client, Host, and the SAP NW RFC SDK version.

  • Parameters: None.

rfc_describe

Returns the full metadata of an RFC function module. Use this to understand the interface before calling.

ParameterTypeRequiredDescription
function_namestringYesName of the RFC (e.g. STFC_CONNECTION)

rfc_call

Invokes an RFC function module with the given parameters and returns the result.

ParameterTypeRequiredDescription
function_namestringYesName of the RFC function module to call
parametersobjectNoInput parameters for the function call

Parameter Value Type Mapping

ABAP TypeJSON ValueFormat / Note
INT, INT1, INT2, INT8numberStandard integer
FLOAT, BCD, DECFnumberFloating point or decimal
CHAR, STRING, NUMstringTextual data
DATEstringYYYYMMDD
TIMEstringHHMMSS
BYTE, XSTRINGstringbase64-encoded
STRUCTUREobjectKey-value pairs
TABLEarrayArray of objects

Data Dictionary (DDIC) Tools

get_table_metadata

SAP Function module: DDIF_FIELDINFO_GET Returns the fields of a given SAP table including field name, ABAP type, length, domain, and short description.

ParameterTypeRequiredDefaultDescription
table_namestringYes-The SAP table name (e.g. SFLIGHT)
languagestringNoDLanguage for text/descriptions

get_table_relations

SAP Function module: FAPI_GET_FOREIGN_KEY_RELATIONS Retrieves foreign-key relationships for the specified table, including referenced check tables and cardinalities.

ParameterTypeRequiredDescription
table_namestringYesThe SAP table name

search_sap_tables

SAP Function module: RFC_READ_TABLE (targeting DD02T) Performs a LIKE-style search over table short texts to find tables by description.

ParameterTypeRequiredDefaultDescription
search_termstringYes-The text to search for (LIKE semantics)
languagestringNoDLanguage for search
max_resultsintegerNo100Maximum results to return

Additional Helper Functions

  • sanitizeABAPString: Escapes single-quotes and other characters for safely embedding user strings into ABAP WHERE clauses or RFC_READ_TABLE filters.
  • parseReadTableResult: Parses the legacy DATA/WA row format from RFC_READ_TABLE into a structured array of maps ([]map[string]string) keyed by column name.

Monitoring

metrics_get

Returns in-memory call statistics: total/successful/failed call counts, total and average duration, and per-function call counts.

  • Parameters: None.

Architecture

All logic lives in a single file: cmd/gorfc-mcp-server/main.go.

  • connManager — Thread-safe wrapper around gorfc.Connection. All RFC calls are serialized through a mutex since the SAP NW RFC SDK is not thread-safe per connection handle. Includes auto-reconnect with exponential backoff (3 retries, starting at 100ms). Constructed via newConnManager(dest) (ini-based) or newConnManagerFromParams(params) (direct parameters).
  • connParamsFromEnv — Reads SAP_ASHOST/SAP_MSHOST and related env vars and returns a gorfc.ConnectionParameters map. Returns nil when no direct-connection vars are set so the caller can fall back to SAP_DEST.
  • coerceParams / coerceValue — Type coercion layer that converts JSON-deserialized Go types (float64, string, etc.) to the specific Go types gorfc expects. Recursively handles structures and tables.
  • validateParameters — Pre-call validation that all parameter names exist in the function description.
  • metrics — In-memory call counter tracking total/success/failure counts, durations, and per-function stats.

Example Prompts

See EXAMPLES.md for example prompts to use with this server.

License

Apache License 2.0

目录标签

目录标签

GoClaude搜索SAP集成本地部署RFC协议企业系统连接元数据检索ABAP工具

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

8

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP