SAP OData MCP Server

Integrate SAP systems with AI assistants using OData REST APIs

README.md

SAP OData MCP Server

A Model Context Protocol (MCP) server for integrating SAP systems with AI assistants like Claude using OData REST APIs. This server provides tools for connecting to SAP OData services, querying entity sets, executing CRUD operations, and calling OData functions.

Features

  • SAP OData Connectivity: Connect to SAP systems via OData REST APIs
  • Smart Connection Handling: Properly handles SAP OData URL structures and 404 responses
  • Service Discovery: Automatically discover available OData services via catalog or common service testing
  • Entity Set Queries: Query any OData entity set with filtering, sorting, and pagination
  • CRUD Operations: Create, Read, Update, and Delete operations on OData entities
  • Function Imports: Execute OData function imports and custom functions
  • CSRF Token Handling: Automatic CSRF token management for secure operations
  • Modular Architecture: Clean, maintainable TypeScript codebase with separation of concerns

Prerequisites

  • Node.js 18+
  • SAP system with OData services enabled
  • Network access to SAP OData endpoints
  • SAP user credentials with appropriate authorizations

⚠️ Advantage: No SAP RFC SDK installation required! Uses standard HTTP/REST APIs.

Installation

Quick Setup

  1. Create the project:
mkdir sap-odata-mcp-server
cd sap-odata-mcp-server
mkdir src
  1. Copy the source files from the artifacts to your src/ directory:

    • src/index.ts - Entry point
    • src/server.ts - MCP server setup
    • src/handlers.ts - Request handlers
    • src/odata-client.ts - SAP OData client
    • src/tool-definitions.ts - Tool definitions
    • src/types.ts - TypeScript types
  2. Copy configuration files:

    • package.json - Dependencies and scripts
    • tsconfig.json - TypeScript configuration
    • .env.example - Environment variables template
  3. Install dependencies:

npm install
  1. Configure environment:
cp .env.example .env
# Edit .env with your SAP details
  1. Build the project:
npm run build

Configuration

Environment Variables

Create a .env file with your SAP system details:

# Required SAP OData Configuration
SAP_ODATA_BASE_URL=https://your-sap-host:8000/sap/opu/odata/sap/
SAP_USERNAME=your-sap-username
SAP_PASSWORD=your-sap-password

# Optional Configuration
SAP_CLIENT=100
SAP_TIMEOUT=30000
SAP_VALIDATE_SSL=false  # for development with self-signed certificates
SAP_ENABLE_CSRF=true

Claude Desktop Integration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "sap-odata": {
      "command": "node",
      "args": ["/full/path/to/your/sap-odata-mcp-server/dist/index.js"],
      "env": {
        "SAP_ODATA_BASE_URL": "https://your-sap-host:8000/sap/opu/odata/sap/",
        "SAP_USERNAME": "your-username",
        "SAP_PASSWORD": "your-password",
        "SAP_CLIENT": "100",
        "SAP_VALIDATE_SSL": "false"
      }
    }
  }
}

Available Tools

1. sap_connect

Connect to SAP OData service.

Parameters:

  • baseUrl (required): SAP OData service base URL
  • username (required): SAP username
  • password (required): SAP password
  • client (optional): SAP client number
  • timeout (optional): Request timeout in milliseconds (default: 30000)
  • validateSSL (optional): Validate SSL certificates (default: true)
  • enableCSRF (optional): Enable CSRF token handling (default: true)

2. sap_get_services

Get list of available OData services with intelligent discovery.

3. sap_get_service_metadata

Get metadata for a specific OData service.

Parameters:

  • serviceName (required): Name of the OData service

4. sap_query_entity_set

Query an OData entity set with filtering, sorting, and pagination.

Parameters:

  • serviceName (required): Name of the OData service
  • entitySet (required): Name of the entity set
  • select (optional): Array of fields to select
  • filter (optional): OData filter expression
  • orderby (optional): OData orderby expression
  • top (optional): Number of records to return
  • skip (optional): Number of records to skip
  • expand (optional): Navigation properties to expand

5. sap_get_entity

Get a specific entity by its key values.

Parameters:

  • serviceName (required): Name of the OData service
  • entitySet (required): Name of the entity set
  • keyValues (required): Object with key-value pairs for entity keys

6. sap_create_entity

Create a new entity in an entity set.

7. sap_update_entity

Update an existing entity.

8. sap_delete_entity

Delete an entity.

9. sap_call_function

Call an OData function import.

10. sap_connection_status

Check current SAP OData connection status.

11. sap_disconnect

Disconnect from SAP OData servi

Tools 11

sap_connectConnect to SAP OData service.
sap_get_servicesGet list of available OData services with intelligent discovery.
sap_get_service_metadataGet metadata for a specific OData service.
sap_query_entity_setQuery an OData entity set with filtering, sorting, and pagination.
sap_get_entityGet a specific entity by its key values.
sap_create_entityCreate a new entity in an entity set.
sap_update_entityUpdate an existing entity.
sap_delete_entityDelete an entity.
sap_call_functionCall an OData function import.
sap_connection_statusCheck current SAP OData connection status.
sap_disconnectDisconnect from SAP OData service.

Environment Variables

SAP_ODATA_BASE_URLrequiredSAP OData service base URL
SAP_USERNAMErequiredSAP username
SAP_PASSWORDrequiredSAP password
SAP_CLIENTSAP client number
SAP_TIMEOUTRequest timeout in milliseconds
SAP_VALIDATE_SSLValidate SSL certificates
SAP_ENABLE_CSRFEnable CSRF token handling

Try it

List all available OData services on my SAP system.
Query the 'SalesOrderSet' entity set for orders created in the last 30 days.
Get the metadata for the 'API_BUSINESS_PARTNER' service.
Create a new entry in the 'CustomerSet' with the provided details.
Check the current connection status to the SAP system.

Frequently Asked Questions

What are the key features of SAP OData MCP Server?

Connect to SAP systems via OData REST APIs without requiring the SAP RFC SDK. Automatic service discovery for OData services. Full CRUD operations on OData entities. Automatic CSRF token management for secure operations. Support for complex queries including filtering, sorting, and pagination.

What can I use SAP OData MCP Server for?

Automating data retrieval from SAP for business reporting. Enabling AI assistants to perform CRUD operations on SAP master data. Integrating SAP function imports into AI-driven workflows. Simplifying SAP system exploration for developers using natural language.

How do I install SAP OData MCP Server?

Install SAP OData MCP Server by running: npm install && npm run build

What MCP clients work with SAP OData MCP Server?

SAP OData MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep SAP OData MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare