sap-datasphere-mcp

MarioDeFelipe/sap-datasphere-mcp

3.2

If you are the rightful owner of sap-datasphere-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The SAP Datasphere MCP Server is a Model Context Protocol server that facilitates AI assistants in accessing SAP Datasphere APIs for intelligent data management.

Tools
5
Resources
0
Prompts
0

SAP Datasphere MCP Server v2.0 ๐Ÿš€

PyPI version Python 3.8+ License: MIT

๐ŸŽฏ 100% Success Rate - Production Ready!

A Model Context Protocol (MCP) server that provides AI assistants with real, working access to SAP Datasphere APIs. Version 2.0 features complete API integration with 100% success rate on all tools, enabling intelligent data exploration, analytical model consumption, and OData integration.

๐ŸŽ‰ Now Available on PyPI! Install with: pip install sap-datasphere-mcp==2.0.0

โœจ What's New in v2.0 - Production Ready!

  • ๐ŸŽฏ 100% Success Rate - All MCP tools working with real SAP Datasphere APIs
  • ๐Ÿ“Š Real Data Integration - Actual analytical model consumption with live data
  • ๐Ÿ”„ Complete OData Support - Full OData 4.0 integration with XML metadata
  • ๐Ÿš€ Production Server - Dedicated production-ready server implementation
  • ๐Ÿ“ฆ PyPI Distribution - Easy installation via pip install
  • ๐Ÿ”ง Technical User Support - Proper OAuth scopes for API access
  • ๐Ÿ“‹ Query Parameters - Full support for $top, $skip, $filter, $select

๐Ÿš€ Quick Start

Installation

Option 1: Install from PyPI (Recommended)
# Install the latest production version
pip install sap-datasphere-mcp==2.0.0

# Verify installation
sap-datasphere-mcp --version
Option 2: Install Development Version
git clone https://github.com/MarioDeFelipe/sap-datasphere-mcp.git
cd sap-datasphere-mcp
pip install -e .

Usage

Production Server (Recommended)
# Run the production server with 100% success rate
sap-datasphere-mcp-production
Original Server
# Run the original server
sap-datasphere-mcp
Test with MCP Inspector
# Test the production server
npx @modelcontextprotocol/inspector sap-datasphere-mcp-production

# Test the original server  
npx @modelcontextprotocol/inspector sap-datasphere-mcp

๐Ÿ”ง Features

Core Capabilities

  • ๐Ÿ” OAuth 2.0 Authentication - Secure Technical User authentication with proper scopes
  • ๐Ÿ“Š Analytical Model Data - Query real analytical models with OData parameters
  • ๐Ÿ“‹ Service Information - Get complete service metadata and available entities
  • ๐Ÿ—‚๏ธ XML Metadata - Access complete analytical model schemas (2000+ chars)
  • ๐Ÿ” Connection Testing - Verify all endpoints and authentication status
  • โš™๏ธ OData Query Support - Full support for $top, $skip, $filter, $select parameters

Production Features

  • ๐ŸŽฏ 100% Success Rate - All tools tested and working with real SAP APIs
  • ๐Ÿš€ Production Ready - Dedicated production server implementation
  • ๐Ÿ”„ Real-time Data - Live connection to SAP Datasphere consumption APIs
  • ๐Ÿ›ก๏ธ Enterprise Grade - Built for production SAP environments
  • ๐Ÿง  AI Optimized - Structured responses optimized for AI consumption

๐Ÿ“‹ Prerequisites

  • Python 3.8+ - Required for MCP framework
  • SAP Datasphere Tenant - Access to SAP Datasphere instance
  • Technical User - OAuth client with API access permissions
  • OAuth Credentials - Client ID, Client Secret, and Token URL

โš™๏ธ Configuration

Step 1: Create Technical User in SAP Datasphere

  1. Go to System โ†’ Administration โ†’ App Integration โ†’ OAuth Clients
  2. Create a new Technical User (not regular user)
  3. Enable API access permissions and required scopes
  4. Note down: Client ID, Client Secret, and Token URL

Step 2: Configure Credentials

Update the production server with your credentials in: sap_datasphere_mcp/production_server.py

# Update these with your SAP Datasphere credentials
"tenant_url": "https://your-tenant.eu20.hcs.cloud.sap",
"oauth_config": {
    "client_id": "your-technical-user-client-id",
    "client_secret": "your-technical-user-client-secret", 
    "token_url": "https://your-tenant.authentication.eu20.hana.ondemand.com/oauth/token"
}

Step 3: Test Connection

# Test that everything works
sap-datasphere-mcp-production

# In another terminal, test with MCP Inspector
npx @modelcontextprotocol/inspector sap-datasphere-mcp-production

๐Ÿ› ๏ธ MCP Tools (v2.0 - Production Ready)

Available Tools

