ADT MCP

ADT MCP

Multi-system MCP server for reading and writing ABAP source via SAP ADT, with a local web admin, browser-based login, and tools for source navigation, editing, activation, testing, and debugging.

Category
访问服务器

README

ADT MCP (Python)

Multi-system MCP server for reading and writing ABAP source via SAP ADT, with a local web admin to configure systems. One process serves both the MCP endpoint (/mcp) and the web admin (/).

Install (Windows)

git clone https://github.com/NhatPD-VNEXT/ADT-MCP adt-mcp
cd adt-mcp
install.bat        REM creates .venv, installs everything, verifies the import
run.bat            REM starts the server and opens the web admin

Only prerequisite: Python 3.10+ on the machine. install.bat finds it via py -3 or python and skips the Microsoft Store stub; it creates a project .venv so nothing global is touched. Flags:

Flag Effect
--no-venv Install into the Python already on PATH instead of .venv
--no-browser Skip Playwright (only fine if every system uses basic auth)

Playwright is installed by default because cookie systems log in through a browser. It drives the machine's own Chrome/Edge, so there is no browser download; if neither is installed, run .venv\Scripts\python -m playwright install chromium.

Configure the new machine

systems.json and cookies/ are gitignored — they hold credentials and are never in the repo. After install.bat, pick one:

  • Add the system in the web admin (run.bat → http://127.0.0.1:8765) and log in once with the browser flow. Nothing secret has to be copied.
  • Copy systems.json + cookies\ by hand from a working machine (USB, password manager, internal share — not email/chat). Fix the absolute cookie_file paths afterwards, or re-login from the admin.

Until that is done the server runs and the admin opens, but list_systems reports no systems.

Install (manual / non-Windows)

cd adt-mcp
python -m pip install -e ".[refresh]"   # -e matters: config, web/ and cookies/
                                        # are read from the checkout.
                                        # [refresh] = Playwright cookie login

Run

python -m adt_mcp        # or: adt-mcp
# → http://127.0.0.1:8765  (MCP at /mcp, admin at /)

Environment variables (all optional):

Variable Default Purpose
ADT_MCP_PORT 8765 Port for MCP + web admin (run.bat follows it)
ADT_MCP_HOME the checkout Folder holding systems.json, web/, cookies/
ADT_MCP_SYSTEMS <home>/systems.json Explicit path to the systems config
ADT_MCP_TOOLS full core exposes only the essential tools
ADT_MCP_BROWSER chrome Browser channel for cookie login (msedge/chromium)
ADT_MCP_CDP http://127.0.0.1:9222 Chrome DevTools endpoint for mode: "cdp"

Set ADT_MCP_HOME when the package is installed non-editable or run as a service from another working directory.

Open http://127.0.0.1:8765 to add SAP systems (URL, client, language, auth). Config is stored in systems.json (gitignored). See systems.example.json. Cookie systems can be (re)authenticated from the web admin via a browser login.

Connect Claude Code

Add to .mcp.json:

{
  "mcpServers": {
    "sap-adt": { "type": "http", "url": "http://127.0.0.1:8765/mcp" }
  }
}

Tools

Read / navigate:

  • list_systems, list_package, search_objects
  • get_source, get_source_by_uri, get_class_method_source, get_class_include, get_object_structure, get_package_source
  • grep_package, find_references (where-used), cds_dependencies
  • get_context (object + compressed dependencies: CDS/BDEF/CLAS)
  • get_revisions, get_revision_source, compare_source
  • syntax_check, run_unit_tests (ABAP Unit), data_preview (CDS/SQL data)
  • trace_start, trace_list, trace_analyze (ABAP profiler: CPU hotspots + DB accesses)
  • list_dumps, get_dump (ST22 runtime dumps: liệt kê + đọc chi tiết để phân tích lỗi)

Write (gated by safety, see below):

  • update_source, update_class_include, activate
  • create_object (CLAS / INTF / DDLS / DDLX / BDEF / SRVD / SRVB / TABL)
  • clone_package (clone toàn bộ object của một package sang package đích, thêm suffix _VN + sửa tham chiếu chéo trong source; dry-run mặc định)

Debug (gated by allow_debug, see below):

  • debug_set_breakpoint, debug_delete_breakpoint, debug_clear_breakpoints
  • debug_listen, debug_poll, debug_stop_listener
  • debug_attach, debug_detach
  • debug_stack, debug_variables, debug_step
  • run_class (IF_OO_ADT_CLASSRUN — Eclipse's F9)

Cookie maintenance: refresh_cookies_for.

Debugging

The tenant must expose the ADT debugger; check with

GET /sap/bc/adt/compatibility/graph   → COM.SAP.ADT.DEBUGGER :: userRequestDebugging

Enable it per system in systems.json — it is off by default, separately from allow_write, because run_class executes arbitrary ABAP:

"allow_debug": true,
"debug_timeout": 600,
"debug_listen_seconds": 120

The flow, in order:

debug_set_breakpoint  → statement="…" lets the server find the executable line
debug_listen          → returns at once; the listener runs in the background
run_class             → run the code WHILE the listener waits
debug_poll            → state: listening → caught
debug_attach
debug_stack / debug_variables / debug_step
debug_detach          → releases the debuggee and returns the run's output

debug_variables needs explicit names — read the source first. There is no working "list what is in scope" call on this platform: getChildVariables answers with ME alone whatever parent it is asked for.

Two things follow from how SAP works, not from choices made here:

  • Run the code while the listener is waiting. A debuggee is only trapped by a listener that was already registered. debug_listen therefore returns immediately instead of blocking.
  • A breakpoint freezes the HTTP request that started the code. run_class runs in the background for that reason, and the console output only arrives at debug_detach (or a later debug_poll).

Debugging a Fiori app (RAP action, determination, validation)

Nothing here runs the code — you do, by clicking in the browser. An external breakpoint is keyed on the ABAP user, so it traps any session of that user, including the OData request the Fiori UI sends.

debug_set_breakpoint  VNEXT CLAS ZBP_I_FLIGHT_013 \
                      include="implementations" statement="READ ENTITIES"
debug_listen          VNEXT seconds=600      ← wide enough to switch to the browser
      … now trigger the action in the Fiori app …
debug_poll            VNEXT                  → state: caught
debug_attach / debug_stack / debug_variables / debug_step
debug_detach          VNEXT                  → the OData request completes

run_class plays no part in this flow.

Two things decide whether it works:

  • include="implementations". RAP handler code (lhc_… classes, where actions, determinations and validations live) is in the class's Local Types include. A behavior pool's /source/main is an empty shell — a breakpoint there never fires. The returned id shows where it really landed (…INCLUDE=…CCIMP.LINE_NR=131).
  • Same ABAP user. The Fiori session must run as the user in /sap/bc/adt/core/http/systeminformation. A different login is a different user and is never trapped.

While you sit at the breakpoint the OData request is held open, so the Fiori UI spins and can hit its own gateway timeout — detach promptly. Leaving a breakpoint armed with no listener is not dangerous, though: measured on the tenant, the code simply runs straight through.

Cost on cloud

The ABAP session is the SAP_SESSIONID cookie, so the debugger's isolated channels each need their own login. The first debug_listen and the first run_class on a system therefore take ~20–25s while a headless login runs; afterwards the sessions are reused. Channel cookies land in cookies/<system>.debug.txt / .exec.txt and are gitignored like the rest.

Breakpoints set here are external breakpoints keyed on the ABAP user, so leaving one behind would pop the debugger open on a real session later. The server deletes everything it set when it shuts down; debug_clear_breakpoints does it on demand. The ideId is adt-mcp, distinct from Eclipse's, so your IDE breakpoints are never touched.

Write safety

Writes are off by default. Per system in systems.json:

  • allow_write: true — required to enable any create/update.
  • write_packages: ["Z*", "$TMP"] — target package must match (default).

Delete is intentionally not supported.

Token economy

Tool schemas are sent to the model on every turn. Set ADT_MCP_TOOLS=core to expose only the essential ~16 tools (smaller schema); default full exposes all 29. Descriptions are kept terse.

ADT_MCP_TOOLS=core python -m adt_mcp

Security

  • systems.json, cookies/, *-cookies.txt hold session secrets and are gitignored — never commit them.
  • The server binds 127.0.0.1 only.
  • Stored passwords are plaintext. A username/password is only kept to enable headless cookie refresh (refresh_cookies_for). For real systems prefer the cookie flows that store no password:
    • mode: "browser" — log in once in a visible browser; only session cookies are saved (the persistent profile keeps SSO so re-login is rare).
    • mode: "cdp" — attach to your already-authenticated Chrome. If you must keep a password, store it in an OS keyring / secrets manager and inject it into systems.json at deploy time rather than committing it.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选