ABAP Syntax Checker MCP Server

ABAP Syntax Checker MCP Server

An MCP server that connects to SAP ERP systems via RFC to perform native ABAP syntax checking, enabling AI assistants to validate ABAP code without direct SAP GUI access.

Category
访问服务器

README

ABAP Syntax Checker MCP Server

A Model Context Protocol (MCP) server that provides ABAP REPORT program syntax checking capabilities for IDEs like Claude Code and Kiro.

Overview

This MCP server connects to SAP ERP systems via RFC protocol to perform native ABAP syntax checking. It enables AI assistants to validate ABAP code without requiring direct access to SAP GUI.

Features

  • ✅ ABAP REPORT program syntax validation
  • ✅ Detailed error reporting with line numbers and descriptions
  • ✅ RFC-based communication with SAP ERP systems
  • ✅ Standard MCP protocol implementation
  • ✅ Comprehensive logging and error handling

Prerequisites

  • Python 3.9 or higher
  • SAP NetWeaver RFC SDK
  • Access to an SAP ERP system with appropriate credentials
  • pyrfc library (requires SAP NW RFC SDK)

Quick Start

  1. Install SAP NetWeaver RFC SDK (see detailed instructions in Installation section)
  2. Clone this repository:
    git clone https://github.com/leocaogit/ABAP_CHECK_MCP.git
    cd ABAP_CHECK_MCP
    
  3. Install Python dependencies:
    pip install -r requirements.txt
    
  4. Configure SAP connection:
    cp config/config.example.json config.json
    # Edit config.json with your SAP credentials
    
  5. Deploy ABAP function module (see abap/DEPLOYMENT_GUIDE.md)
  6. Test the server:
    python -m src.main --config config.json
    

Installation

1. Install SAP NetWeaver RFC SDK

The pyrfc library requires the SAP NetWeaver RFC SDK to be installed on your system.

Download:

  • Visit the SAP Support Portal: https://support.sap.com/en/product/connectors/nwrfcsdk.html
  • Download the appropriate version for your operating system (requires SAP S-user)

Installation:

macOS:

# Extract the SDK
unzip nwrfc750P_8-70002752.zip -d /usr/local/sap

# Set environment variables (add to ~/.zshrc or ~/.bash_profile)
export SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
export DYLD_LIBRARY_PATH=$SAPNWRFC_HOME/lib:$DYLD_LIBRARY_PATH

Linux:

# Extract the SDK
unzip nwrfc750P_8-70002752.zip -d /usr/local/sap

# Set environment variables (add to ~/.bashrc)
export SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
export LD_LIBRARY_PATH=$SAPNWRFC_HOME/lib:$LD_LIBRARY_PATH

Windows:

# Extract the SDK to C:\nwrfcsdk
# Add C:\nwrfcsdk\lib to your PATH environment variable

2. Install Python Dependencies

pip install -r requirements.txt

Verify installation:

python -c "from pyrfc import Connection; print('pyrfc installed successfully')"

Configuration

The server can be configured using environment variables or a JSON configuration file.

Option 1: Environment Variables

Copy the example environment file and edit it with your SAP credentials:

cp config/.env.example .env

Edit .env:

# SAP RFC Connection Configuration
SAP_HOST=your-sap-host.example.com
SAP_SYSNR=00
SAP_CLIENT=100
SAP_USER=your-username
SAP_PASSWORD=your-password

# Logging Configuration (optional)
LOG_LEVEL=INFO

Option 2: Configuration File

Copy the example configuration file and edit it with your SAP credentials:

cp config/config.example.json config.json

Edit config.json:

{
  "rfc": {
    "host": "your-sap-host.example.com",
    "sysnr": "00",
    "client": "100",
    "user": "your-username",
    "password": "your-password"
  },
  "log_level": "INFO"
}

Security Note: Never commit files containing real credentials to version control.

Usage

Starting the MCP Server

Using a configuration file:

python -m src.main --config config.json

With custom log level:

python -m src.main --config config.json --log-level DEBUG

MCP Client Configuration

For Claude Desktop

Edit your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "abap-syntax-checker": {
      "command": "python",
      "args": ["-m", "src.main", "--config", "config.json"],
      "cwd": "/absolute/path/to/ABAP_CHECK_MCP"
    }
  }
}

For Kiro

Create or edit .kiro/settings/mcp.json in your workspace:

{
  "mcpServers": {
    "abap-syntax-checker": {
      "command": "python",
      "args": ["-m", "src.main", "--config", "config.json"],
      "cwd": "/absolute/path/to/ABAP_CHECK_MCP",
      "disabled": false,
      "autoApprove": ["check_abap_syntax"]
    }
  }
}

Using the Tool

Once configured, the check_abap_syntax tool will be available in your IDE.

Example Usage:

Check this ABAP code for syntax errors:

REPORT ztest.
DATA: lv_test TYPE string.
lv_undefined = 'test'.
WRITE: / lv_test.

Response:

{
  "success": true,
  "has_errors": true,
  "errors": [
    {
      "line": 3,
      "type": "E",
      "message": "Field \"LV_UNDEFINED\" is unknown."
    }
  ],
  "message": "Syntax check completed with errors"
}

SAP Backend Setup

The MCP server requires an ABAP function module to be deployed in your SAP ERP system.

Quick deployment summary:

  1. Create structure ZSYNTAX_ERROR in SE11
  2. Create function group ZSYNTAX_CHECK in SE80
  3. Create function module Z_CHECK_ABAP_SYNTAX in SE37
  4. Copy implementation code and activate

For detailed step-by-step instructions, see:

  • Deployment Guide: abap/DEPLOYMENT_GUIDE.md
  • ABAP README: abap/README.md

Project Structure

.
├── src/                    # Source code
│   ├── __init__.py
│   ├── main.py            # Entry point
│   ├── server.py          # MCP server implementation
│   ├── rfc_client.py      # RFC client wrapper
│   ├── config.py          # Configuration management
│   ├── models.py          # Data models
│   ├── tool_handler.py    # MCP tool handler
│   └── logger.py          # Logging configuration
├── tests/                  # Test files
│   ├── __init__.py
│   └── test_tool_handler.py
├── abap/                   # ABAP artifacts
│   ├── function_module/
│   ├── function_group/
│   ├── types/
│   ├── DEPLOYMENT_GUIDE.md
│   └── README.md
├── config/                 # Configuration files
│   ├── .env.example
│   └── config.example.json
├── pyproject.toml         # Project configuration
├── requirements.txt       # Dependencies
└── README.md             # This file

Development

Running Tests

pytest

Code Formatting

black src/ tests/

Troubleshooting

RFC Connection Issues

Problem: Error: Cannot connect to SAP system

Solutions:

  • Verify SAP system is accessible from your network
  • Check credentials and client number are correct
  • Ensure SAP NetWeaver RFC SDK is properly installed
  • Check firewall settings for RFC ports

Syntax Check Errors

Problem: Function module Z_CHECK_ABAP_SYNTAX not found

Solutions:

  • Verify the ABAP function module is deployed (see abap/DEPLOYMENT_GUIDE.md)
  • Check the function module name is exactly Z_CHECK_ABAP_SYNTAX
  • Ensure the function module is activated in SE37

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Support

For issues and questions, please open an issue on the GitHub repository.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选