SAP OData to MCP Server for BTP logo

SAP OData to MCP Server for BTP

Community
lemaiwo

BTP CloudFoundry Node.js MCP server for SAP OData services integration

Publisherlemaiwo
Repositorybtp-sap-odata-to-mcp-server
LanguageTypeScript
Forks
66
Stars
132
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    SAP OData to MCP Server for BTP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    132 stars and 66 forks from the linked repository.

SAP OData to MCP Server for BTP🚀

🎯 Project Goal

Transform your SAP S/4HANA or ECC system into a conversational AI interface by exposing all OData services as dynamic MCP tools. This enables natural language interactions with your ERP data:

  • "Show me 10 banks" → Automatically queries the Bank entity with $top=10
  • "Update bank with ID 1 to have street number 5" → Executes PATCH operation on Bank entity
  • "Create a new customer with name John Doe" → Performs POST to Customer entity
  • "List all purchase orders from this week" → Applies $filter for date range on PurchaseOrder entity

🏗️ Architecture Overview - 3-Level Progressive Discovery

Core Components:

  1. 🔍 Level 1 - Discovery: Lightweight search returning minimal service/entity lists (token-optimized)
  2. 📋 Level 2 - Metadata: Full schema details on-demand for selected entities
  3. ⚡ Level 3 - Execution: Authenticated CRUD operations using metadata from Level 2
  4. 🔌 MCP Protocol Layer: Full compliance with MCP 2025-06-18 specification
  5. 🌐 HTTP Transport: Session-based Streamable HTTP for web applications
  6. 🔐 BTP Integration: Seamless authentication via SAP BTP Destination service

3-Level Approach Benefits:

  • Token Efficient: Level 1 returns 90% less data than full schemas
  • Progressive Detail: Fetch full schemas only when needed
  • Better LLM Experience: Smaller responses, clearer workflow
  • Reduced Context: From 200+ tools down to just 3

✨ Key Features

🎨 Natural Language to OData

  • Smart Query Translation: Converts natural language to proper OData queries
  • Context-Aware Operations: Understands entity relationships and constraints
  • Parameter Inference: Automatically maps user intent to tool parameters

🔄 Dynamic CRUD Operations

  • Read Operations: Entity sets with filtering, sorting, pagination
  • Create Operations: New entity creation with validation
  • Update Operations: Partial and full entity updates
  • Delete Operations: Safe entity deletion with confirmation

🚀 Production-Ready

  • Session Management: Automatic session creation and cleanup
  • Error Handling: Comprehensive error handling with user-friendly messages
  • Logging: Detailed logging for debugging and monitoring
  • Security: DNS rebinding protection, CORS, Helmet security

📊 Real-Time Metadata

  • Service Catalog: Live discovery of available services
  • Entity Schemas: Dynamic schema generation from OData metadata
  • Capability Detection: Automatic detection of CRUD capabilities per entity

🏛️ System Architecture

┌─────────────────────┐    ┌───────────────────────────┐    ┌─────────────────────┐
│                     │    │                           │    │                     │
│   🤖 AI Agent       │    │   🖥️  SAP MCP Server     │    │   🏢 SAP            │
│   - Claude          │◄──►│   - Service Discovery     │◄──►│   - OData Services  │
│   - GPT-4           │    │   - CRUD Tool Registry    │    │   - Business Logic  │
│   - Local LLMs      │    │   - Session Management    │    │   - Master Data     │
│                     │    │   - BTP Authentication    │    │                     │
└─────────────────────┘    └───────────────────────────┘    └─────────────────────┘
                                           │                                       
                                           ▼                                       
                           ┌───────────────────────────┐                          
                           │                           │                          
                           │   ☁️  SAP BTP Platform    │                          
                           │   - Destination Service   │                          
                           │   - Connectivity Service  │                          
                           │   - XSUAA Security        │                          
                           │                           │                          
                           └───────────────────────────┘                          

🎯 Use Cases

📈 Business Intelligence Queries

User: "Show me top 10 customers by revenue this quarter"
→ Tool: r-CustomerService-Customer
→ Parameters: $filter, $orderby, $top

📝 Data Maintenance

User: "Update supplier ABC123 to have status 'Active'"
→ Tool: u-SupplierService-Supplier
→ Parameters: SupplierId="ABC123", Status="Active"

📊 Analytical Insights

User: "How many open purchase orders are there?"
→ Tool: r-PurchaseOrderService-PurchaseOrder
→ Parameters: $filter=Status eq 'Open'&$count=true

🔧 System Administration

User: "List all inactive users in the system"
→ Tool: r-UserService-User
→ Parameters: $filter=Status eq 'Inactive'

🛠️ Installation & Setup

Prerequisites

  • Node.js 18.x or higher
  • SAP S/4HANA or ECC system with OData services enabled
  • SAP BTP account with Destination and Connectivity services
  • TypeScript knowledge for customization

🚀 Usage Examples

Natural Language Queries

The MCP server automatically translates these natural language commands to the appropriate tool calls:

Natural LanguageGenerated Tool CallOData Query
"Show me 10 banks"r-BankService-BankGET /BankSet?$top=10
"Find banks in Germany"r-BankService-BankGET /BankSet?$filter=Country eq 'DE'
"Update bank 123 name to ABC Corp"u-BankService-BankPATCH /BankSet('123')
"Create a new customer John Doe"c-CustomerService-CustomerPOST /CustomerSet
"Delete order 456"d-OrderService-OrderDELETE /OrderSet('456')

