Skip to main content
Glama
SAP connector for Claude

SAP connector for Claude

SAP connector for Claude

A read-only MCP server that lets Claude work with SAP S/4HANA directly: read any table the way SE16 does, let SAP do the arithmetic (totals, trial balance, ageing, GR/IR, duplicate checks), run your SAP GUI reports and export them to Excel, and fetch document attachments. Built for finance teams, with token efficiency as the main design goal. It runs as a Claude plugin on Windows and macOS.

What it can do

Area

Tools

Table reads

read_sap_table, describe_sap_table, aggregate_sap_table (SUM / COUNT / MIN / MAX / AVG, GROUP BY, top N)

Calculations inside SAP

trial_balance_by_period (ACDOCA), open_items_ageing, grir_differences, find_duplicates

SAP GUI reports

find_sap_reports, sap_report_info, run_sap_report (ALV output saved to Excel)

Attachments

get_attachments (GOS files saved to Downloads, never pasted into the chat)

Development

get_sap_source (ABAP code of programs, classes, function modules), get_program_parts (text elements, GUI statuses, screens), get_smartform (Smart Form outline + XML), read_sap_text (SO10 texts)

Customizing shortcuts

condition_types, pricing_procedure, account_determination

OData

list_services, get_service_metadata, query_entity

Session

sap_login, whoami, list_environments, switch_environment, token_budget

Related MCP server: sap-mcp-server

How it works

  • Python MCP server (src/sap_mcp, mcp SDK 2.x) talking to SAP Gateway over OData v2, GET only.

  • One small custom Gateway service, ZCFG_READ_SRV, does table reads and calculations inside SAP (ReadTable, GetTableFields, Compute). ABAP source and a step-by-step SEGW / transport guide are in sap_side/. New calculations are new ABAP operations only; no SEGW change.

  • Claude plugin (plugin/): launch.cmd / launch.sh install a private Python environment on first start; tools/build_plugin.py assembles the folder you publish to your Claude organisation.

Security model

  • Read-only. The client refuses POST / PUT / PATCH / DELETE. (run_sap_report runs real reports; the tool text tells Claude to ask before running anything that could post.)

  • Everyone logs in as themselves. sap_login opens a small window; the password never passes through the chat and is stored in the OS keychain (Windows Credential Manager or the macOS Keychain). SAP authorizations decide what each user sees.

  • No credentials or server addresses in the code. Your systems live in a git-ignored site.json.

  • Usage controls: large results are saved to Excel instead of being sent to Claude; each conversation has a data allowance that only the user can extend (a click in a window); every call is logged locally.

Set-up

  1. SAP side: build ZCFG_READ_SRV with the guide in sap_side/README.md and activate it in your systems.

  2. Your systems: copy site.example.json to site.json and fill in your Gateway addresses, clients and a one-line company note (company codes, chart of accounts, currency). Without it, the login window asks each user for the server address.

  3. Build the plugin: python tools/build_plugin.py creates ../sap-plugin, with your site.json inside.

  4. Publish that folder to your Claude organisation's plugin library, or add it as a local plugin.

  5. Use it: in Claude, say "log in to SAP", then ask your question.

Users need network access to your SAP Gateway (office network or VPN for internal systems).

Development

python -m venv .venv
.venv\Scripts\pip install -e ".[dev]"      # macOS: .venv/bin/pip
.venv\Scripts\python -m pytest              # offline, SAP calls are mocked

Design rules and lessons learned are in CLAUDE.md.

Licence

MIT, see LICENSE. SAP and S/4HANA are trademarks of SAP SE; this project is not affiliated with SAP.

Available Tools

22 tools
account_determinationA

MM account determination (OBYC / T030) with G/L names. transaction key e.g. WRX (GR/IR), BSX (inventory), GBB (offsetting), PRD (price diff), KDM (FX diff). chart_of_accounts: empty = the configured chart(s); "*" = all incl. SAP sample charts (only if asked). Optional valuation_class (BKLAS), account_modifier (KOMOK), valuation_modifier (BWMOD).

Inputs: language, transaction, valuation_class, account_modifier, +2 more. Returns: result

aggregate_sap_tableA

