Skip to main content
Glama
Time-90

SAP RFC MCP Server

by Time-90

SAP RFC MCP Server

An enterprise-grade SAP RFC connector based on the Model Context Protocol (MCP). This project aims to provide AI agents (such as Claude Desktop, GPT-4, Cursor, etc.) with secure, efficient, and context-aware access to SAP systems. Through the standardized MCP protocol, agents can execute SAP RFCs and retrieve business data as if calling local functions.


🌟 Project Highlights

  • Enterprise-Grade Security: Supports a Master Key management architecture with dynamic token generation, expiration management, and one-click revocation.

  • Full-Chain Tracing: Identity-aware logging system where every log includes the client IP and agent identity, with automatic daily rotation at midnight.

  • Intelligent Table Reading: Built-in data buffer protection mechanism that automatically handles DATA_BUFFER_EXCEEDED errors and supports iterative, secure reading of large-scale data.

  • AI-Optimized Metadata: Provides detailed function interface definitions, parameter descriptions, and supports exporting knowledge bases in RAG-friendly (Retrieval-Augmented Generation) formats.

  • High-Availability Sessions: Supports intelligent session reuse; agents do not need to manually manage Session IDs, as the system automatically restores active sessions based on tokens.


šŸš€ Core Capabilities (Tools)

This server exposes the following toolset to MCP clients, covering the entire process from system discovery to data operations:

1. Core RFC Interaction

  • call_rfc_function: Dynamically calls any SAP RFC function, supporting parameter passing for complex nested structures.

  • rfc_system_info: Retrieves metadata such as SAP system version, protocol, kernel, and database type.

  • get_rfc_functions: Queries available remote call functions in the SAP system via fuzzy matching.

2. Secure Data Reading

  • read_table: A table reading tool with automatic overflow protection that automatically selects fields based on the RFC 512-byte limit.

  • read_table_complete: Iterative reading mode that supports requesting large numbers of fields exceeding buffer limits, with automatic batch processing.

  • get_table_structure: Retrieves detailed definitions of SAP tables, including technical field attributes and multi-language descriptions.

  • test_table_access: Quickly verifies the current user's read permissions and data connectivity for specific tables.

3. Metadata Management

  • get_function_metadata: Retrieves the complete "manual" for a function, including parameter direction, type, length, and multi-language comments.

  • search_rfc_functions: Performs full-text search on function names and descriptions to help agents discover appropriate interfaces.

  • export_metadata_for_rag: Exports SAP interface knowledge as JSON for building offline knowledge bases for agents.


āš™ļø Running Modes

The project supports three running modes to meet integration needs in different scenarios:

  • HTTP Mode (Default): Based on streamable HTTP transport provided by FastAPI, supporting streaming (SSE) responses, suitable for remote agent access.

  • STDIO Mode: Communicates via standard input/output, suitable for locally installed MCP clients like Claude Desktop.

  • Dual Mode: Enables both HTTP and STDIO simultaneously, balancing local debugging and remote service needs.


šŸ“¦ Quick Deployment

1. Environment Requirements

  • Python: 3.9 or higher.

  • SAP NW RFC SDK: Must install the official SAP SDK and configure the SAPNWRFC_HOME environment variable.

2. Installation

git clone <repo_url>
cd sap-rfc-mcp-server
python -m venv .venv
source .venv/bin/activate  # Windows 使用 .venv\Scripts\activate
pip install -e .

3. Configuration

Copy .env.example to .env and fill in your SAP connection parameters and security keys:

# SAP čæžęŽ„
SAP_ASHOST=192.168.1.100
SAP_SYSNR=00
SAP_CLIENT=100
SAP_USER=YOUR_USER
SAP_PASSWD=YOUR_PASSWD

# 安全密钄
MCP_MASTER_KEY=admin-secret-key-2026

šŸ” Authentication Guide

The server uses a two-layer authentication architecture:

  1. Management Layer (Master): Uses MCP_MASTER_KEY to access /auth/* endpoints to perform token issuance.

  2. Business Layer (Agent): Uses generated dynamic tokens to access /mcp/* endpoints to call SAP functions.

Example of generating a token (using Master Key):

POST /auth/token/generate
X-API-Key: admin-secret-key-2026
Body: {"agent_name": "Finance_Agent", "ttl_hours": 48}

šŸ“‚ Project Structure

sap_rfc_mcp_server/
ā”œā”€ā”€ auth.py                # åŠØę€ Token ē®”ē†äøŽęŒä¹…åŒ–
ā”œā”€ā”€ server.py              # MCP å·„å…·å®šä¹‰äøŽå¤„ē†ę øåæƒé€»č¾‘
ā”œā”€ā”€ sap_client.py          # 底层 pyrfc čæžęŽ„ē®”ē†äøŽę± åŒ–
ā”œā”€ā”€ rfc_table_reader.py    # å¢žå¼ŗåž‹č”Øę•°ę®å®‰å…ØčÆ»å–é€»č¾‘
ā”œā”€ā”€ streamable_http_server.py # HTTP/SSE ä¼ č¾“å±‚å®žēŽ°
ā”œā”€ā”€ logger.py              # čŗ«ä»½ę„ŸēŸ„ēš„č‡ŖåŠØåˆ‡åˆ†ę—„åæ—ē³»ē»Ÿ
└── metadata_manager.py    # SAP å…ƒę•°ę®åˆ†ęžäøŽ RAG 优化

šŸ“– More Documentation

  • QUICKSTART.md: 5-minute quick start guide.

  • MODES_GUIDE.md: Detailed explanation of running modes and configuration.

  • DEPLOY.md: Systemd and Docker deployment for production environments.


Ā© 2026 SAP RFC MCP Server Team. Licensed under MIT.

A
license - permissive license
Not graded
quality - not tested
Not graded
maintenance - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Time-90/sap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server