📋 Available Tools - 3-Level Architecture

The server exposes 3 progressive discovery tools instead of hundreds of individual CRUD tools:

Level 1: discover-sap-data

Purpose: Lightweight search for services and entities

Returns: Minimal data (serviceId, serviceName, entityName, entityCount)

Usage:

javascript
// Search for customer entities
discover-sap-data({ query: "customer" })

// Get all available services
discover-sap-data({ query: "" })

// Search in specific category
discover-sap-data({ query: "sales", category: "sales" })

Fallback: If no matches found, returns ALL services with entity lists


Level 2: get-entity-metadata

Purpose: Get complete schema for a specific entity

Returns: Full schema with properties, types, keys, capabilities

Usage:

javascript
// Get full schema for Customer entity
get-entity-metadata({
  serviceId: "API_BUSINESS_PARTNER",
  entityName: "Customer"
})

Output: All properties, types, nullable flags, maxLength, keys, capabilities


Level 3: execute-sap-operation

Purpose: Perform authenticated CRUD operations

Operations: read, read-single, create, update, delete

Usage:

javascript
// Read customers
execute-sap-operation({
  serviceId: "API_BUSINESS_PARTNER",
  entityName: "Customer",
  operation: "read",
  filterString: "CustomerName eq 'ACME'"
})

// Update customer
execute-sap-operation({
  serviceId: "API_BUSINESS_PARTNER",
  entityName: "Customer",
  operation: "update",
  parameters: { CustomerID: "123", CustomerName: "New Name" }
})

Workflow Example

1. discover-sap-data → "customer"
   ↓ Returns: List of customer-related entities

2. get-entity-metadata → "API_BUSINESS_PARTNER", "Customer"
   ↓ Returns: Full schema with all properties

3. execute-sap-operation → read/create/update/delete
   ✓ Executes operation with proper parameters

Protocol Version: 2025-06-18

Supported Capabilities:

  • ✅ Tools with listChanged notifications
  • ✅ Resources with listChanged notifications
  • ✅ Logging with level control
  • ✅ Session Management for HTTP transport
  • ✅ Error Handling with proper error codes

Transport Support

  • ✅ Streamable HTTP (recommended)
  • ✅ Stdio for command line usage
  • ✅ Session-based with automatic cleanup
  • ✅ DNS Rebinding Protection

🔒 Security & Authentication

SAP BTP Integration

  • Uses BTP Destination service for S/4HANA or ECC authentication
  • Supports Principal Propagation and OAuth2
  • Automatic token refresh and session management
  • Secure credential storage in BTP

HTTP Security

  • Helmet.js security headers
  • CORS protection with configurable origins
  • DNS rebinding attack prevention
  • Request rate limiting (configurable)

Session Security

  • Automatic session expiration (24h default)
  • Secure session ID generation
  • Session cleanup on server restart
  • Memory leak prevention

📚 API Reference

Health Check

http
GET /health
{
  "status": "healthy",
  "activeSessions": 3,
  "discoveredServices": 25,
  "version": "2.0.0"
}

Server Info

http
GET /mcp
{
  "name": "btp-sap-odata-to-mcp-server",
  "protocol": { "version": "2025-06-18" },
  "capabilities": { "tools": {}, "resources": {} },
  "features": ["Dynamic service discovery", "CRUD operations"],
  "activeSessions": 3
}

Documentation

http
GET /docs
{
  "title": "SAP MCP Server API",
  "endpoints": {...},
  "mcpCapabilities": {...},
  "usage": {...}
}

🎬 Demo

See the MCP server in action:

MCP Demo

⚙️ Environment Variable: Disable ReadEntity Tool Registration

To disable registration of the ReadEntity tool for all entities in all services, set the following in your .env file:

env
DISABLE_READ_ENTITY_TOOL=true

This will prevent registration of the ReadEntity tool for all entities and services.

⚡ Quick Start

Installation

TypingMind
{
  "mcpServers": {
    "btp-sap-odata-to-mcp-server": {
      "command": "npx",
      "args": [
        "btp-sap-odata-to-mcp-server"
      ]
    }
  }
}

Use SAP OData to MCP Server for BTP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once SAP OData to MCP Server for BTP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add SAP OData to MCP Server for BTP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the SAP OData to MCP Server for BTP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "btp-sap-odata-to-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "btp-sap-odata-to-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the SAP OData to MCP Server for BTP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the SAP OData to MCP Server for BTP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use SAP OData to MCP Server for BTP to help me with this task?
SAP OData to MCP Server for BTP
Sure. I read it.
Here is what I found using SAP OData to MCP Server for BTP.

Frequently asked questions

What is the SAP OData to MCP Server for BTP MCP server used for?

SAP OData to MCP Server for BTP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use SAP OData to MCP Server for BTP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use SAP OData to MCP Server for BTP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use SAP OData to MCP Server for BTP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With SAP OData to MCP Server for BTP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect SAP OData to MCP Server for BTP MCP to TypingMind?

SAP OData to MCP Server for BTP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does SAP OData to MCP Server for BTP MCP provide in TypingMind?

SAP OData to MCP Server for BTP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use SAP OData to MCP Server for BTP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If SAP OData to MCP Server for BTP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