MCPcopy Index your code
hub / github.com/arc-mcp/arc-1

github.com/arc-mcp/arc-1 @v0.9.25

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.9.25 ↗ · + Follow
2,272 symbols 7,736 edges 368 files 373 documented · 16% updated 1d agov0.9.25 · 2026-07-02★ 1363 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ARC-1 — SAP ADT MCP Server

ARC-1 (pronounced arc one [ɑːrk wʌn]) — Enterprise-ready MCP server for SAP ABAP systems. Secure by default, deployable to BTP or on-premise, and hardened with large unit/integration/E2E test coverage.

ARC-1 connects AI assistants (Claude, GitHub Copilot, Copilot Studio, and any MCP client) to SAP systems via the ADT REST API. It ships as an npm package and Docker image.

Test CodeQL Dependency Review

Full Documentation | Quickstart | Tool Reference | Blog Series

📖 New: AI ABAP Development blog series — long-form posts on AI for ABAP, ARC-1 design, and real-world BTP / Copilot Studio / Joule walkthroughs. Read the series →

Why ARC-1?

Built for organizations that need AI-assisted SAP development with guardrails. Inspired by the pioneering work of abap-adt-api, mcp-abap-adt, and vibing-steampunk — ARC-1 adds what's needed to run in production:

Security & Admin Controls

  • Safe by default — read-only, no free SQL, no table preview, no transport writes, no Git writes. Enable each capability with explicit SAP_ALLOW_* flags
  • Action deny list — block specific tool actions with SAP_DENY_ACTIONS (for example SAPWrite.delete), without exposing low-level operation codes to admins
  • Package restrictions — limit AI write operations (create, update, delete) to specific packages with wildcards (--allowed-packages "Z*,$TMP"). Read operations are not restricted by package — use SAP's native authorization for read-level access control
  • Data access control (off by default)SAPRead(type=TABLE_CONTENTS) and SAPQuery are gated behind explicit env vars (SAP_ALLOW_DATA_PREVIEW=true, SAP_ALLOW_FREE_SQL=true). These capabilities can expose application data or run ad-hoc SQL, so they are intentionally separated from the default development-tooling surface. They can be enabled for governed use cases, but should be reviewed against the current SAP API Policy, your SAP agreement, and internal data-governance rules
  • Transport safety — transport reads are available for review, while transport mutations require both --allow-writes and --allow-transport-writes. Update/delete operations auto-use the lock correction number when no explicit transport is provided
  • Git workflow safety — Git operations are disabled by default. Enable explicitly with --allow-git-writes / SAP_ALLOW_GIT_WRITES=true
  • API-key profiles — multi-key HTTP deployments can assign viewer, viewer-data, viewer-sql, developer, developer-data, developer-sql, or admin per key
  • Writes restricted to $TMP when enabled — only local/throwaway objects; writing to transportable packages requires explicit --allowed-packages
  • HTTP security headers (helmet) on by default — HSTS, CSP, X-Frame-Options, CORP, X-Content-Type-Options. COOP is deliberately not set so popup-based OAuth flows (Copilot Studio) keep working. No flag to disable.
  • Opt-in CORS for browser MCP clientsARC1_ALLOWED_ORIGINS (comma-separated, exact match). Off by default; native MCP clients don't need it
  • Layered rate limiting — three layers out of the box: per-IP OAuth//mcp edge (Layer 1, default 20/min/IP, on), per-user MCP quota (Layer 2, off by default — multi-user deployments opt in via ARC1_RATE_LIMIT=60), server-wide SAP-bound semaphore (Layer 3, default 10, on). Honors Retry-After on 429/503 from SAP / BTP gateways. Two operator env vars; per-endpoint OAuth ceilings are constants in code. Closes CodeQL alert js/missing-rate-limiting. See the Rate Limiting Guide
  • Supply-chain security — Dependabot (npm + GitHub Actions + Docker, weekly + same-day security advisories), npm audit --audit-level=high PR gate, GitHub Dependency Review on every PR, CodeQL SAST, Trivy container scanning (gating on release, advisory on dev), all third-party GitHub Actions pinned to commit SHA, SECURITY.md policy with severity-tiered SLAs. Image and npm package both ship with provenance attestations. See the security guide §13

Authentication

  • API key — simple Bearer token for internal deployments
  • OIDC / JWT — Entra ID, Keycloak, or any OpenID Connect provider
  • OAuth 2.0 — local browser-based login for BTP ABAP Environment service-key development
  • XSUAA — SAP BTP native auth with automatic token proxy for MCP clients
  • Per-user SAP identity — BTP Destination Service forwards the MCP user to SAP: Cloud Connector principal propagation for on-premise SAP, or OAuth2UserTokenExchange for BTP ABAP Environment

