@abapify/adt-mcp

中文文档
0.4.34发布于 2026/11/03MITTypeScriptES Module构建来源已验证近 30 天下载 2782

MCP server for SAP ADT operations – exposes adt-cli features as MCP tools

原始使用文档
文档目录28 节
  1. Quick Start (stdio)
  2. Configure in Claude Desktop
  3. Configure in VS Code (GitHub Copilot agent mode)
  4. Configure in Cursor / Windsurf
  5. HTTP transport (since Wave 1)
  6. Session lifecycle tools
  7. Transactional changesets (since Wave 3)
  8. Connection Parameters
  9. Tools Reference
  10. Discovery & System
  11. Object Repository
  12. Source Code
  13. Activation & Syntax
  14. Unit Testing
  15. Package Management
  16. Change & Transport System (CTS)
  17. ABAP Test Cockpit (ATC)
  18. Common Workflows
  19. Read → Edit → Save → Activate
  20. Explore a Package
  21. Quality Gate
  22. Architecture
  23. Programmatic Usage
  24. Custom client factory (e.g. for testing or SSO)
  25. Testing
  26. Using the mock server in your own tests
  27. Development
  28. Feature Parity Map

@abapify/adt-mcp

MCP (Model Context Protocol) server that exposes SAP ADT operations as structured tools for AI assistants, IDE integrations, and automation pipelines.

This package ships two transports:

BinaryTransportState model
adt-mcpstdio (JSON-RPC over pipes)Stateless — connection-per-call.
adt-mcp-httpStreamable HTTPSession-scoped cached AdtClient, locks, and changesets.

See docs/deployment/mcp-http.md for the complete HTTP deployment guide (Docker, Okta, multi-system, troubleshooting). The rest of this README focuses on stdio.

Quick Start (stdio)

# Run via npx (no install required)
npx @abapify/adt-mcp

Configure in Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or the equivalent path on your OS:

{
  "mcpServers": {
    "adt": {
      "command": "npx",
      "args": ["@abapify/adt-mcp"]
    }
  }
}

Configure in VS Code (GitHub Copilot agent mode)

Add to .vscode/mcp.json in your workspace, or to your user settings under "mcp":

{
  "servers": {
    "adt": {
      "type": "stdio",
      "command": "npx",
      "args": ["@abapify/adt-mcp"]
    }
  }
}

Configure in Cursor / Windsurf

Add to your MCP server list:

{
  "mcpServers": {
    "adt": {
      "command": "npx",
      "args": ["@abapify/adt-mcp"]
    }
  }
}

HTTP transport (since Wave 1)

adt-mcp-http is the Streamable HTTP entry-point. It targets shared / remote deployments (Docker, Kubernetes, Kiro, teams).

Minimal run:

bunx nx build adt-mcp
node packages/adt-mcp/dist/bin/adt-mcp-http.mjs --port 3000 --auth-token "$(openssl rand -hex 32)"

Minimal smoke test:

TOKEN=<your token>
curl -sf http://127.0.0.1:3000/healthz
curl -H "Authorization: Bearer $TOKEN" \
     -H 'Content-Type: application/json' \
     -X POST http://127.0.0.1:3000/mcp \
     -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"demo","version":"0"}}}'

Capture the Mcp-Session-Id response header, then call sap_connect, the tools you need, and finally sap_disconnect — or close the transport to trigger cleanup automatically.

Auth modes: none (dev / loopback), bearer (shared secret), proxy (trust x-forwarded-user from an upstream proxy), oauth (OIDC JWT validation against Okta / Entra ID / Cognito). Full flag + env matrix in docs/deployment/mcp-http.md.

Session lifecycle tools

Only available on the HTTP transport:

ToolPurpose
sap_connectPerform the SAP security-session handshake once per MCP session. Accepts inline credentials or a systemId resolved against SAP_SYSTEMS_JSON / SAP_SYSTEMS_FILE.
sap_disconnectRelease locks, DELETE the SAP security session, and drop the cached client.

Transactional changesets (since Wave 3)

Bundle multiple ADT writes into a single atomic unit:

