Skip to content

jfilak/mcp-sapcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP for sapcli

sapcli is a command-line tool that enables access to SAP products from scripts and automation pipelines.

This MCP server is build on top of FastMCP

Requirements

Python => 3.10

Installation

First clone sapcli's repository because it has been published as PyPI package yet:

git clone https://github.com/jfilak/sapcli

Then make update PYTHONPATH to allow Python find the module sap:

export PYTHONPATH=$(pwd)/sapcli

Finally clone this MCP server repository, create virtual environment, and install already packaged dependencies:

git clone https://github.com/jfilak/mcp-sapcli
cd mcp-sapcli
python3 -m venv ve
source ./ve/bin/activate
pip install fastmcp pydantic pyodata

Usage

To start HTTP server on localhost:8000 run the following bash command:

python3 src/sapcli-mcp-server.py

You can customize the host and port with command line arguments:

python3 src/sapcli-mcp-server.py --host 0.0.0.0 --port 9000
Argument Default Description
--host 127.0.0.1 Host address to bind to
--port 8000 Port to listen on

Tools

The MCP server automatically converts sapcli commands into MCP tools. This approach simplifies the MCP server maintenance and makes new tool exposure super simple. However, by default, only the tools that has been manually tested are exposed.

The tools uses the following name schema:

  • abap_<command>_<subcommand>_<?etc ...>

Note: the prefix abap was not probably the best idea but currently sapcli works only with SAP ABAP systems.

If you are brave and not scared of possible crashes, start the MCP server with the command line flag --experimental.

python3 src/sapcli-mcp-server.py --experimental

Implementation Details

  • MCP tool definitions are automatically generated from Python's ArgParser definitions in the module sap.cli
  • every sapcli command is supposed to use sap.cli.core.PrintConsole to print out data (no direct output is allowed)
  • MCP server replaces the default sap.cli.core.PrintConsole with it is own buffer based implementation and returns the captured output
  • the sapcli functions handling commands take the PrintConsole object from the given args under the member console_factory

Verified tools

Experimental tools

The following tools are available when the server is started with --experimental. They have been automatically generated from sapcli commands but have not been manually verified yet.

  • abap_include_attributes
  • abap_include_create
  • abap_include_read
  • abap_include_activate
  • abap_interface_create
  • abap_interface_read
  • abap_interface_activate
  • abap_class_attributes
  • abap_class_execute
  • abap_class_create
  • abap_class_activate
  • abap_ddl_create
  • abap_ddl_activate
  • abap_dcl_create
  • abap_dcl_read
  • abap_dcl_write
  • abap_dcl_activate
  • abap_bdef_create
  • abap_bdef_read
  • abap_bdef_write
  • abap_bdef_activate
  • abap_functiongroup_create
  • abap_functiongroup_read
  • abap_functiongroup_write
  • abap_functiongroup_activate
  • abap_functiongroup_include_create
  • abap_functiongroup_include_read
  • abap_functiongroup_include_write
  • abap_functiongroup_include_activate
  • abap_functionmodule_chattr
  • abap_functionmodule_create
  • abap_functionmodule_read
  • abap_functionmodule_write
  • abap_functionmodule_activate
  • abap_atc_customizing
  • abap_atc_profile_list
  • abap_atc_profile_dump
  • abap_datapreview_osql
  • abap_package_check
  • abap_cts_create
  • abap_cts_release
  • abap_cts_delete
  • abap_cts_reassign
  • abap_cts_list
  • abap_checkout_class
  • abap_checkout_program
  • abap_checkout_interface
  • abap_checkout_function_group
  • abap_checkout_package
  • abap_activation_inactiveobjects_list
  • abap_adt_collections
  • abap_abapgit_link
  • abap_abapgit_pull
  • abap_rap_binding_publish
  • abap_rap_definition_activate
  • abap_table_create
  • abap_table_read
  • abap_table_write
  • abap_table_activate
  • abap_structure_create
  • abap_structure_read
  • abap_structure_write
  • abap_structure_activate
  • abap_dataelement_define
  • abap_dataelement_create
  • abap_dataelement_read
  • abap_dataelement_write
  • abap_dataelement_activate
  • abap_checkin
  • abap_badi
  • abap_badi_list
  • abap_badi_set-active
  • abap_featuretoggle_state
  • abap_featuretoggle_on
  • abap_featuretoggle_off
  • abap_gcts_clone
  • abap_gcts_config
  • abap_gcts_delete
  • abap_gcts_checkout
  • abap_gcts_log
  • abap_gcts_pull
  • abap_gcts_commit
  • abap_gcts_user_get-credentials
  • abap_gcts_user_set-credentials
  • abap_gcts_user_delete-credentials
  • abap_gcts_repo_set-url
  • abap_gcts_repo_set-role-target
  • abap_gcts_repo_set-role-source
  • abap_gcts_repo_activities
  • abap_gcts_repo_messages
  • abap_gcts_repo_objects
  • abap_gcts_repo_property_get
  • abap_gcts_repo_property_set
  • abap_gcts_repo_branch_create
  • abap_gcts_repo_branch_delete
  • abap_gcts_repo_branch_list
  • abap_gcts_repo_branch_update_filesystem
  • abap_gcts_system_config_get
  • abap_gcts_system_config_list
  • abap_gcts_system_config_set
  • abap_gcts_system_config_unset
  • abap_gcts_task_info
  • abap_gcts_task_list
  • abap_gcts_task_delete
  • abap_startrfc
  • abap_strust_list
  • abap_strust_createpse
  • abap_strust_createidentity
  • abap_strust_removepse
  • abap_strust_getcsr
  • abap_strust_putpkc
  • abap_strust_upload
  • abap_strust_putcertificate
  • abap_strust_getowncert
  • abap_strust_listcertificates
  • abap_strust_dumpcertificates
  • abap_user_details
  • abap_user_create
  • abap_user_change
  • abap_bsp_upload
  • abap_bsp_stat
  • abap_bsp_delete
  • abap_flp_init

About

MCP for sapcli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors