cds-kb-mcp

cds-kb-mcp

A dataless MCP server that searches the SAP CDS knowledge base, allowing users to query view metadata and retrieve full view details using local or remote data sources.

Category
访问服务器

README

cds-kb-mcp

A dataless MCP server that gives AI agents access to 7,355 SAP S/4HANA CDS views via semantic search and structured taxonomy. Ships no view data — you point it at the data either locally or it automatically fetches from GitHub.

The whole server bundles into one file (dist/cds-kb-mcp.mjs, ~784 KB) that runs on any machine with Node ≥ 18.

Works perfectly with Claude Desktop, Claude Code, Antigravity IDE, and any MCP-compatible client.


Table of Contents


Quick Start

1. Zero-Config Run (Online Mode)

The absolute easiest way to start. It will automatically download the search index and fetch views on-demand from the official GitHub repository.

git clone https://github.com/truongdva2/cds-kb-mcp.git
cd cds-kb-mcp

# Run without any arguments! Defaults to online remote mode.
node dist/cds-kb-mcp.mjs

2. Local Data Run (Offline Mode)

For the fastest, zero-latency experience.

# Clone the server and the data repo
git clone https://github.com/truongdva2/cds-kb-mcp.git
git clone --recurse-submodules https://github.com/truongdva2/cds-kb-mcp.git # Or clone cds-kb-data manually

# Run pointing to the local data folder
node dist/cds-kb-mcp.mjs --data ./cds-kb-data

Installation

Option A: Use pre-built bundle (recommended)

The dist/cds-kb-mcp.mjs file is committed to the repo — no build step required.

git clone https://github.com/truongdva2/cds-kb-mcp.git
# That's it. The server is ready to run.

Option B: Build from source

git clone https://github.com/truongdva2/cds-kb-mcp.git
cd cds-kb-mcp
npm install
npm run build    # → dist/cds-kb-mcp.mjs (~784 KB, self-contained)

Prerequisites

  • Node.js ≥ 18 (uses native fetch, ES modules)
  • No other runtime dependencies — everything is bundled into the single file.

Data Source Configuration

The server resolves its data source in the following precedence order. Local wins when both are set. If nothing is provided, it safely defaults to Remote (Online) mode.

Priority Flag Env Var Mode
1 --data <path> CDS_KB_DATA Local — reads a cloned data repo. Offline, fastest.
2 --remote <url> CDS_KB_REMOTE Remote — downloads index once, lazy-fetches views, cached.
3 (None) (None) Default Remote — automatically points to https://raw.githubusercontent.com/truongdva2/cds-kb-data/main.

Remote mode caching

  1. Downloads search_index.json (~5 MB) and taxonomy.json once → cached to ~/.cache/cds-kb/<hash>/
  2. Individual views fetched on-demand when get_cds_view is called → also cached
  3. Cache auto-expires after 24 hours (configurable via CDS_KB_CACHE_TTL_HOURS)
  4. Force re-download: set CDS_KB_REFRESH=1

Tools Reference

The server exposes 5 highly optimized MCP tools:

1. search_cds

Search CDS views by business meaning, name, or traditional SAP keywords (e.g. VBAK). Returns a ranked shortlist.

Parameter Type Required Description
query string ✅ Natural-language or keyword query
module string ❌ Module code (FI, SD, MM) or name (Finance, Procurement)
lob string ❌ Line-of-business filter (partial match)
bo string ❌ Business object filter (partial match)
limit number ❌ Max results, 1–50 (default: 10)

Examples:

// Search by natural language
search_cds("overdue customer invoices", module="Finance")

// Search by traditional SAP T-Codes or Table Names (thanks to Synonym Enrichment!)
search_cds("VBAK") 
search_cds("BSEG")

// Search with specific BO filter
search_cds("material stock", bo="Inventory")

2. get_taxonomy

Retrieves the semantic map of the knowledge base. It groups all views into Lines of Business (LOB) and Business Objects (BO), providing rich keywords.

Use this to understand how data is organized before searching, or to discover valid tags for get_views_by_tag.

Parameter Type Required Description
(none) — — —

Example output:

SAP CDS Knowledge Base Taxonomy

## Lines of Business (12)
- **lob:finance** (finance) — Keywords: FI, FIN, General Ledger, Accounts Payable, Asset Accounting, Tax...
- **lob:sales & distribution** (sales & distribution) — Keywords: SD, Sales Order, Billing, Pricing...

## Business Objects (829 total, sample of 30)
- **bo:salesorder** — Keywords: SO, SD-SLS, Customer Order, VBAK
- **bo:journalentry** — Keywords: FI-GL, BSEG, BKPF, Accounting Document
...

3. get_views_by_tag

Retrieve a deterministic, paginated list of all CDS views that possess a specific tag (e.g., bo:salesorder or lob:finance). Use this to accurately browse a category without relying on semantic search.

Parameter Type Required Description
tag string ✅ The exact tag to filter by, e.g., "bo:salesorder"
limit number ❌ Max results (default 50)

Examples:

get_views_by_tag("bo:salesorder")
get_views_by_tag("lob:controlling")

4. get_cds_view

Return the full (or partial) markdown definition of one CDS view.

Parameter Type Required Description
name string ✅ Exact view name (case-insensitive)
sections string[] ❌ Filter to specific sections (saves tokens)

Available sections: metadata, fields, associations, source

Examples:

get_cds_view("I_PurchaseOrderAPI01")                       // full view
get_cds_view("I_PurchaseOrderAPI01", sections=["metadata", "fields"])  // 62% smaller, recommended!
get_cds_view("C_PURCHASEORDERDEX", sections=["source"])    // DDL source code only

