Skip to main content
Glama

abap-mcp

CI Python License

An MCP server that lets AI coding agents read, review and test ABAP code without an SAP system.

AI coding agents are good at Python and TypeScript because they can explore a codebase, run a linter and run the tests. ABAP code usually lives inside an SAP system, so an agent gets none of that. It writes code blind, and a human finds the problems after a transport.

abap-mcp closes that gap for code stored as abapGit files. An agent (Claude, GitHub Copilot, Kilo Code, Cline...) can list the objects in a repository, outline a class before changing it, review its own output against Clean ABAP, run full static analysis, and execute ABAP Unit tests, all on a laptop.

Tools

Tool

What the agent gets

Needs

list_objects

Every class, interface and program in an abapGit folder, with its files

Python

outline_object

Methods with visibility and full signature, attributes, test classes, and the line range of every method body

Python

check_conventions

A fast Clean ABAP review of a snippet or an object. Each finding has a fix and cites the style guide section

Python

lint

Full static analysis with abaplint: syntax, types, obsolete statements, naming

Node.js

run_tests

ABAP Unit tests executed on Node.js through the abaplint transpiler, with pass/fail counts and failing test names

Node.js

The rule catalog is also exposed as the MCP resource abap-mcp://rules.

Related MCP server: abap2UI5 MCP Server

Example

The agent has just written this and asks for a review before saving it:

METHOD calculate.
  DATA lv_sum TYPE i.
  MOVE iv_amount TO lv_sum.
  IF NOT lv_sum IS INITIAL.
    ev_total = lv_sum.
  ENDIF.
ENDMETHOD.

check_conventions answers with something the agent can act on directly:

[
  { "rule": "no-hungarian-notation", "line": 2,
    "message": "'lv_sum' encodes its scope or type in a prefix",
    "suggestion": "Name it for what it holds, e.g. 'sum'" },
  { "rule": "no-obsolete-statements", "line": 3,
    "message": "'MOVE' is obsolete", "suggestion": "Use an assignment: target = source." },
  { "rule": "prefer-is-not", "line": 4,
    "message": "Negation placed before the operand", "suggestion": "Write 'lv_sum IS NOT ...'" }
]

Then run_tests on a project like jakkwi/SAP returns {"passed": true, "tests_passed": 21, "tests_total": 21, ...}. The agent has verified its change without anyone opening SAP GUI.

Quick start

Requires Python 3.11+. Node.js 20+ is optional and enables lint and run_tests.

pipx install git+https://github.com/jakkwi/abap-mcp
# or run it without installing:
uvx --from git+https://github.com/jakkwi/abap-mcp abap-mcp --root path/to/abap/repo

Connect an agent

Claude Code

claude mcp add abap -- abap-mcp --root /path/to/abap/repo