ToolDescriptionParametersSuccess Rate
get_analytical_model_dataQuery analytical model data with OData parameterstop, skip, filter, selectโœ… 100%
get_analytical_model_infoGet service metadata and available entitiesNoneโœ… 100%
get_analytical_model_metadataGet complete XML metadata schemaNoneโœ… 100%
test_datasphere_connectionTest authentication and all endpointsNoneโœ… 100%

Tool Details

get_analytical_model_data

Query real analytical data from SAP Datasphere with OData parameters.

Parameters:

  • top (integer): Number of records to return (default: 100)
  • skip (integer): Number of records to skip (default: 0)
  • filter (string): OData filter expression (optional)
  • select (string): Comma-separated fields to select (optional)

Example Response:

{
  "@odata.context": "https://tenant.../New_Analytic_Model_2/$metadata#New_Analytic_Model_2",
  "value": [
    // Actual analytical data records
  ]
}
get_analytical_model_info

Get service information and available entities.

Returns:

  • OData context URL
  • Available service entities
  • Entity names and URLs
  • Complete service metadata
get_analytical_model_metadata

Get complete XML metadata schema for the analytical model.

Returns:

  • Full XML schema (2000+ characters)
  • Entity definitions
  • Property types and relationships
  • OData service structure
test_datasphere_connection

Test OAuth authentication and verify all endpoints are working.

Returns:

  • Authentication status
  • OAuth token validity
  • Endpoint test results
  • Configuration summary

๐Ÿ“Š Success Metrics

Version Comparison

Metricv1.0v2.0
API Success Rate0% (HTML only)100% โœ…
Real Data AccessโŒ Noโœ… Yes
OData SupportโŒ Noโœ… Complete
Production ReadyโŒ Noโœ… Yes
Working Tools0/44/4 โœ…

Journey to 100% Success

  • Started: 0% API access, HTML redirects only
  • Breakthrough: Found real consumption API pattern
  • Optimized: Fixed all authentication and endpoint issues
  • Achieved: 100% success rate with real SAP data integration

๐Ÿ—๏ธ Architecture

sap-datasphere-mcp/
โ”œโ”€โ”€ sap_datasphere_mcp/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ server.py              # Original MCP server
โ”‚   โ”œโ”€โ”€ production_server.py   # Production server (v2.0) โญ
โ”‚   โ”œโ”€โ”€ auth.py               # OAuth 2.0 authentication
โ”‚   โ”œโ”€โ”€ client.py             # SAP Datasphere API client
โ”‚   โ””โ”€โ”€ models.py             # Pydantic data models
โ”œโ”€โ”€ tests/                    # Comprehensive test suite
โ”œโ”€โ”€ examples/                 # Usage examples
โ”œโ”€โ”€ docs/                     # Documentation
โ”œโ”€โ”€ pyproject.toml           # Package configuration
โ””โ”€โ”€ README.md                # This file

Key Components

  • Production Server (production_server.py) - 100% working implementation
  • OAuth Authentication - Technical User with proper API scopes
  • OData Client - Complete OData 4.0 integration
  • Real API Integration - Actual SAP Datasphere consumption endpoints

๐Ÿ”ง Development

Setup Development Environment

# Clone repository
git clone https://github.com/MarioDeFelipe/sap-datasphere-mcp.git
cd sap-datasphere-mcp

# Install in development mode
pip install -e .

# Install development dependencies
pip install pytest black ruff mypy

# Run tests
pytest

# Format code
black .
ruff check --fix .

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=sap_datasphere_mcp

# Test production server specifically
python -m pytest tests/test_production_server.py -v

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run tests: pytest
  5. Format code: black . && ruff check --fix .
  6. Submit a pull request

Areas for Contribution

  • ๐Ÿ” Additional API Endpoints - Discover and implement more SAP Datasphere APIs
  • ๐Ÿงช Enhanced Testing - Add more comprehensive test coverage
  • ๐Ÿ“š Documentation - Improve docs and add more examples
  • ๐Ÿš€ Performance - Optimize API calls and caching
  • ๐Ÿ”ง Features - Add new MCP tools and capabilities

๐Ÿ“ฆ PyPI Package

  • Package: sap-datasphere-mcp
  • Latest Version: 2.0.0
  • Install: pip install sap-datasphere-mcp==2.0.0
  • Status: Production/Stable

๐Ÿ“š Resources

๐Ÿ“„ License

MIT License - see file for details.

๐ŸŽฏ What's Next?

  • ๐Ÿ” Discover More APIs - Find additional SAP Datasphere endpoints
  • ๐Ÿš€ Enhanced Features - Add more analytical capabilities
  • ๐ŸŒ Community Growth - Build ecosystem of SAP + AI integrations
  • ๐Ÿ“Š Enterprise Features - Add advanced enterprise capabilities

๐Ÿ† Achievement Unlocked!

From 0% to 100% Success Rate - This project demonstrates how to build production-ready AI integrations with enterprise SAP systems.

Ready to revolutionize AI-powered SAP integrations! ๐Ÿš€