ToolPurpose
changeset_beginOpen a transactional unit-of-work bound to the current MCP session (one at a time).
changeset_addStage an object write — acquires a lock and PUTs the supplied source. Defers activate.
changeset_commitBatch-activate every staged object in a single call, then release all locks.
changeset_rollbackRelease every held lock and mark the changeset rolled back. Source PUTs are not reverted (SAP has no transactional discard).

See docs/deployment/mcp-http.md#transactional-changesets for a worked example.


Connection Parameters

Every tool requires these connection parameters (passed per-call, never stored):

ParameterTypeRequiredDescription
baseUrlstring✅SAP system base URL, e.g. https://my-system.example.com:8000
clientstring—SAP client number, e.g. 100
usernamestring—Username for basic auth
passwordstring—Password for basic auth

Security note: credentials are forwarded directly to the SAP system per request. The MCP server holds no state and persists no credentials.


Tools Reference

Discovery & System

discovery

Discover available ADT services on the SAP system. Useful for checking what endpoints the system supports before using other tools.

Parameters: connection only

Returns: JSON object with available service collections and their links.


system_info

Get SAP system and/or session information.

Parameters:

ParameterTypeDefaultDescription
scope"session" | "system" | "both""both"What information to retrieve

Returns:

{
  "session": { "user": "DEVELOPER", "client": "100", "language": "EN", ... },
  "system": { "systemId": "DEV", "release": "757", ... }
}

Object Repository

search_objects

Search for ABAP objects in the repository. Supports wildcards.

Parameters:

ParameterTypeDefaultDescription
querystring✅Search term, e.g. ZCL_* or MY_CLASS
maxResultsnumber50Maximum number of results

Returns:

{
  "count": 3,
  "objects": [
    { "name": "ZCL_MY_CLASS", "type": "CLAS/OC", "uri": "/sap/bc/adt/oo/classes/zcl_my_class", ... }
  ]
}

get_object

Get details about a specific ABAP object by name. Performs an exact-match search and returns the object metadata plus a list of similar objects if no exact match is found.

Parameters:

ParameterTypeDescription
objectNamestringABAP object name to look up

Returns:

{ "found": true, "object": { "name": "ZCL_MY_CLASS", "type": "CLAS/OC", "uri": "...", ... } }

or, when not found:

{ "found": false, "message": "Object 'FOO' not found", "similar": [...] }

Source Code

list_source_versions

List immutable ADT source-version metadata and transport provenance for every source component of one object. The result is metadata-only; it never embeds ABAP source.

ParameterTypeDescription
objectNamestringABAP object name
objectTypestringObject type (PROG, CLAS, INTF, …)
componentstring?Exact component id such as implementations

get_source_version

Explicitly read one immutable source URI returned by list_source_versions or cts_transport_source_manifest. Output is bounded by maxBytes (1 MiB default, 4 MiB hard cap) and fails rather than truncating.

ParameterTypeDescription
uristringServer-relative immutable /sap/bc/adt/... URI
maxBytesnumber?Positive UTF-8 response limit

cts_transport_source_manifest

Build a metadata-only, component-granular exactness manifest for an ordered non-empty transport list. Every leaf reports its change kind, exactness, concrete request/task provenance, immutable base/head references when known, and a typed diagnostic when exact isolation cannot be proven.

ParameterTypeDescription
transportsstring[]Ordered request/task identifiers
selectorobject?Optional objFunc, pgmid, and type filters
concurrencynumber?Bounded metadata/feed concurrency (max 32)

get_source

Fetch ABAP source code for a program, class, interface, or function group. Supports version-aware reads, class includes, method-level reads, and regex grep for token-efficient source exploration.

Parameters:

ParameterTypeDescription
objectNamestringABAP object name
objectTypestring?Object type hint (PROG, CLAS, INTF, …). Skips the search round-trip when provided.
versionenum?active (default, last activated) or inactive (unactivated draft).
includestring?For CLAS: source include (main, definitions, implementations, testclasses, macros, text_symbols, localtypes).
methodstring?For CLAS: method name to read, or * to list all methods.
grepstring?Regex pattern; returns matching source lines with context instead of full source. For CLAS source, each match is annotated with the owning method/class/include.
maxBytesnumber?Maximum UTF-8 response size in bytes (default 1 MiB, hard cap 2 MiB).
formatenum?raw (default) or structured (class includes and method boundaries as JSON).

