Provides tools for calling SAP functions through a RESTful API, enabling interaction with SAP systems to execute business functions like BAPI_GL_GETGLACCPERIODBALANCES for retrieving financial data and other SAP operations.
SAP MCP Server and Client / SAP MCP服务器和客户端
English | 中文
English
This project provides an MCP (Model Context Protocol) server and client implementation for interacting with SAP systems via a RESTful API.
Project Structure
config.json
: Configuration file for SAP API connectionsap_server.py
: MCP server implementation with SAP function calling toolsap_client.py
: MCP client demonstrating usage of the serverrequirements.txt
: Python dependenciestest_mcp_client_final.py
: HTTP-based MCP client testsimple_test.py
: Simple HTTP test for the MCP server
Installation
- Install the required dependencies (MCP SDK version 1.3.0 or higher):
Configuration
Update the config.json
file with your SAP API connection details:
If you don't need authentication, you can leave the username
and password
fields as they are or remove them entirely.
Usage
Running the Client
To run the client example:
This will:
- Start the MCP server
- Connect to it via stdio
- Execute example SAP function calls
- Display the results
Running the Server in HTTP Mode
To run the server in HTTP mode:
Testing with HTTP Client
To test with the HTTP client:
Using the MCP Tool Directly
The MCP server provides a call_sap_function
tool with the following parameters:
function_name
(string, required): Name of the SAP function to callparameters
(object, optional): Parameters for the SAP function
Example tool call:
How It Works
- The MCP server (
sap_server.py
) provides a tool calledcall_sap_function
- When called, this tool makes an HTTP POST request to your SAP RESTful API
- The API response is returned through the MCP protocol to the client
- The client (
sap_client.py
) demonstrates how to use this tool with example calls
Extending the Implementation
To add more SAP functions or modify the behavior:
- Modify the
call_sap_tool
function insap_server.py
- Add additional examples in
sap_client.py
- Update the configuration in
config.json
as needed
Error Handling
The implementation includes basic error handling for:
- Network errors
- JSON parsing errors
- Missing function names
Errors are returned in the response as JSON objects with an "error" key.
Additional Notes
For SAP dynamic RFC code, please contact: zhangxj1@foxmail.com
中文
本项目提供了一个通过RESTful API与SAP系统交互的MCP(Model Context Protocol)服务器和客户端实现。
项目结构
config.json
:SAP API连接的配置文件sap_server.py
:MCP服务器实现,包含SAP函数调用工具sap_client.py
:演示服务器使用方法的MCP客户端requirements.txt
:Python依赖项test_mcp_client_final.py
:基于HTTP的MCP客户端测试simple_test.py
:用于MCP服务器的简单HTTP测试
安装
- 安装所需的依赖项(MCP SDK版本1.3.0或更高):
配置
更新config.json
文件中的SAP API连接详情:
如果不需要身份验证,可以保留username
和password
字段不变或完全删除它们。
使用方法
运行客户端
运行客户端示例:
这将:
- 启动MCP服务器
- 通过stdio连接到服务器
- 执行示例SAP函数调用
- 显示结果
以HTTP模式运行服务器
以HTTP模式运行服务器:
使用HTTP客户端测试
使用HTTP客户端进行测试:
直接使用MCP工具
MCP服务器提供了一个名为call_sap_function
的工具,具有以下参数:
function_name
(字符串,必需):要调用的SAP函数名称parameters
(对象,可选):SAP函数的参数
工具调用示例:
工作原理
- MCP服务器(
sap_server.py
)提供了一个名为call_sap_function
的工具 - 调用时,该工具向您的SAP RESTful API发出HTTP POST请求
- API响应通过MCP协议返回给客户端
- 客户端(
sap_client.py
)演示如何使用此工具进行示例调用
扩展实现
要添加更多SAP函数或修改行为:
- 修改
sap_server.py
中的call_sap_tool
函数 - 在
sap_client.py
中添加更多示例 - 根据需要更新
config.json
中的配置
错误处理
实现包含基本的错误处理:
- 网络错误
- JSON解析错误
- 缺少函数名称
错误以包含"error"键的JSON对象形式在响应中返回。
附加说明
如需获取SAP动态RFC代码,请联系:zhangxj1@foxmail.com
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables interaction with SAP systems through RESTful APIs via MCP protocol. Supports calling SAP functions like BAPI with parameters and returns structured responses for SAP data operations.
Related MCP Servers
- AsecurityAlicenseAqualityProvides a standardized way for MCP clients to interact with Apache Airflow's REST API, supporting operations like DAG management and monitoring Airflow system health.Last updated -6677PythonMIT License
- -securityAlicense-qualityAn MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.Last updated -8PythonMIT License
- AsecurityAlicenseAqualityA server that bridges the Model Context Protocol (MCP) with SAP ABAP systems, allowing tools like Cline to retrieve ABAP source code, table structures, and other development artifacts.Last updated -1329TypeScriptMIT License
mcp-alapi-cnofficial
-securityAlicense-quality这是一个基于 ALAPI 的 MCP (Model Control Protocol) 服务器实现,可以通过MCP协议直接调用ALAPI的接口Last updated -6GoMIT License