Sponsored by Deepsite.site

SAP-Claude Integration via MCP (Model Context Protocol)

Created By
CostingGeek8 months ago
An MCP server to retrieve information like Sales Orders from the SAP Graph API Sandbox
Content

SAP-Claude Integration via MCP (Model Context Protocol)

Connect Claude AI capabilities directly to your SAP systems through a seamless MCP integration

This repository contains a Python-based solution that enables bidirectional communication between Claude (Anthropic's large language model) and SAP systems via the SAP Graph API. By leveraging the Model Context Protocol (MCP), this integration allows Claude to retrieve and process SAP business data in real-time.

Features

  • Connect Claude to SAP systems with minimal setup
  • Retrieve real-time sales order data from SAP via Graph API
  • Extend the integration with additional SAP entities (Customers, Products, etc.)
  • Process SAP data with the full capabilities of Claude's LLM

Prerequisites

  • Python 3.8+
  • SAP API key (sandbox or production)
  • Claude Desktop
  • Basic understanding of MCP and SAP Graph API

This documentation is written for a Windows environment with administrator rights

Reference Documentation

Installation

  1. Get the SAP API Key

Log into the SAP Graph Navigator. You will find the API key in your profile, under Settings > API Settings. Save that API key as system environment variable "SAP_API_KEY". Make sure to restart your machine to load the new environment variable.

  1. Set up your environment

Let's follow the Documentation for Server Developers.

First, let’s install uv and set up our Python project and environment:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Make sure to restart your terminal afterwards to ensure that the uv command gets picked up.

Now, let’s create and set up our project:

# Create a new directory for our project
uv init saptools
cd saptools

# Create virtual environment and activate it
uv venv
.venv\Scripts\activate

# Install dependencies
uv add mcp[cli] httpx requests

# Create our server file
new-item saptools.py
  1. Building the server

Clone the saptools.py file into your own file.

  1. Connect Claude Desktop with the MCP Server

Open Claude Studio. Under File > Settings > Developer, click Edit Config. Edit the file claude_desktop_config.json usually located in the %APPDATA%\Claude folder. Make sure to replace the C:\\PATH\\TO\\PARENT\\FOLDER with your own.

{
    "mcpServers": {
        "saptools": {
            "command": "uv",
            "args": [
                "--directory",
                "C:\\PATH\\TO\\PARENT\\FOLDER",
                "run",
                "saptools.py"
            ]
        }
    }
}

Now, restart Claude Desktop to load the configuration. Note that by default, closing the Claude window only minimizes it to the system tray. You will need to close it completely by right-clicking on the icon in the system tray and selecting Quit. After restarting Claude, a new hammer icon should show in the chat window, that displays the number of active MCP tools. Click on it to show the information popup, which should show: get_sales_orders Retrieve sales orders from SAP Graph API sandbox. Args: top: Number of sales orders to retrieve (default: 3). api_key: SAP API key (optional, will use environment variable if not provided) Returns:String containing formatted sales order information

  1. Test the MCP Server

You should now be ready to chat with your SAP system from Claude with prompts like:

Give me the last 10 sales orders
What is the average amount of the last 5 sales orders

This is of course limited at this point, but extensions to this proof-of-concept should support more complex interactions, like getting the last sales orders for a given customer.

🛠️ How It Works

This solution uses the Model Context Protocol (MCP) to create a bidirectional communication channel between Claude and SAP systems:

  1. An MCP server is initialized using the FastMCP library
  2. The server exposes SAP functionality as "tools" that Claude can invoke
  3. When Claude needs to access SAP data, it calls the appropriate tool function
  4. The function connects to SAP Graph API and returns formatted results
  5. Claude processes the returned data and generates relevant insights

📊 Current Available Tools

get_sales_orders

Retrieves sales order information from SAP Graph API.

Parameters:

  • top (int, optional): Number of sales orders to retrieve (default: 3)
  • api_key (str, optional): SAP API key (uses environment variable if not provided)

Example response:

Found 3 sales orders:

Order ID: 123456
Display ID: SO-123456
Sold To Party: ACME Corp
Net Amount: 5000.00 USD
Created At: 2024-10-12T15:30:00Z
----------------------------------------
Order ID: 123457
Display ID: SO-123457
Sold To Party: TechInnovations
Net Amount: 7500.00 USD
Created At: 2024-10-13T09:15:00Z
----------------------------------------
Order ID: 123458
Display ID: SO-123458
Sold To Party: SampleCustomer
Net Amount: 2500.00 USD
Created At: 2024-10-14T09:15:00Z
----------------------------------------
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Tavily Mcp
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
Serper MCP ServerA Serper MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™