SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
β€’ Open full site

Add MCP capabilities to a CAP service

Learn how easy it is to add an MCP server to your CAP service.

Overview

🎓 beginner 15 min. SAP Cloud Application Programming ModelSAP Business Technology PlatformCloudBeginner

You will learn

  • βœ”Understand what the Model Context Protocol is
  • βœ”How to add MCP server capabilities to your CAP service
  • βœ”What the high level protocol flow looks like
DJ Adams D DJ Adams August 12, 2026
Created by August 12, 2026
Contributors

Prerequisites

Prerequisites

You will need a development environment for CAP Node.js. See the tutorial Set up a self-contained development environment for CAP Node.js The assumptions in this tutorial are based on option 1 or option 2 in that tutorial, in that you have a VS Code (or GitHub Codespace) environment based on the foundation repository used in the setup described there, which also means that your starting directory will be /workspaces/cap-nodejs-dev-env. If you have your own CAP Node.js development environment setup, then please make the appropriate adjustments where necessary.

You will also need a coding agent with MCP capabilities. OpenCode is what we will use for this tutorial. Install it in your self-contained development environment with npm install --global opencode-ai.

Steps

Intro

Put extremely simply, large Language Models (LLMs) can think (in a next-token-prediction kind of way) but not act, not cause things to happen in the world beyond its own model. There’s a parallel with purely function languages like Haskell, which interacts with the outside world via monads.

In the context of LLMs, the equivalent of monads is the Model Control Protocol (MCP). This is a protocol that provides a unifying layer between LLMs and all sorts of services that can provide information and offer a wide range of facilities.

In CAP, MCP is just another protocol, and through CAP’s “magic made simple” approach, extremely straightforward to configure.

At the time of writing, the MCP adapter in CAP is in beta status.


Step 1 Set up a simple CAP service
β€”

To have something to which we can add MCP capabilities, let’s set up a very simple CAP project with a basic “books” oriented service. Conveniently there’s the tiny-sample facet which we can use.

πŸ‘‰ Create a new CAP project using this facet, plus the nodejs facet:

Shell
cds init --add tiny-sample,nodejs cap-add-mcp-capabilities

We’re adding the nodejs facet so that we have a package.json file, as we’ll be installing a package with npm later.

πŸ‘‰ Now open the new cap-add-mcp-capabilities/ directory in a new VS Code / Codespace window:

Shell
code cap-add-mcp-capabilities/

This should place you and any new terminal session in the new cap-add-mcp-capabilities/ directory.

There’s a simple CatalogService with a single Books entity, for which there are a handful of records. Let’s have a quick look.

πŸ‘‰ Start the server with cds watch, which should cause log lines as shown below to be emitted:

Log
[cds] - loaded model from 1 file(s):
 
  srv/cat-service.cds

[cds] - using bindings from: { registry: '~/.cds-services.json' }
[cds] - connect to db > sqlite { database: ':memory:' }
  > init from db/data/CatalogService.Books.csv 
/> successfully deployed to in-memory database. 

[cds] - serving CatalogService {
  at: [ '/odata/v4/catalog' ],
  decl: 'srv/cat-service.cds:1'
}
[cds] - server listening on { url: 'http://localhost:4004' }

The path on which CatalogService is served - /odata/v4/catalog - indicates that this is OData v4.

πŸ‘‰ Check out the data by visiting http://localhost:4004/odata/v4/catalog/Books, which should show something like this (you may want to use a JSON formatter extension in your browser to see the representation formatted nicely):

JSON
{
  "@odata.context": "$metadata#Books",
  "value": [
    {
      "ID": 1,
      "title": "Wuthering Heights",
      "author": "Emily BrontΓ«"
    },
    {
      "ID": 2,
      "title": "Jane Eyre",
      "author": "Charlotte BrontΓ«"
    },
    {
      "ID": 3,
      "title": "The Raven",
      "author": "Edgar Allen Poe"
    },
    {
      "ID": 4,
      "title": "Eleonora",
      "author": "Edgar Allen Poe"
    },
    {
      "ID": 5,
      "title": "Catweazle",
      "author": "Richard Carpenter"
    }
  ]
}
Step 2 Examine and extend the CDS model
+
Step 3 Install the MCP adapter plugin
+
Step 4 Take a peek at the MCP protocol
+
Step 5 Start OpenCode and examine what is displayed
+
Step 6 Try out a query
+
Step 7 Wrap-up and further info
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Set up a simple CAP service 2. Examine and extend the CDS model 3. Install the MCP adapter plugin 4. Take a peek at the MCP protocol 5. Start OpenCode and examine what is displayed 6. Try out a query 7. Wrap-up and further info

Learn more →