{
  "markdown": "# MCP SAP Docs (Upstream)\n\nAn MCP server that gives AI assistants (Claude, Cursor, ChatGPT, etc.) access to SAP documentation through a unified search and fetch interface. It combines a local full-text + semantic index over git-cloned SAP docs with optional live queries to SAP Help, SAP Community, and Software Heroes — all exposed as MCP tools.\n\n## Install\n\n[![Add to Werkbank][werkbank-badge]][werkbank-install]\n\nOr add it to any MCP client that supports streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"sap-docs\": {\n      \"type\": \"http\",\n      \"url\": \"https://mcp-sap-docs.marianzeis.de/mcp\"\n    }\n  }\n}\n```\n\nNo API key or login required — the server is public and read-only.\n\n## Public Hosted Endpoint\n\n> **Ready to use — no setup required**\n>\n> | Variant | URL |\n> |---------|-----|\n> | SAP Docs | `http://mcp-sap-docs.marianzeis.de/mcp` |\n> | ABAP | `https://mcp-abap.marianzeis.de/mcp` |\n\n## Variants\n\n`mcp-sap-docs` is the upstream repository for two MCP server variants that share one codebase and differ by configuration (`MCP_VARIANT` / `.mcp-variant`):\n\n| Variant | Scope | Extra tools |\n|---------|-------|-------------|\n| `sap-docs` | Broad SAP docs: UI5, CAP, Cloud SDK, ABAP, BTP, AI, Terraform | Discovery Center tools |\n| `abap` | ABAP-focused: ABAP keyword docs, RAP, cheat sheets, style guides | `abap_lint` |\n\n## Documentation Sources\n\n### Offline sources (local index, always available)\n\n| Source | Description |\n|--------|-------------|\n| `abap-docs-standard` | Official ABAP Keyword Documentation — on-premise / full syntax |\n| `abap-docs-cloud` | Official ABAP Keyword Documentation — ABAP Cloud / BTP (restricted syntax) |\n| `abap-cheat-sheets` | Practical ABAP/RAP code snippets and examples |\n| `abap-fiori-showcase` | Annotation-driven RAP + OData V4 + Fiori Elements feature showcase |\n| `abap-platform-rap-opensap` | openSAP \"Building Apps with RAP\" course samples |\n| `cloud-abap-rap` | ABAP Cloud + RAP example projects |\n| `abap-platform-reuse-services` | RAP reuse services examples (number ranges, mail, Adobe Forms, …) |\n| `sap-styleguides` | SAP Clean ABAP Style Guide and best practices |\n| `dsag-abap-leitfaden` | DSAG ABAP Leitfaden (German) development guidelines |\n| `btp-cloud-platform` | SAP BTP concepts, development, security, administration |\n| `sap-artificial-intelligence` | SAP AI Core and SAP AI Launchpad documentation |\n| `ui5` | SAPUI5 / OpenUI5 framework documentation |\n| `cap` | SAP Cloud Application Programming Model (CAP) documentation |\n| `cloud-sdk` | SAP Cloud SDK documentation |\n| `terraform-provider-btp` | SAP Terraform Provider for BTP — resources and data sources |\n| `architecture-center` | SAP Architecture Center reference architectures and guidance |\n| `wdi5` | wdi5 (WebdriverIO + UI5) testing framework documentation |\n\n### Online sources (live queries, enabled by default)\n\n| Source | Description |\n|--------|-------------|\n| SAP Help Portal | Official SAP product documentation (broad scope) |\n| SAP Community | Community blogs, Q&A, and troubleshooting posts |\n| Software Heroes | ABAP/RAP articles and tutorials (EN + DE, deduplicated) |\n\n## Available Tools\n\n### Shared tools (both variants)\n\n| Tool | Description |\n|------|-------------|\n| `search` | Unified hybrid search (BM25 + semantic) across offline docs and optional online sources. Supports `query`, `k`, `includeOnline`, `includeSamples`, `abapFlavor`, `sources` parameters. |\n| `fetch` | Retrieve full document content by ID returned from `search`. |\n| `abap_feature_matrix` | Check ABAP feature availability across SAP releases (7.40–LATEST) using the [Software Heroes feature matrix](https://software-heroes.com/en/abap-feature-matrix). |\n| `sap_community_search` | Dedicated SAP Community search via the Khoros LiQL API — returns full content of top posts. Use when `search` results are insufficient for specific errors or workarounds. |\n| `sap_search_objects` | Search SAP released objects (classes, interfaces, tables, CDS views, …) by name/component/type from the official [SAP/abap-atc-cr-cv-s4hc](https://github.com/SAP/abap-atc-cr-cv-s4hc) release state repo. Useful for clean core compliance discovery. |\n| `sap_get_object_details` | Full release state details for a specific SAP object including clean core level (A/B/C/D), successor objects, and optional compliance verdict. |\n\n### `sap-docs` variant only\n\n| Tool | Description |\n|------|-------------|\n| `sap_discovery_center_search` | Search the SAP Discovery Center service catalog for BTP services by keyword, category, or license model. |\n| `sap_discovery_center_service` | Get comprehensive BTP service details: pricing plans, product roadmap, documentation links, and key features. Accepts a service UUID or name. |\n| `ui5_version_diff` | List all matching FEATURE / FIX / DEPRECATED changes and SAPUI5 What's New entries for a version or range from a local all-changes bundle (`dist/data/ui5-lib-diff/all-changes.json`). `npm run setup` refreshes it automatically; use `npm run download:ui5-lib-diff` during setup/rebuild for a manual refresh. Pair with the [`ui5-version-upgrade` skill](.claude/skills/ui5-version-upgrade/SKILL.md) and `@ui5/mcp-server` for a full upgrade workflow. |\n\n### `abap` variant only\n\n| Tool | Description |\n|------|-------------|\n| `abap_lint` | Run static code analysis on ABAP source code using abaplint. Auto-detects file type from code patterns. Returns findings with line numbers, severity, and rule keys. |\n\n## Architecture Overview\n\n- Upstream source of truth: `mcp-sap-docs`\n- One-way sync target: `abap-mcp-server`\n- Search uses **Hybrid BM25 + Semantic (embedding)** fusion via Reciprocal Rank Fusion (RRF)\n- Embeddings model: `Xenova/all-MiniLM-L6-v2` (~90 MB, cached in `dist/models/`)\n\n## Variant Selection\n\nResolution order:\n\n1. `MCP_VARIANT` environment variable\n2. `.mcp-variant` file in repo root\n3. fallback: `sap-docs`\n\nExamples:\n\n```bash\n# Run as full sap-docs profile\nMCP_VARIANT=sap-docs npm run setup\nMCP_VARIANT=sap-docs npm run build\nMCP_VARIANT=sap-docs npm run start:streamable\n\n# Run as ABAP profile\nMCP_VARIANT=abap npm run setup\nMCP_VARIANT=abap npm run build\nMCP_VARIANT=abap npm run start:streamable\n```\n\n## Search Behavior\n\n`search` performs fused retrieval over:\n\n- Offline FTS index (local submodule content)\n- Optional online sources (`includeOnline=true`):\n  - SAP Help\n  - SAP Community\n  - Software Heroes content search (EN/DE merge + dedupe)\n\nRanking and filtering highlights:\n\n- **Hybrid BM25 + Semantic (embedding) search** — keyword and meaning, fused via RRF\n- Reciprocal Rank Fusion (RRF) across offline and online sources\n- Source-level boosts from metadata\n- `includeSamples` can remove sample-heavy sources\n- `abapFlavor` (`standard` / `cloud` / `auto`) filters official ABAP docs libraries while keeping non-ABAP sources\n- `sources` can restrict offline libraries explicitly\n\n## Hybrid Search\n\nThe offline search combines BM25 (FTS5 keyword matching) with semantic similarity\n(dense embeddings via `Xenova/all-MiniLM-L6-v2`). This allows natural-language and\nparaphrase queries to find relevant docs even when the exact keywords are missing.\n\nExample: _\"how to check if a user has permission\"_ finds `AUTHORITY-CHECK` docs.\n\nEmbeddings are pre-computed at build time and stored in `docs.sqlite`.\nThe model (~90 MB) is cached in `dist/models/` (gitignored, in-project).\n\nSee [docs/HYBRID-SEARCH.md](docs/HYBRID-SEARCH.md) for full details, size impact, and tuning.\n\n## Offline-Only Mode\n\n`search` includes online sources by default. To run offline-only, use:\n\n- local index/submodules only (`npm run setup` + `npm run build`)\n- `includeOnline=false` in each `search` request\n\nExample `search` request body:\n\n```json\n{\n  \"query\": \"RAP draft\",\n  \"k\": 8,\n  \"includeOnline\": false\n}\n```\n\n### Docker (offline-only)\n\nRun the container with host binding and call `search` with `includeOnline=false`:\n\n```bash\ndocker run --rm -p 3122:3122 \\\n  -e MCP_VARIANT=sap-docs \\\n  -e MCP_PORT=3122 \\\n  -e MCP_HOST=0.0.0.0 \\\n  mcp-sap-docs\n```\n\nFor strict air-gapped execution, disable container networking:\n\n```bash\ndocker run --rm --network none -p 3122:3122 \\\n  -e MCP_VARIANT=sap-docs \\\n  -e MCP_PORT=3122 \\\n  -e MCP_HOST=0.0.0.0 \\\n  mcp-sap-docs\n```\n\nNotes:\n\n- With `--network none`, online fetches are impossible by runtime isolation.\n- Startup may log warnings for online prefetch attempts (for example ABAP feature matrix); this does not prevent offline `search` usage.\n\n## Quick Start (Local)\n\n```bash\nnpm ci\nnpm run setup\nnpm run build\n```\n\nStart server modes:\n\n```bash\n# MCP stdio\nnpm start\n\n# HTTP status/dev server\nnpm run start:http\n\n# MCP streamable HTTP\nnpm run start:streamable\n```\n\nDefault ports by variant:\n\n- `sap-docs`: HTTP `3001`, streamable `3122`\n- `abap`: HTTP `3002`, streamable `3124`\n\nHealth checks:\n\n```bash\ncurl -sS http://127.0.0.1:3122/health | jq .\ncurl -sS http://127.0.0.1:3001/status | jq .\n```\n\nUse variant-specific ports when running `abap` profile.\n\n## Build and Setup Scripts\n\nScript names remain shared (`setup`, `build`, `start`, `start:streamable`).\nBehavior changes by variant config:\n\n- `setup.sh` only initializes variant-allowed submodules\n- `build-index` only includes variant-allowed libraries\n- `build-fts` only indexes variant-allowed libraries\n\nThis keeps `abap` faster and smaller without maintaining a separate build script set.\n\n## Docker\n\nBuild image for a variant:\n\n```bash\n# sap-docs image\ndocker build --build-arg MCP_VARIANT=sap-docs -t mcp-sap-docs .\n\n# abap image\ndocker build --build-arg MCP_VARIANT=abap -t abap-mcp-server .\n```\n\nRun streamable server:\n\n```bash\n# sap-docs\ndocker run --rm -p 3122:3122 \\\n  -e MCP_VARIANT=sap-docs \\\n  -e MCP_PORT=3122 \\\n  mcp-sap-docs\n\n# abap\ndocker run --rm -p 3124:3124 \\\n  -e MCP_VARIANT=abap \\\n  -e MCP_PORT=3124 \\\n  abap-mcp-server\n```\n\n## SAP BTP Cloud Foundry\n\nFor BTP CF, the recommended `sap-docs` path is to deploy the maintained\n`ghcr.io/marianfoo/mcp-sap-docs:sap-docs` image with MTA. Cloud Foundry only\npulls and runs the prepared semantic image.\n\nSee [docs/BTP-CF-DEPLOYMENT.md](docs/BTP-CF-DEPLOYMENT.md) for the public-first\ndeployment guide. Start with\n[Deployment Options and Tradeoffs](docs/BTP-CF-DEPLOYMENT.md#deployment-options-and-tradeoffs)\nto choose between MTA, direct `cf push`, custom registry images, and refresh\nsetup.\n\n## One-Way Sync to `abap-mcp-server`\n\nThis repository contains direct sync automation:\n\n- Workflow: `.github/workflows/sync-to-abap-main.yml`\n- Script: `scripts/sync-to-abap.sh`\n\nFlow:\n\n1. Push to `mcp-sap-docs/main`\n2. Workflow clones `abap-mcp-server`\n3. Tracked upstream files are synced (with exclude rules)\n4. ABAP overlay is applied\n5. `.mcp-variant` is forced to `abap`\n6. ABAP package identity is patched\n7. Commit is pushed to `abap-mcp-server/main`\n\nRequired secret in `mcp-sap-docs` repo:\n\n- `ABAP_REPO_SYNC_TOKEN`\n\nCommit message controls:\n\n- `[skip-sync]` skips sync workflow\n\n## Deployment Model\n\n- `mcp-sap-docs`: upstream implementation + sync trigger\n- `abap-mcp-server`: deployment trigger remains push-to-main in that repository\n\nThis preserves ABAP deployment automation while keeping one shared upstream codebase.\n\n## PM2 Runtime\n\n`ecosystem.config.cjs` is variant-aware and resolves:\n\n- process names\n- ports\n- deploy path\n\nfrom `config/variants/*.json`.\n\n## Validation Commands\n\n```bash\nnpm run build:tsc\nnpm run test:url-generation\nnpm run test:integration\nnpm run test:software-heroes\nnpm run test:discovery-center # mocked Discovery Center REST contract tests\nnpm run test:discovery-center:live # opt-in live API smoke test\nnpm run test:sap-objects       # SAP Released Objects unit tests\n\n# Variant-specific build checks\nMCP_VARIANT=sap-docs npm run build:index\nMCP_VARIANT=abap npm run build:index\nMCP_VARIANT=sap-docs npm run build:fts\nMCP_VARIANT=abap npm run build:fts\n```\n\n## Additional Docs\n\n- `docs/ARCHITECTURE.md`\n- `docs/DEV.md`\n- `docs/TESTS.md`\n- `docs/UPSTREAM-ONE-WAY-SYNC-IMPLEMENTATION.md`\n- `REMOTE_SETUP.md`\n\n[werkbank-badge]: assets/add-to-werkbank.svg\n[werkbank-install]: https://getwerkbank.com/install-mcp?name=sap-docs&config=eyJ0eXBlIjoic3RyZWFtYWJsZV9odHRwIiwidXJsIjoiaHR0cHM6Ly9tY3Atc2FwLWRvY3MubWFyaWFuemVpcy5kZS9tY3AiLCJkZXNjcmlwdGlvbiI6IlNBUCBkb2N1bWVudGF0aW9uLCBub3RlcyBhbmQgY29tbXVuaXR5IHNlYXJjaCJ9\n",
  "bytes": 12278,
  "sha": "c62ba83c71f0ed2b5ec7091f33e106ab2abac03f703bab9463aa434f09320094",
  "repo_slug": "marianfoo/mcp-sap-docs",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_marianfoo_mcp_sap_docs_8809f014/readme"
}