Claude Desktop, Kilo Code, Cline (mcpServers in the client's MCP settings file):

{
  "mcpServers": {
    "abap": {
      "command": "abap-mcp",
      "args": ["--root", "/path/to/abap/repo"]
    }
  }
}

VS Code with GitHub Copilot (.vscode/mcp.json):

{
  "servers": {
    "abap": { "command": "abap-mcp", "args": ["--root", "${workspaceFolder}"] }
  }
}

To share one server across a team, run it over HTTP instead of stdio:

abap-mcp --root /srv/abap --http --host 0.0.0.0 --port 8000   # endpoint: /mcp
# or
docker build -t abap-mcp . && docker run -p 8000:8000 -v "$PWD:/workspace" abap-mcp

How it works

flowchart LR
    A[AI agent] -- MCP: stdio or HTTP --> S[abap-mcp server]
    S --> W[Workspace<br/>path sandbox, abapGit layout]
    W --> P[Statement splitter<br/>+ outline]
    P --> R[Clean ABAP rules]
    S --> L[abaplint CLI]
    S --> T[npm test<br/>transpiler + ABAP Unit]
  • Statement splitter (source.py). ABAP statements end with a period, except when the period sits in a string literal, a string template, a comment or a member access. A single pass with explicit state handles all of these, keeps line numbers, and attaches ABAP Doc comments to the statement they document.

  • Outline (outline.py). Turns statements into classes, interfaces, methods and attributes. The signature parser knows that in IMPORTING a TYPE REF TO zif_x b TYPE STANDARD TABLE OF t WITH EMPTY KEY the parameters are a and b, not zif_x or t.

  • Rules (rules.py). Each rule is a small generator registered with a decorator, so adding a check is one function and one test.

  • Workspace (workspace.py). Every path arrives from a language model, so it is untrusted. Paths are resolved and must stay inside the root the server was started with: ../, absolute paths and symlinks pointing outside are refused.

  • Toolchain (tooling.py). Runs abaplint and npm as subprocesses with timeouts and without a shell. When Node.js is missing, the result says so and the pure-Python tools keep working.

Design decisions

  • Two levels of checking. check_conventions is instant and works on a snippet that has not been saved yet, which suits an agent iterating in a loop. lint is slower, needs Node.js and understands types. Agents use the first constantly and the second before finishing.

  • Errors are results, not exceptions. An unknown object or a bad path comes back as {"error": "..."}, so the agent can correct itself instead of failing the whole call.

  • Read-only by default. Every tool except run_tests carries the MCP readOnlyHint, so clients can auto-approve them.

  • No SAP system, no vendor code. Everything runs on open-source tooling. All sample ABAP in this repository is original.

Development

pip install -e ".[dev]"
pytest              # 46 tests; the abaplint tests run when Node.js is available
ruff check . && ruff format --check .
mypy src            # strict

The tests drive the server through a real MCP client, the same way an agent does.

Roadmap

  • Read objects directly from an SAP system over the ADT REST API, as an optional backend

  • More rules: magic numbers, nested IF depth, SELECT in loops

  • Quick fixes returned as text edits the agent can apply

License

MIT. See LICENSE.

Available Tools

5 tools
check_conventionsA
Read-onlyIdempotent

Review ABAP against Clean ABAP conventions. Fast and needs no Node.js.

Pass either source (a snippet you just wrote) or object_name (an object in the workspace). Each finding cites the style guide section.

Args: source: ABAP source text to review. object_name: Name of an object in the workspace to review instead. path: Project folder relative to the workspace root. max_method_statements: Statement limit for a single method.

Inputs: path, source, object_name, max_method_statements. Returns: result

lintA
Read-onlyIdempotent

Run abaplint static analysis (syntax, types, obsolete code, naming).

Lints source when given, otherwise the project at path, using the project's own abaplint.json if it has one. Requires Node.js.

Args: source: ABAP source text to lint instead of a project. path: Project folder relative to the workspace root.

Inputs: path, source. Returns: result

list_objectsB
Read-onlyIdempotent

List the ABAP objects (classes, interfaces, programs...) in an abapGit folder.

Args: path: Project folder relative to the workspace root.

Inputs: path. Returns: result

outline_objectB
Read-onlyIdempotent

Describe a class or interface: methods with visibility and signature, attributes, test classes, and the line range of every method body.

Args: object_name: Object name, e.g. ZCL_ORDER_TOTAL. path: Project folder relative to the workspace root.

Inputs: object_name (required), path. Returns: result

run_testsA
Idempotent

Run the ABAP Unit tests of a project that executes them on Node.js (abaplint transpiler + open-abap), via npm test. No SAP system needed.

Args: path: Project folder containing package.json. install: Reinstall npm dependencies before testing.

Inputs: path (required), install. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation4/5

    list_objects (enumerate) and outline_object (describe one object) are clearly distinct, and run_tests is unambiguous. The only real overlap is check_conventions vs lint, both static-quality checks, though the descriptions differentiate them (Clean ABAP style-guide findings vs abaplint syntax/type/naming analysis).

    Naming Consistency4/5

    Four of five tools follow a predictable verb_noun snake_case pattern (list_objects, outline_object, check_conventions, run_tests). 'lint' is a bare verb that breaks the pattern slightly but is still conventional and readable.

    Tool Count4/5

    Five tools is a lean but reasonable surface for a read-only ABAP analysis server, and each tool has a distinct role. It sits slightly on the thin side, but nothing feels redundant or missing at the count level.

    Completeness4/5

    The analysis workflow (discover, outline, style-check, lint, test) is well covered for a read-only server. Minor gaps remain: no way to fetch an object's raw source and no object/code search, which agents can partially work around via outline_object and lint's source argument.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to read, write, activate, and transport ABAP code in SAP systems via ABAP ADT REST API, without needing SAP GUI.
      24
      576 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Provides AI coding agents a full abap2UI5 development loop—writing ABAP classes, validating views, deploying, and running apps headless with screenshots—all locally without an SAP system.
      9
      73 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to perform ABAP Development Tools operations on SAP ERP (ECC and S/4HANA) systems, including source code editing, object activation, syntax checks, and ABAP unit tests.
      14 npm
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI coding assistants to connect directly to SAP ABAP systems via ABAP Development Tools, so they can retrieve and manage source code for programs, classes, interfaces, functions, tables, and CDS views. Also supports RAP development, running unit tests and coverage checks, inspecting transports and version history, and working across multiple SAP systems.
      65
      MIT