SAP Integration Content MCP
# mcp-ci-pyton — SAP Integration Content MCP
Servidor [MCP](https://modelcontextprotocol.io) em Python para a [SAP Cloud Integration Content OData API](https://api.sap.com/api/IntegrationContent/resource/Integration_Flow).
Expõe ferramentas para gerenciar **Integration Flows (iFlows)**, pacotes, configurações, recursos, deploy e endpoints de runtime.
## Estrutura do Projeto
```
mcp-ci-pyton/
├── pyproject.toml
├── .env.example
├── README.md
└── src/sap_integration_mcp/
├── server.py # Entry point MCP
├── config.py # Configuração via variáveis de ambiente
├── auth/
│ └── oauth.py # OAuth 2.0 Client Credentials
├── client/
│ └── integration_content.py # Cliente OData HTTP
└── tools/
├── packages.py # IntegrationPackages
├── iflows.py # IntegrationDesigntimeArtifacts
├── deploy.py # DeployIntegrationDesigntimeArtifact
├── runtime.py # IntegrationRuntimeArtifacts
└── endpoints.py # ServiceEndpoints
```
## Tools Disponíveis
### Pacotes (Design)
| Tool | Operação OData |
|------|----------------|
| `list_integration_packages` | GET /IntegrationPackages |
| `get_integration_package` | GET /IntegrationPackages('{Id}') |
| `create_integration_package` | POST /IntegrationPackages |
| `delete_integration_package` | DELETE /IntegrationPackages('{Id}') |
| `copy_integration_package` | POST /CopyIntegrationPackage |
| `list_package_iflows` | GET /IntegrationPackages('{Id}')/IntegrationDesigntimeArtifacts |
### Integration Flows (Design)
| Tool | Operação OData |
|------|----------------|
| `get_integration_flow` | GET /IntegrationDesigntimeArtifacts(Id,Version) |
| `create_integration_flow` | POST /IntegrationDesigntimeArtifacts |
| `update_integration_flow` | PUT /IntegrationDesigntimeArtifacts(Id,Version) |
| `delete_integration_flow` | DELETE /IntegrationDesigntimeArtifacts(Id,Version) |
| `download_integration_flow` | GET .../$value (ZIP base64) |
| `save_integration_flow_version` | POST /IntegrationDesigntimeArtifactSaveAsVersion |
| `get_iflow_configurations` | GET .../Configurations |
| `update_iflow_configuration` | PUT .../$links/Configurations('{key}') |
| `list_iflow_resources` | GET .../Resources |
| `get_iflow_resource` | GET .../Resources(...)/$value |
| `update_iflow_resource` | PUT .../$links/Resources(...) |
| `execute_iflow_design_guidelines` | POST /ExecuteIntegrationDesigntimeArtifactsGuidelines |
| `get_iflow_guideline_results` | GET .../DesignGuidelineExecutionResults |
### Deploy & Runtime (Monitor)
| Tool | Operação OData |
|------|----------------|
| `deploy_integration_flow` | POST /DeployIntegrationDesigntimeArtifact |
| `get_deploy_status` | GET /BuildAndDeployStatus(TaskId) |
| `list_runtime_artifacts` | GET /IntegrationRuntimeArtifacts |
| `get_runtime_artifact` | GET /IntegrationRuntimeArtifacts('{Id}') |
| `undeploy_integration_artifact` | DELETE /IntegrationRuntimeArtifacts('{Id}') |
### Endpoints
| Tool | Operação OData |
|------|----------------|
| `list_service_endpoints` | GET /ServiceEndpoints |
## Instalação
```bash
cd C:\Workspace\mcps\mcp-ci-pyton
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
pip install -e .
cp .env.example .env
# Edite .env com suas credenciais
```
## Configuração
### Tenant SAP Cloud Integration (produção)
```env
SAP_CPI_BASE_URL=https://<tenant>-tmn.hci.<region>.hana.ondemand.com
SAP_CPI_TOKEN_URL=https://<subaccount>.authentication.<region>.hana.ondemand.com/oauth/token
SAP_CPI_CLIENT_ID=<client-id>
SAP_CPI_CLIENT_SECRET=<client-secret>
```
Crie um **OAuth Client** no BTP Subaccount com grant type `client_credentials` e atribua a role `AuthGroup.IntegrationDeveloper` (ou equivalente).
### SAP API Business Hub (sandbox)
```env
SAP_CPI_BASE_URL=https://sandbox.api.sap.com/cpi
SAP_CPI_API_KEY=<sua-api-key>
```
Registre-se em [api.sap.com](https://api.sap.com) para obter a API Key.
## Uso no Cursor
Adicione ao `.cursor/mcp.json` (ou configuração global do Cursor):
```json
{
"mcpServers": {
"sap-integration-content": {
"command": "python",
"args": ["-m", "sap_integration_mcp.server"],
"cwd": "C:/Workspace/mcps/mcp-ci-pyton",
"env": {
"SAP_CPI_BASE_URL": "https://your-tenant-tmn.hci.eu10.hana.ondemand.com",
"SAP_CPI_TOKEN_URL": "https://your-subaccount.authentication.eu10.hana.ondemand.com/oauth/token",
"SAP_CPI_CLIENT_ID": "your-client-id",
"SAP_CPI_CLIENT_SECRET": "your-client-secret"
}
}
}
}
```
Ou usando o entry point instalado:
```json
{
"mcpServers": {
"sap-integration-content": {
"command": "mcp-ci-pyton",
"envFile": "C:/Workspace/mcps/mcp-ci-pyton/.env"
}
}
}
```
## Exemplos de Uso pelo Agente
```
"Liste todos os pacotes de integração"
→ list_integration_packages
"Mostre os iFlows do pacote EmployeeCentral"
→ list_package_iflows(package_id="EmployeeCentral")
"Obtenha as configurações externalizadas do iFlow X"
→ get_iflow_configurations(iflow_id="MyFlow", version="active")
"Atualize o parâmetro endpoint_url para https://api.example.com"
→ update_iflow_configuration(iflow_id="MyFlow", version="1.0.0", parameter_key="endpoint_url", parameter_value="https://api.example.com")
"Faça deploy do iFlow MyFlow versão active"
→ deploy_integration_flow(iflow_id="MyFlow", version="active")
"Liste todos os artefatos deployados com status STARTED"
→ list_runtime_artifacts(odata_query="$filter=Status eq 'STARTED'")
"Quais endpoints REST estão expostos?"
→ list_service_endpoints(odata_query="$expand=EntryPoints&$filter=Protocol eq 'REST'")
```
## Referências
- [SAP Integration Content API - API Business Hub](https://api.sap.com/api/IntegrationContent/resource/Integration_Flow)
- [Manage integration flows via OData APIs](https://community.sap.com/t5/technology-blog-posts-by-sap/manage-your-integration-flows-via-the-sap-cloud-integration-odata-apis/ba-p/13483993)
- [Cloud Integration OData API on API Business Hub](https://community.sap.com/t5/technology-blog-posts-by-sap/cloud-integration-odata-api-on-api-business-hub/ba-p/13386419)
TDQS
Scored across 25 tools
Each tool targets a distinct resource and action (e.g., package vs. flow vs. runtime artifact, create vs. update vs. delete). No two tools have overlapping purposes; descriptions clearly differentiate similar operations.
Tools predominantly follow verb_noun pattern with underscores. However, there is minor inconsistency: some use 'iflow' (e.g., execute_iflow_design_guidelines) while others use 'integration_flow' (e.g., create_integration_flow). This is a small deviation from perfect uniformity.
With 25 tools, the server is on the higher end of the typical range (3-15) but still within acceptable bounds for a comprehensive integration platform. The count feels slightly heavy but not excessive.
The tool surface covers the full lifecycle: CRUD for packages and flows, deployment/undeployment, configuration, resource management, and design guidelines. Minor gaps exist (e.g., no tool for monitoring logs or error details), but core workflows are well-supported.