Returns:

  • Default: { object, bytes, source, version, include }
  • method=*: { object, methodCount, methods }
  • method=<name>: { object, method, startLine, endLine, bytes, source }
  • grep: { object, pattern, matchCount, matches, methodContext }
  • format=structured: { object, source, bytes, version, include, includes, methods }

Examples:

get_source objectName=ZCL_ORDER objectType=CLAS version=inactive
get_source objectName=ZCL_ORDER objectType=CLAS include=testclasses
get_source objectName=ZCL_ORDER objectType=CLAS method=get_name
get_source objectName=ZCL_ORDER objectType=CLAS grep="SELECT.*FROM"

Tip: Do not combine method and grep. Use grep to locate code, then method to read the full method.


update_source

Write new ABAP source code to an existing object. Internally performs the full SAP ADT lock→PUT→unlock cycle.

Parameters:

ParameterTypeDescription
objectNamestringABAP object name
objectTypestring?Object type hint
sourceCodestringNew ABAP source code
transportstring?Transport request number (required for transportable objects)

Returns:

{ "status": "updated", "object": "ZCL_MY_CLASS" }

⚠️ Always activate after updating — inactive source is not compiled and cannot be executed.


get_test_classes

Retrieve the test class definitions (FOR TESTING) embedded in an ABAP class. Returns the raw source of the testclasses include.

Parameters:

ParameterTypeDescription
classNamestringABAP class name, e.g. ZCL_MY_CLASS

Returns: Plain ABAP source of the local test class include.


Activation & Syntax

activate_object

Activate one or more ABAP objects. Supports single-object and batch modes.

Single object mode:

ParameterTypeDescription
objectNamestringABAP object name
objectTypestringObject type (PROG, CLAS, INTF, …)

Batch mode:

ParameterTypeDescription
objectsArray<{objectName, objectType}>Objects to activate in one request

Returns:

{ "status": "activated", "count": 2, "objects": [{ "name": "ZCL_FOO", "type": "CLAS" }, ...] }

check_syntax

Run an ABAP syntax check on an object and return structured check messages. Uses the checkrun schema — no XML parsing in tool code.

Parameters:

ParameterTypeDefaultDescription
objectNamestring✅ABAP object name
objectTypestring?—Object type hint for faster resolution
version"active" | "inactive" | "new""active"Version to check

Returns:

{
  "hasErrors": false,
  "hasWarnings": true,
  "reports": [
    {
      "reporter": "syntax",
      "triggeringUri": "/sap/bc/adt/oo/classes/zcl_foo",
      "checkMessageList": {
        "checkMessage": [{ "type": "W", "shortText": "Variable X is unused", ... }]
      }
    }
  ]
}

Unit Testing

run_unit_tests

Run ABAP Unit tests on an object or package and receive pass/fail counts broken down by test method.

Parameters:

ParameterTypeDefaultDescription
objectNamestring✅Object name (class, program, or package)
objectTypestring?—Type hint (CLAS, PROG, DEVC, …)
withCoveragebooleanfalseWhether to collect code coverage data

Returns:

{
  "totalTests": 5,
  "passCount": 4,
  "failCount": 1,
  "errorCount": 0,
  "programs": [ ... ]
}

Package Management

list_package_objects

List ABAP objects contained in a package. Uses quickSearch with a packageName filter.

Parameters:

ParameterTypeDefaultDescription
packageNamestring✅Package name, e.g. ZPACKAGE
objectTypestring?—Filter by type (CLAS, PROG, …)
maxResultsnumber200Maximum result count

Returns:

{
  "packageName": "ZPACKAGE",
  "count": 12,
  "objects": [{ "name": "ZCL_FOO", "type": "CLAS/OC", ... }]
}

