SAP CAP MCP Server
Official MCP server for AI-assisted development of SAP Cloud Application Programming Model (CAP) applications, with semantic search over CDS models and CAP docs.
The @cap-js/mcp-server is the official Model Context Protocol server for the SAP Cloud Application Programming Model (CAP). It is maintained by the cap-js organization on GitHub and is designed to make AI coding assistants like Claude Code, GitHub Copilot, Cline, and opencode reliable collaborators on CAP projects. Without project context, LLMs tend to hallucinate CDS syntax or invent non-existent CAP APIs. This server grounds the model in the actual project metadata and official documentation.
The server exposes two focused capabilities: a fuzzy search over the compiled CDS model (entities, fields, services, relationships, HTTP endpoints) and a semantic vector search over the local CAP documentation corpus. Embeddings run locally via onnxruntime-web and @huggingface/transformers.js, so no external embedding API is required. Together, these tools let an AI agent answer questions like "which services does this project expose?", "how are these entities related?", or "how do I register a custom READ handler in CAP Node.js?" with correct, source-backed responses.
The server is published to npm as @cap-js/mcp-server and runs over stdio via npx. It is part of SAP's broader push into agentic coding for CAP, UI5, and Fiori development environments.
Tools
| Tool | Description |
|---|---|
search_model |
Fuzzy search over the compiled CDS model definitions, including entities, fields, services, relationships, annotations, and HTTP endpoints across all .cds files in the project. |
search_docs |
Semantic search over the CAP documentation using local vector embeddings. Converts the query into an embedding and returns the documentation chunks most similar to it. |
Prerequisites
- Node.js and npm installed
- A SAP CAP project (Node.js or Java). See the CAP Getting Started guide
- An MCP-compatible client such as Claude Code, Cline, GitHub Copilot, or opencode
Install (optional global CLI)
npm i -g @cap-js/mcp-server
You can then test the tools directly:
cds-mcp search_model . Books entity
cds-mcp search_docs "how to add columns to a select statement" 1
VS Code (Cline extension)
{
"mcpServers": {
"cds-mcp": {
"command": "npx",
"args": ["-y", "@cap-js/mcp-server"],
"env": {}
}
}
}
VS Code global mcp.json (GitHub Copilot compatible)
{
"servers": {
"cds-mcp": {
"command": "npx",
"args": ["-y", "@cap-js/mcp-server"],
"type": "stdio"
}
}
}
opencode
{
"mcp": {
"cds-mcp": {
"type": "local",
"command": ["npx", "-y", "@cap-js/mcp-server"],
"enabled": true
}
}
}
Recommended LLM rules
The README recommends instructing your LLM to:
- Search the CDS model via
search_modelbefore reading raw.cdsfiles - Consult CAP documentation via
search_docsbefore proposing CDS or API changes - Avoid suggesting changes without verifying against the model or docs first
- Let an AI agent explore an unfamiliar CAP project: enumerate services, entities, and their relationships before making changes
- Generate correct CDS syntax for entities, associations, and projections by grounding the model in the actual compiled CDS definitions
- Answer "how do I" questions about CAP Node.js or CAP Java (custom handlers, bound actions, query building) using semantic search over official CAP docs
- Refactor or extend a CAP service with AI assistance while avoiding hallucinated APIs and invented annotations
- Onboard new developers by letting them ask the AI agent natural language questions about an existing CAP codebase
- "Which CDS services does this CAP project expose, and which entities are served by each?"
- "Find the Books entity and show me all its fields and associations."
- "How do I register a custom READ handler in CAP Node.js?"
- "How do I add columns to a SELECT statement using cds.ql?"
- "Add a bound action
submitOrderto the Orders entity and implement the handler. Check the model and docs first."
- Official, maintained under the
cap-jsGitHub organization alongside the CAP project itself - Fully local: embeddings run on-device via onnxruntime, no external API keys or network calls for search
- Solves a real problem for CAP developers, namely LLM hallucinations of CDS syntax and CAP APIs
- Simple stdio setup that works with Claude Code, Cline, GitHub Copilot, and opencode out of the box
- Narrow scope: only two tools (
search_modelandsearch_docs), no write or scaffolding tools for generating CDS or handlers - Requires the CAP project to be locally available and compiled to be useful for
search_model - First run downloads embedding model weights, which can be slow or fail on restricted networks
- gavdilabs/cap-mcp-plugin: community CAP MCP plugin that exposes a running CAP Node.js service (entities and actions) over MCP for runtime querying rather than dev-time assistance
- SAP UI5 / Fiori MCP servers: companion official MCP servers for UI5 and Fiori development, useful alongside the CAP server