cap -plugin
MCP (Model Context Protocol) server plugin for CAP NodeJS
claude mcp add --transport stdio gavdilabs-cap-mcp-plugin node path/to/your/cds/app/server.js \ --env PORT="4004" \ --env MCP_ENDPOINT="/mcp" \ --env CAP_APP_BASE_URL="http://localhost:4004" \ --env CAP_SERVICE_ROOT="/odata"
How to use
This CAP MCP Plugin automatically converts annotated CAP services into an MCP server accessible to MCP clients. After installing the plugin and annotating your CAP services with @mcp and related tools, start your CAP application (typically via cds serve). The MCP server will be exposed under the /mcp endpoint on your running CAP app (e.g., http://localhost:4004/mcp). Use an MCP client or inspector to browse resources, tools, and prompts generated from your CAP data models. Tools created from annotated functions and actions will appear as executable MCP tools with descriptions and field hints to guide AI usage. You can also opt to expose CAP entities as resources with OData v4 query support, and wrap entities as tools for AI workflows. To experiment, connect the MCP inspector to http://localhost:4004/mcp to explore available resources and tools, then invoke tools or issue natural language queries against your data.
How to install
Prerequisites:
- Node.js 18+ installed
- SAP CAP tooling available (cds CLI)
- npm installed
Step 1: Install the MCP plugin
npm install @gavdi/cap-mcp
Step 2: Add MCP configuration to your CAP project (package.json)
{
"cds": {
"mcp": {
"name": "my-bookshop-mcp",
"auth": "inherit",
"wrap_entities_to_actions": false,
"wrap_entity_modes": ["query", "get"],
"instructions": "MCP server instructions for agents"
}
}
}
Step 3: Annotate your CAP services with @mcp and related options as shown in the README examples.
Step 4: Start your CAP application (the MCP server runs as part of the CAP app)
cds serve
Step 5: Access the MCP endpoint at
- MCP Endpoint: http://localhost:4004/mcp
- Health Check: http://localhost:4004/mcp/health
Optional: Test with the MCP Inspector
npx @modelcontextprotocol/inspector
Note: The server is tied to the CAP app process. If you run in a container or with a process manager, ensure PORT and MCP_ENDPOINT align with your deployment configuration.
Additional notes
Tips and common issues:
- Ensure your CAP app exposes the MCP route at /mcp and is reachable from your client (adjust PORT if you run on non-default ports).
- When wrapping entities as tools, consider enabling mcp.wrap in CAP annotations to automatically generate executable tools like CatalogService_Books_query or CatalogService_Books_get.
- Use @mcp.omit to protect sensitive fields from MCP responses.
- If you modify annotations, restart the CAP server to regenerate MCP endpoints.
- The inspector can be used to explore resources, tools, and prompts and can help validate the generated MCP configuration.
- Environment variables like CAP_APP_BASE_URL, MCP_ENDPOINT, and PORT can be overridden in your deployment environment to suit containerized or multi-service setups.
Related MCP Servers
mcp-graphql
Model Context Protocol server for GraphQL
penpot
Penpot's official MCP Server
mcp-google-map
A powerful Model Context Protocol (MCP) server providing comprehensive Google Maps API integration with LLM processing capabilities.
systemprompt-code-orchestrator
MCP server for orchestrating AI coding agents (Claude Code CLI & Gemini CLI). Features task management, process execution, Git integration, and dynamic resource discovery. Full TypeScript implementation with Docker support and Cloudflare Tunnel integration.
pluggedin-app
The Crossroads for AI Data Exchanges. A unified, self-hostable web interface for discovering, configuring, and managing Model Context Protocol (MCP) servers—bringing together AI tools, workspaces, prompts, and logs from multiple MCP sources (Claude, Cursor, etc.) under one roof.
mcp
MCP server for AI-assisted development of CAP applications