Change & Transport System (CTS)

cts_list_transports

List transport requests from the CTS.

Parameters:

ParameterTypeDefault
maxResultsnumber50

Returns: Array of transport request descriptors.


cts_get_transport

Get details for a specific transport request.

Parameters:

ParameterTypeDescription
transportIdstringTransport number, e.g. DEVK900001

Returns: Full transport descriptor including tasks and objects.


cts_create_transport

Create a new transport request.

Parameters:

ParameterTypeDefaultDescription
descriptionstring✅Transport description
type"K" | "W""K"Workbench (K) or Customizing (W)

cts_create_task

Create and verify a modifiable task under an existing transport request.

Parameters:

ParameterTypeDescription
transportstringParent transport request number
ownerstringSAP user who will own the task

Returns: The parent transport number, created task number, normalized owner, and created status.


cts_release_transport

Release a transport request.

Parameters:

ParameterTypeDescription
transportstringTransport number
releaseAllbooleanRelease modifiable tasks before the request

cts_delete_transport

Delete a transport request.

Parameters:

ParameterTypeDescription
transportstringTransport number

flow_checkout_tr

Reconcile an allowed local workspace to an exact transport source boundary. The tool delegates to @abapify/adt-flow; it does not run Git commands.

ParameterTypeDefaultDescription
transportsstring[]✅Non-empty transport scope
workspaceRootstring✅Absolute directory within a server-owned root
basebooleanfalseSelect the version immediately before the scope
verifyInventorybooleanfalseRecompute inventory instead of reusing an exact-head index

The JSON result contains changed, moved, removed, unchanged, descriptor, and SAP-call counts. With verifyInventory: true, it also contains refreshed inventory and per-item resolution outcomes. It never contains source bodies or credentials.


flow_index_tr

Persist inventory and unresolved-boundary descriptors for an allowed local workspace without reading or materializing source files. Unlike strict flow_checkout_tr, this tool records inexact components as omissions so a later exact checkout can retry them.

ParameterTypeDescription
transportsstring[]Non-empty transport scope
workspaceRootstringAbsolute directory within a server-owned root

The JSON result contains transport/object descriptors and omission diagnostics; its source-call count is always zero.


ABAP Test Cockpit (ATC)

atc_run

Run ABAP Test Cockpit checks on an object or package and return the resulting findings worklist.

In destination mode, this operation requires an explicit safe_execute grant. A read grant is insufficient because SAP creates a temporary server-side worklist for the analysis.

Parameters:

ParameterTypeDescription
scopeobjectATC scope: { kind: 'package', packageName }, { kind: 'transport_request', trkorr }, or { kind: 'objects', objects: [{ objectType, objectName }] }

Returns:

{ "status": "completed", "worklist": { ... } }

Common Workflows

Read → Edit → Save → Activate

1. get_source      objectName=ZCL_FOO objectType=CLAS
2. update_source   objectName=ZCL_FOO objectType=CLAS sourceCode="..." transport=DEVK900001
3. check_syntax    objectName=ZCL_FOO objectType=CLAS version=inactive
4. activate_object objectName=ZCL_FOO objectType=CLAS
5. run_unit_tests  objectName=ZCL_FOO objectType=CLAS

Explore a Package

1. list_package_objects packageName=ZPACKAGE
2. get_object      objectName=ZCL_FOO objectType=CLAS
3. get_source      objectName=ZCL_FOO objectType=CLAS

Quality Gate

1. check_syntax objectName=ZCL_FOO objectType=CLAS
2. atc_run      scope={"kind":"objects","objects":[{"objectType":"CLAS","objectName":"ZCL_FOO"}]}
3. run_unit_tests objectName=ZCL_FOO objectType=CLAS

Architecture

┌──────────────┐    stdio (JSON-RPC)   ┌──────────────────────────────┐
│  MCP Client  │ ◄───────────────────► │  @abapify/adt-mcp            │
│ (AI / IDE)   │                       │  McpServer (17 tools)        │
└──────────────┘                       └──────────────┬───────────────┘
                                                      │ calls
                                       ┌──────────────▼───────────────┐
                                       │  @abapify/adt-client         │
                                       │  (typed contracts via speci) │
                                       └──────────────┬───────────────┘
                                                      │ HTTP/HTTPS
                                       ┌──────────────▼───────────────┐
                                       │  SAP System (ADT REST)       │
                                       └──────────────────────────────┘