💡 Token savings: For large views (some are 50–95 KB), using sections can save 60–80% of context window tokens. Always use ["metadata", "fields"] first to understand the view structure!

5. kb_info

Report the active data source, view count, enrichment coverage, and index build time.


Client Registration

Claude Code

# Zero-config (Online Default)
claude mcp add cds-kb -- node /abs/path/to/cds-kb-mcp/dist/cds-kb-mcp.mjs

# Local data
claude mcp add cds-kb -- node /abs/path/to/cds-kb-mcp/dist/cds-kb-mcp.mjs --data /abs/path/to/cds-kb-data

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "cds-kb": {
      "command": "node",
      "args": [
        "/abs/path/to/cds-kb-mcp/dist/cds-kb-mcp.mjs"
      ]
    }
  }
}

Restart Claude Desktop after editing.

Antigravity IDE

Add via the IDE's MCP settings UI:

Setting Value
Command node
Args ["/abs/path/to/cds-kb-mcp/dist/cds-kb-mcp.mjs"]

Data Enrichment & Taxonomy

The search index ships with 7,160 enriched views (97.3%) that have human-readable semanticDescription extracted from @EndUserText.label annotations in DDL source.

It also integrates a curated Taxonomy (taxonomy.json). When the index is built, keywords like VBAK, EKKO, BSEG are dynamically injected into a synonyms field for the relevant Business Objects. This allows AI to search using traditional SAP terminology even if those words aren't in the official view descriptions!

Re-run enrichment after data updates

cd cds-kb-mcp
node enrich_index.mjs /path/to/cds-kb-data
npm run build

This will:

  1. Scan all 7,355 view files for @EndUserText.label
  2. Populate semanticDescription field in the index
  3. Load taxonomy.json and inject keywords into the synonyms field for ~6,900 views.
  4. Rebuild the MiniSearch index from scratch.
  5. Create a .bak backup of the original index.

Architecture

┌─────────────────────────────────────────────────────┐
│                   AI Agent / Client                  │
│            (Claude, Antigravity IDE, etc.)            │
└──────────────────────┬──────────────────────────────┘
                       │ MCP (stdio JSON-RPC)
                       ▼
┌─────────────────────────────────────────────────────┐
│              cds-kb-mcp (this repo)                  │
│                                                      │
│  ┌──────────────┐  ┌──────────────┐  ┌────────────┐ │
│  │  search_cds  │  │ get_cds_view │  │get_taxonomy│ │
│  └──────┬───────┘  └──────┬───────┘  └─────┬──────┘ │
│         │                 │                 │        │
│         ▼                 ▼                 ▼        │
│  ┌──────────────────────────────────────────────┐   │
│  │          MiniSearch (in-memory BM25)          │   │
│  │  boost: name(3x) semantic(2.5x) synonyms(2x)  │   │
│  └──────────────────────┬───────────────────────┘   │
│                         │                            │
│  ┌──────────────────────▼───────────────────────┐   │
│  │  DataSource (Local or Remote, pluggable)      │   │
│  │  - LocalDataSource: direct file reads         │   │
│  │  - RemoteDataSource: HTTP + disk cache (24h)  │   │
│  └──────────────────────┬───────────────────────┘   │
└─────────────────────────┼───────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────┐
│             cds-kb-data (separate repo)              │
│                                                      │
│  index/taxonomy.json        (LOBs, BOs, Keywords)   │
│  index/search_index.json    (~5 MB, self-desc.)     │
│  views/*.md                 (7,355 CDS view files)  │
└─────────────────────────────────────────────────────┘

Key design decisions

Decision Rationale
Data/code separation Data updates independently of server code
Taxonomy Routing Deterministic browsing via get_taxonomy & get_views_by_tag without file bloat
Synonym Injection Allows searching for traditional SAP T-Codes/Tables (e.g. VBAK)
Section-based retrieval get_cds_view(sections) saves 60–80% tokens per read
Single-file bundle dist/cds-kb-mcp.mjs — no install needed on target
Zero-config Remote Defaults to fetching from GitHub online automatically
Cache with TTL Remote cache auto-refreshes every 24h

Environment Variables

Variable Default Description
CDS_KB_DATA — Path to local data repo (alternative to --data)
CDS_KB_REMOTE https://.../main Raw GitHub URL (alternative to --remote)
CDS_KB_REFRESH 0 Set to 1 to force re-download of remote index
CDS_KB_CACHE_TTL_HOURS 24 Cache expiry for remote mode (in hours)

Troubleshooting

Search returns poor results

Check kb_info output — if enriched: 0, the index hasn't been enriched.

Fix:

node enrich_index.mjs /path/to/cds-kb-data

Remote cache is stale

# Force re-download
CDS_KB_REFRESH=1 node dist/cds-kb-mcp.mjs

View not found

View names are case-insensitive but must be exact. Use search_cds or get_views_by_tag first to find the correct name.


Project Structure

cds-kb-mcp/
├── src/
│   ├── server.mjs        # MCP server — tool definitions, search logic
│   └── datasource.mjs    # Data access layer (Local + Remote backends)
├── dist/
│   └── cds-kb-mcp.mjs    # Pre-built single-file bundle (~784 KB)
├── cds-kb-data/          # Git submodule (if cloned with --recurse-submodules)
├── build.mjs             # esbuild bundler config
├── enrich_index.mjs      # Index enrichment script
├── test_tools.mjs        # Integration smoke tests
├── package.json
└── README.md

License

MIT

推荐服务器

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

官方
精选