Totals computed in SAP: one call instead of paging rows. measures: comma list of SUM:f, AVG:f, MIN:f, MAX:f, COUNT, COUNTD:f (results named SUM_HSL, ROW_COUNT, COUNTD_BELNR...). group_by: comma fields (empty = one row). where: ABAP Open SQL. order_by: result columns, e.g. "SUM_HSL DESC" with top=20. top max 1000. E.g. TB: table=ACDOCA, measures=SUM:HSL, group_by=RACCT, where="RLDNR = '0L' AND RBUKRS = '1000' AND GJAHR = '2026'".

Inputs: table (required), top, where, group_by, +2 more. Returns: result

condition_typesA

Pricing condition types (T685/T685T/T685A) with texts, access sequence and control data. No condition_type: paged list (limit/offset; prefer search, sales has ~1000); with one: all filled fields. application: V sales, M purchasing, TX tax. usage A = pricing. language: 1-letter key.

Inputs: limit, usage, offset, search, +3 more. Returns: result

describe_sap_tableA

A table's fields (name, type, length, key, description); cached 7 days. search filters by name or description; refresh re-reads from SAP.

Inputs: table (required), search, refresh. Returns: result

find_duplicatesA

Groups of rows sharing the same values on fields (comma list), computed in SAP, most frequent first. E.g. duplicate invoices: table=RBKP, fields=LIFNR,XBLNR,RMWWR. where: ABAP Open SQL. min_count default 2; top max 1000.

Inputs: table (required), fields (required), top, where, +1 more. Returns: result

find_sap_reportsA

Find reports by name pattern (programs and their transaction codes, with titles), e.g. "ZFI*", "AGEING".

Inputs: top, pattern. Returns: result

get_attachmentsA

GOS attachments of an SAP document: lists them and saves the files to Downloads/SAP attachments (content is never returned; open the saved file). kind: invoice (MIRO, needs year), material_doc (needs year), po, fi (needs year + company_code). Or raw object_type + object_key (e.g. BUS2091). download=false only lists.

Inputs: kind, year, folder, number, +4 more. Returns: result

get_service_metadataB

OData service structure: entity sets, or one entity's keys and fields (cached 7 days). raw=true returns the full EDMX (very large; avoid). refresh re-downloads.

Inputs: service (required), raw, entity, refresh. Returns: result

grir_differencesA

GR/IR differences computed in SAP from EKBE: per PO item, GR vs IR quantity and value, only mismatches. Optional vendor, po, key_date (YYYY-MM-DD, default today). top max 1000.

Inputs: company_code (required), po, top, vendor, +1 more. Returns: result

list_environmentsB

SAP systems available, which is active, and login status. No SAP call.

Inputs: no named parameters. Returns: result

list_servicesB

Search the Gateway catalog for OData services by name/title substring. Prefer a search term over paging.

Inputs: limit, offset, search. Returns: result

open_items_ageingA

Vendor/customer ageing computed in SAP: open items at key_date (YYYY-MM-DD, default today) per partner in buckets by days past net due (not due, 1-30, 31-60, 61-90, 91-180, >180), with names. account_type: vendor | customer. top max 1000.

Inputs: account_type (required), company_code (required), top, partner, +1 more. Returns: result

pricing_procedureB

Steps of a pricing procedure (T683S, as in V/08 / M/08) with texts; only filled fields, field_legend explains columns. application V/M/TX or empty for all; usage A = pricing.

Inputs: name (required), usage, language, application. Returns: result

query_entityC

Generic OData v2 query ($select/$filter/$orderby/$top/$skip/$expand) on a service's entity set.

Inputs: service (required), entity_set (required), top, skip, +4 more. Returns: result

read_sap_tableA

Read rows of any SAP table or DB view, like SE16. FIRST CHOICE for SAP data. For totals use aggregate_sap_table; unsure of field names: describe_sap_table. where: ABAP Open SQL, not OData: 'quoted' literals, internal formats (leading zeros, dates '20250401'), e.g. "KAPPL = 'M' AND KSCHL LIKE 'Z%'". fields: comma list (keys always included); name them, wide tables get large. top max 1000; page with skip (answer gives next_skip). drop_empty omits blank fields.

Inputs: table (required), top, skip, where, +2 more. Returns: result

run_sap_reportA

Run an SAP GUI report (tcode or program) and save its output: ALV to Excel with the report's own headings (Downloads/SAP reports), classic lists to text. Returns path, columns, preview; read the file for the rest. ASK THE USER FIRST before any report that may post, change or send anything. variant: saved variant (easiest). selections override it: {"S_BUKRS": "1000", "P_KEYDT": "20260930", "S_KUNNR": ["1000","1001"], "S_BUDAT": {"low": "20260401", "high": "20260930"}}, internal formats. max_rows max 5000. No popups; must finish in ~55 s.

Inputs: report (required), folder, variant, max_rows, +1 more. Returns: result

sap_loginA

Opens a login window on the user's screen for their own SAP user (password never in chat; kept in the OS keychain). Use when a tool reports missing or rejected credentials, or when asked. env: prod (default) | dev. Waits up to 10 min.

Inputs: env. Returns: result

sap_report_infoA

A report's selection fields and saved variants (report = tcode or program). Call before run_sap_report.

Inputs: report (required). Returns: result

switch_environmentA

Point all SAP tools at prod or dev (also production/development/test/SID) for this session. Non-prod answers carry _sap_env: never report them as live books. Same env = reload login.

Inputs: env (required). Returns: result

token_budgetB

SAP data pulled in this conversation, per tool, and the limits. No SAP call. reset=true asks the USER in a window for more allowance.

Inputs: reset. Returns: result

trial_balance_by_periodA

Trial balance from ACDOCA computed in SAP: per G/L account opening (incl. carry-forward), period debit/credit, closing, with names. periods 1-16 (opening = periods before period_from); optional account range; ledger default 0L. Full-year results are also saved to Excel.

Inputs: fiscal_year (required), company_code (required), ledger, period_to, +3 more. Returns: result

whoamiC

Active SAP system, host, client and user.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 22 tools

    Disambiguation4/5

    Most tools occupy distinct niches: purpose-built analytics (trial_balance_by_period, open_items_ageing, grir_differences, account_determination, pricing_procedure) are clearly separable, and descriptions explicitly steer choices (read_sap_table 'FIRST CHOICE', aggregate for totals, describe for field names). Minor overlap remains between query_entity (OData) and read_sap_table (Open SQL/SE16) and between find_duplicates and aggregate_sap_table with group_by, but the descriptions disambiguate them adequately.

    Naming Consistency4/5

    All names are lowercase snake_case, giving a predictable surface. However the convention mixes verb_noun (list_services, query_entity, read_sap_table, run_sap_report) with bare noun phrases for report-style tools (grir_differences, trial_balance_by_period, token_budget, condition_types), which is a readable but noticeable deviation rather than a single unified pattern.

    Tool Count4/5

    22 tools is on the high side of the ideal range, but each maps to a genuinely distinct SAP capability (connectivity/auth, metadata discovery, generic table access, aggregation, and several packaged finance/MM analyses). Nothing looks like filler, though a couple of generic query tools could in principle be folded together.

    Completeness4/5

    The surface covers the full read/analysis lifecycle: environment and login management, service and table metadata, raw and aggregated reads, duplicate detection, targeted finance/MM reports, report discovery/execution, and attachment retrieval. Gaps are mainly by design (no write/update/post operations, no master-data lookup helpers), which agents can work around via read_sap_table and run_sap_report.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude, ChatGPT, Copilot and Cursor to explore and query SAP S/4HANA's HANA database using SAP's data dictionary, organization structure, CDS views, and read-only SQL, with tools for finding tables, fields, joins, code values, and running SELECT queries. All access is read-only, with encrypted credentials and audited calls.
      4
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude to read SAP ECC and S/4HANA data through OData and RFC/BAPI calls, with writes gated behind a human confirmation step and every call written to an audit log. No proprietary SAP NetWeaver RFC SDK is required.
      6
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude to query a SAP system in natural language and read ABAP programs, classes, tables, and other object definitions through the SAP ADT protocol, with read-only access and table content disabled by default in quality and production systems. Credentials are stored in the Windows Credential Manager, and a guided setup assistant tests and wires the connection to Claude Desktop and Claude Code.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude and other MCP clients to query Stripe receivables, payouts, disputes, balance, approved supplier bills, and cash forecasts in plain English through read-only finance tools.
      8
      MIT