Design principles:

  • No logic duplication – tools delegate to @abapify/adt-client services.
  • Schema-based serialisation – request/response XML is handled via typed schemas from @abapify/adt-schemas. No manual XML building, no third-party XML parser.
  • Structured JSON – every tool returns JSON, never raw console output.
  • Zod validation – all tool inputs are validated before reaching the SAP system.
  • Connection-per-call – each tool call creates its own ADT client; the server is stateless.

Programmatic Usage

import { createMcpServer } from '@abapify/adt-mcp';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = createMcpServer();
const transport = new StdioServerTransport();
await server.connect(transport);

Custom client factory (e.g. for testing or SSO)

import { createMcpServer } from '@abapify/adt-mcp';

const server = createMcpServer({
  clientFactory: (params) =>
    createAdtClient({
      baseUrl: params.baseUrl,
      username: params.username ?? '',
      password: params.password ?? '',
      client: params.client,
    }),
});

Testing

Integration tests use Vitest and a built-in mock ADT server that needs no SAP system.

# Run all integration tests
bunx vitest run tests/integration.test.ts

Using the mock server in your own tests

The mock ADT server lives in the private @abapify/adt-fixtures package (monorepo-only — it is not published to npm). Inside this repository the integration tests import it directly:

import { createMockAdtServer } from '@abapify/adt-fixtures';

Development

bunx nx build adt-mcp      # build
bunx nx typecheck adt-mcp  # type check
bunx nx lint adt-mcp       # lint
bunx nx test adt-mcp       # run integration tests with Vitest

Feature Parity Map

CLI CommandMCP ToolStatus
adt discoverydiscovery✅
adt infosystem_info✅
adt searchsearch_objects✅
adt getget_object✅
adt source getget_source✅
adt source versionslist_source_versions✅
adt source version getget_source_version✅
adt source putupdate_source✅
adt activateactivate_object✅
adt checkcheck_syntax✅
adt aunit runrun_unit_tests✅
adt atc runatc_run✅
adt cts tr listcts_list_transports✅
adt cts tr getcts_get_transport✅
adt cts tr task creatects_create_task✅
adt cts tr source-manifestcts_transport_source_manifest✅
adt cts tr deletects_delete_transport✅
adt cts tr creatects_create_transport✅
adt cts tr releasects_release_transport✅
adt flow checkout trflow_checkout_tr✅
adt flow index trflow_index_tr✅
adt ls—🔜 Future
adt cts search—🔜 Future
adt import package—🔜 Future
adt import transport—🔜 Future

版本与发布记录

@abapify/adt-mcp 共发布 29 个版本,首次发布于 2026/04/21;过去 12 个月发布了 29 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.34latest2026/11/034 天前
0.4.332026/11/025 天前
0.4.322026/11/025 天前
0.4.312026/11/016 天前
0.4.292026/10/308 天前
0.4.282026/10/308 天前

关于 @abapify/adt-mcp 的常见问题

@abapify/adt-mcp 是什么?

MCP server for SAP ADT operations – exposes adt-cli features as MCP tools

如何安装 @abapify/adt-mcp?

在项目目录运行 npm install @abapify/adt-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 adt-mcp、adt-mcp-http,可以用 npx adt-mcp 直接运行。

@abapify/adt-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@abapify/adt-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@abapify/adt-mcp 可以商用吗?

@abapify/adt-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@abapify/adt-mcp 的下载量有多少?

根据 npm 官方下载统计,@abapify/adt-mcp 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,782 次,日均约 93 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@abapify/adt-mcp 还在维护吗?

最新版本 0.4.34 发布于 2026/11/03(4 天前);至今共发布 29 个版本,其中过去 12 个月发布了 29 个;首次发布于 2026/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。