BTP Cloud Foundry Deployment

Deploy ARC-1 as a Cloud Foundry app on SAP BTP with full platform integration:

  • Destination Service — connect to SAP systems via managed destinations
  • Cloud Connector — reach on-premise systems through the connectivity proxy
  • Per-user destinations — user identity forwarded end-to-end via X.509 certificates for on-premise SAP, or exchanged for an ABAP bearer token for BTP ABAP Environment
  • XSUAA OAuth proxy — MCP clients authenticate via standard OAuth, ARC-1 handles the BTP token exchange
  • Audit logging — structured events to stderr, file, or BTP Audit Log Service

Token Efficiency

  • 12 intent-based tools instead of 200+ individual tools — keeps tool selection simple, with the schema payload guarded by CI budgets and a hyperfocused 1-tool mode for tight context windows
  • Method-level read/edit — read or update a single class method, not the whole source (up to 20x fewer tokens)
  • Context-first understandingSAPContext(action="deps") is the first call for "what does this object do?": it returns the object's Knowledge Transfer Document (SKTD/KTD) when available plus public API contracts of dependencies in one call (7-30x compression)

Built-in Object Caching

  • Server-validated source caching — every SAP object read is cached in memory (stdio) or SQLite (http-streamable). Repeated reads use If-None-Match/ETag conditional GET, so unchanged objects return from cache after SAP confirms 304 Not Modified.
  • Dependency graph cachingSAPContext dep resolution keyed by source hash; unchanged objects skip all ADT calls on subsequent runs.
  • KTD-aware context — Knowledge Transfer Documents are cached as source entries and composed into SAPContext(action="deps") separately from the dependency graph, so cached dependency context can still include revalidated documentation.
  • Pre-warmer — start with ARC1_CACHE_WARMUP=true to pre-index all custom objects at startup, enabling reverse dependency lookup (SAPContext(action="usages")) and fast CDS impact workflows (SAPContext(action="impact", type="DDLS")).
  • Active/inactive source viewsSAPRead accepts version="active" | "inactive" | "auto" and warns when the active source has an unactivated draft.
  • Write invalidation — when SAPWrite or SAPActivate mutates an object, both active and inactive source cache entries are dropped; next read revalidates or fetches fresh source.

See docs/caching.md for full documentation.

Testing

  • 3,474 unit tests (104 unit test files, mocked HTTP)
  • 262-test default integration profile against live SAP systems, with explicit skip reasons when credentials or fixtures are missing
  • 141-test default E2E profile that executes real MCP tool calls against a running ARC-1 server and live SAP system
  • Manual slow SAP profiles keep expensive cache warmup, broad where-used, RAP full-stack, and recursive CTS release coverage out of the PR path (test:integration:slow, test:e2e:slow, GitHub SAP Slow Tests workflow)
  • CRUD lifecycle and BTP smoke lanes included (test:integration:crud, test:integration:btp:smoke)
  • CI matrix on Node 22 and 24; live SAP integration + E2E run on internal PRs and manual dispatch, with SAP jobs gated off for docs/chore PRs and external forks
  • Reliability telemetry + coverage published as informational CI signals (non-blocking)

Tools Refined for Real-World Usage

The 12 tools are designed from real LLM interaction feedback:

Tool What it does
SAPRead Read exact ABAP source, method bodies, grep matches, table data, CDS views, access controls (DCLS), metadata extensions (DDLX), service bindings (SRVB), knowledge-transfer docs (SKTD or friendly alias KTD), message classes (MSAG), revision history (VERSIONS/VERSION_SOURCE), inactive object state, BOR objects, deployed UI5/Fiori apps (BSP, BSP_DEPLOY), and ABAP Platform 2025 server-driven objects (DESD, EVTB, EVTO, DTSC, CSNM, COTA). For "what does this object do?" use SAPContext first, then SAPRead for precise source. On-prem metadata reads include authorization fields (AUTH), feature toggles (FEATURE_TOGGLE), and enhancement implementations (ENHO). Structured format for classes returns metadata + decomposed includes as JSON. Optional grep regex returns only matching source lines (+context, method-annotated for classes) for token-efficient search. (Deprecated aliases MESSAGES/FTG2 accepted for one minor.)
SAPSearch Object search + full-text source code search across the system
SAPWrite Create/update/delete ABAP source and DDIC metadata with automatic lock/unlock (PROG, CLAS, INTF, FUNC, FUGR, INCL, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD/KTD, TABL, DOMA, DTEL, MSAG; availability adapts for BTP). Class updates can target local includes (definitions, implementations, macros, testclasses); class-section surgery (edit_class_definition, add_method, edit_method_signature, delete_method, change_method_visibility) lets an LLM edit a global class signature without re-sending /source/main; RAP behavior-pool scaffolding can auto-create lhc_* skeletons before injecting signatures/stubs. Batch creation supports terminal activation for interdependent multi-object workflows (e.g., RAP stack or domain+data element in one call)
SAPActivate Activate ABAP objects — single or batch (essential for RAP stacks), with guarded retry for the S/4HANA ED064 batch quirk. Publish/unpublish OData service bindings (SRVB)
SAPNavigate Go-to-definition, find references, code completion
SAPQuery Execute ABAP SQL with table-not-found suggestions and automatic chunking for simple long literal IN (...) lists
SAPTransport CTS transport management (list/get/create/release/delete/reassign/release-recursive), transport layer/target lookup, package transport requirement checks, and reverse lookup history (action="history")
SAPGit Git-based ABAP workflows across gCTS and abapGit (list/clone/pull/push/commit/branch/unlink) with backend auto-selection and safety gating (--allow-git-writes)
SAPContext Context-first object understanding (action="deps"): prepends the object's KTD when available and returns compressed dependency contracts. Also supports reverse dependency lookup (action="usages") and CDS upstream/downstream impact analysis (action="impact" for DDLS)
SAPLint Local ABAP lint (system/release-aware presets, auto-fix, pre-write validation) + ADT PrettyPrint (server-side formatting)
SAPDiagnose Syntax check, ABAP Unit tests, ATC code quality, CDS test-case suggestions, active/inactive object-state comparison, generic ADT quickfix proposals/application deltas, gateway/system message diagnostics, short dumps, and profiler traces
SAPManage Feature probing, cache statistics, package lifecycle/change-package operations, and FLP catalog/group/tile helpers

Tool definitions automatically adapt to the target system (BTP vs on-premise), removing unavailable types and adjusting descriptions so the LLM never attempts unsupported operations.

Feature Detection

ARC-1 probes the SAP system at startup and adapts its behavior:

  • Detects HANA, gCTS, abapGit, RAP/CDS, AMDP, UI5, and transport availability
  • Auto-detects BTP vs on-premise systems
  • Maps SAP_BASIS release to the correct ABAP language version
  • Each feature can be forced on/off or left on auto-detect
  • In shared-credential mode (technical user), runs a startup auth preflight once and blocks SAP tool calls with a clear error on 401/403 to avoid repeated failed logins and potential user lockout

ADT API Status and Strategy

SAP's current SAP API Policy is v.4.2026a. It allows published/documented APIs for the purposes described in SAP documentation, while restricting unsupported internal APIs, misuse, unman

Extension points exported contracts — how you extend this code

LogSink (Interface)
(no doc) [8 implementers]
src/server/sinks/types.ts
Cache (Interface)
(no doc) [4 implementers]
src/cache/cache.ts
CdsResolvedDep (Interface)
Resolved CDS dependency with fetched source
src/context/compressor.ts
PreWriteRapPreflightResult (Interface)
Pre-write RAP preflight check result
src/handlers/write-helpers.ts
TokenCache (Interface)
Cached token state
src/adt/oauth.ts
LiveBackend (Interface)
(no doc) [2 implementers]
tests/evals/live-backend.ts
PluginLogger (Interface)
(no doc) [1 implementers]
src/public/types.ts
ScriptArgs (Interface)
(no doc)
src/extract-sap-cookies.ts

Core symbols most depended-on inside this repo

mockResponse
called by 1118
tests/helpers/mock-fetch.ts
handleToolCall
called by 874
src/handlers/dispatch.ts
createClient
called by 623
tests/unit/handlers/setup-undici-mock.ts
unrestrictedSafetyConfig
called by 477
src/adt/safety.ts
get
called by 428
src/server/safe-http-client.ts
callTool
called by 309
tests/e2e/helpers.ts
errorResult
called by 238
src/handlers/shared.ts
requireOrSkip
called by 189
tests/helpers/skip-policy.ts

Shape

Function 1,598
Interface 348
Method 280
Class 46

Languages

TypeScript100%
Python1%

Modules by API surface

src/adt/types.ts95 symbols
src/adt/diagnostics.ts95 symbols
src/adt/client.ts88 symbols
src/adt/devtools.ts59 symbols
public/ui/app.js59 symbols
src/adt/errors.ts54 symbols
src/adt/rap-handlers.ts46 symbols
src/adt/xml-parser.ts45 symbols
src/adt/http.ts43 symbols
src/cache/cache.ts34 symbols
src/cache/sqlite.ts32 symbols
src/adt/transport.ts29 symbols

For agents

$ claude mcp add arc-1 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact